Skip to content

feat(convergence): add review_targets table — #1025 state migration - #1052

Merged
JSONbored merged 1 commit into
mainfrom
feat/state-migration
Jun 22, 2026
Merged

feat(convergence): add review_targets table — #1025 state migration#1052
JSONbored merged 1 commit into
mainfrom
feat/state-migration

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

Adds migrations/0050_review_targets.sql — the one missing stateful table in the reviewbot → gittensory state migration (#1025). gittensory already provisioned the other 4 stateful tables (submitter_stats 0046, tunables 0047, review_audit 0049), but had no review_targets, even though already-ported code reads it (src/review/ops.ts, src/review/submitter-reputation.ts).

review_targets carries the two load-bearing concepts as columns:

  • decision-cache (decided_sha + decision_json) — terminal verdict computed once per commit
  • approve-once-per-commit (approved_sha)

Data migration (applied out-of-band to remote)

The remote table + data seed were applied directly (reviewbot D1 → gittensory D1, export→transform→import, all idempotent upserts, reviewbot read-only throughout). Verified:

  • review_targets: 3233 == 3233 — byte-perfect (decided_sha 2642, decision_json 2643 / 8,889,722 bytes identical, approved_sha 1376, terminal-no-cache canary 591 — all match)
  • submitter_stats: additive merge (gittensory pre + reviewbot = 605/153/201/251, no clobber of gittensory's own rows)
  • review_audit: 125,586 history rows copied (source='reviewbot')
  • project remapped slug → full-name (gittensoryJSONbored/gittensory) to match gittensory's native convention

This file keeps migrations/ and the d1_migrations table consistent (the migration is already recorded as applied on remote, so deploy-time migrations apply is a no-op).

Part of convergence epic #983 / #1025.

…state migration

The one missing stateful table in the reviewbot→gittensory migration. Already-ported code (src/review/ops.ts health queries, src/review/submitter-reputation.ts live signal) reads review_targets but it never existed in gittensory. Folds reviewbot's accumulated schema (0001+0003/0005/0006/0007/0010) into one CREATE: decided_sha/decision_json (per-head_sha decision cache) + approved_sha (approve-once-per-commit) prevent the re-review storm on cutover. Raw-SQL-only (matching the 0046-0049 parity-store convention); review_audit FK deliberately omitted (0049 already dropped it). The remote table + data seed (3233 review_targets, +24 submitter_stats merged, 125586 review_audit) were applied out-of-band; this file keeps migrations/ and d1_migrations consistent.
@dosubot dosubot Bot added the size:M label Jun 22, 2026
@ghost

ghost commented Jun 22, 2026

Copy link
Copy Markdown

Note

🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦

💡 Gittensory review — advisory only

0 files · no blockers · readiness 0/100

💡 Advisory only — no action taken

Signal Result Evidence
Code review ✅ No blockers synthesized
Gate result ⚠️ Skipped #1052 is no longer open.

💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 22, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.75%. Comparing base (3c20514) to head (3b04125).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1052       +/-   ##
===========================================
+ Coverage   71.63%   96.75%   +25.11%     
===========================================
  Files         143      143               
  Lines       17580    17580               
  Branches     6364     6364               
===========================================
+ Hits        12594    17010     +4416     
+ Misses       3825      108     -3717     
+ Partials     1161      462      -699     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 2288644 into main Jun 22, 2026
26 of 28 checks passed
@JSONbored
JSONbored deleted the feat/state-migration branch June 22, 2026 18:43
JSONbored added a commit that referenced this pull request Jun 22, 2026
…ke timers)

The test drove an async flow — real WebCrypto token-decrypt + async D1/fetch interleaved with one setTimeout(sleep 3000) — via a fake-timer pump loop. Under CI full-shard coverage load the real macrotask lagged the microtask flush the pump relied on, so the scheduled sleep was never fired and the test HUNG → 15s timeout (the CI-only flake that blocked #1050/#1051/#1052/#1056).

Fix: drop fake timers entirely. Mock setTimeout so the sleep(3000) backoff fires on a real 0ms tick, then await processSubmitDraft directly — the flow runs to completion on the real event loop (probe 404 → instant backoff → probe 200 → open PR) with no pump, no race, no real 3s wait, no weakened assertions. Verified stable across 6+ consecutive plain + coverage runs locally.
JSONbored added a commit that referenced this pull request Jun 22, 2026
…ke timers) (#1057)

The test drove an async flow — real WebCrypto token-decrypt + async D1/fetch interleaved with one setTimeout(sleep 3000) — via a fake-timer pump loop. Under CI full-shard coverage load the real macrotask lagged the microtask flush the pump relied on, so the scheduled sleep was never fired and the test HUNG → 15s timeout (the CI-only flake that blocked #1050/#1051/#1052/#1056).

Fix: drop fake timers entirely. Mock setTimeout so the sleep(3000) backoff fires on a real 0ms tick, then await processSubmitDraft directly — the flow runs to completion on the real event loop (probe 404 → instant backoff → probe 200 → open PR) with no pump, no race, no real 3s wait, no weakened assertions. Verified stable across 6+ consecutive plain + coverage runs locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant