Skip to content

chore(migration): fix Mar 28-29 inscription IDs and void orphaned earnings (closes #339)#385

Merged
whoabuddy merged 1 commit into
mainfrom
chore/curation-cleanup-339
Apr 7, 2026
Merged

chore(migration): fix Mar 28-29 inscription IDs and void orphaned earnings (closes #339)#385
whoabuddy merged 1 commit into
mainfrom
chore/curation-cleanup-339

Conversation

@biwasxyz
Copy link
Copy Markdown
Contributor

@biwasxyz biwasxyz commented Apr 5, 2026

Summary

  • Adds migration v17 that updates Mar 28 and Mar 29 brief inscription_id fields to the amended (curated 30-signal) versions
  • Voids 312 orphaned earnings (107 from Mar 28, 205 from Mar 29) that have no payout_txid and were never paid out from the over-sized original briefs
  • Keep-lists from the issue preserve the 60 curated earnings that were already paid

Test plan

  • All 246 existing tests pass (27 test files)
  • After deploy, verify GET /api/brief/2026-03-28 returns inscription_id 7cad42fa...
  • After deploy, verify GET /api/brief/2026-03-29 returns inscription_id 07b3788e...
  • Verify orphaned earnings for those dates show voided_at set

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 5, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
agent-news 333ba7e Apr 07 2026, 10:38 PM

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2026

Preview deployed: https://agent-news-staging.hosting-962.workers.dev

This preview uses sample data — beats, signals, and streaks are seeded automatically.

@biwasxyz biwasxyz requested a review from arc0btc April 5, 2026 04:03
Copy link
Copy Markdown
Contributor

@tfireubs-ui tfireubs-ui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean data migration — updates Mar 28-29 inscription IDs to curated versions and voids orphaned earnings (unpaid, not already voided). The NOT IN exclusion lists correctly preserve the 30 curated signals per day. Migration v17 claim: note that if any of my open PRs (#343 v17, #333 v18, #357 v19) merge first, this will need a version bump — but since this is publisher-authored, it likely lands first. try/catch on each statement is a safe pattern for data-fix migrations. LGTM.

Copy link
Copy Markdown
Contributor

@arc0btc arc0btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration v17 to update the Mar 28-29 inscription IDs to the curated 30-signal versions and void 312 orphaned earnings — clean and well-scoped.

What works well:

  • The migration SQL exactly matches the amended inscription IDs from issue #358 (7cad42fa... for Mar 28, 07b3788e... for Mar 29)
  • Time window scoping for the earnings void (04:00–05:00Z for Mar 28 compilation, 09:00–10:00Z for Mar 29) correctly targets the over-sized brief creation window
  • Both NOT IN lists contain exactly 30 UUIDs — matches the stated "curated 30-signal" goal per date
  • Idempotency is preserved: the earnings void uses voided_at IS NULL so re-runs are safe; the inscription update is naturally idempotent
  • Error handling (try/catch per statement) is consistent with every prior migration in this codebase
  • Good JSDoc comment on MIGRATION_CURATION_CLEANUP_SQL documenting the what, why, and timestamp

[nit] Inscription update doesn't check current value (schema.ts:525-528)
Not a bug — the update is idempotent regardless — but adding AND inscription_id != '7cad42fa...' would make it a no-op on already-corrected rows and slightly clearer in logs. Take it or leave it.

Code quality notes:
No reuse issues — the migration pattern is already established and this follows it correctly. The NOT IN lists are dense but there's no cleaner representation for "these exact 30 UUIDs."

Operational context:
This PR complements PR #359 (already approved): #359 fixes the API-level 409 response with a PATCH hint so future corrections have a proper path; this PR corrects the data directly via migration since the current endpoint blocks overwrite. The two together fully close issue #358. We process the daily brief archive in our sensors — having correct inscription IDs here matters for the /archive page integrity our agents rely on.

…nings (closes #339)

Migration v17 updates the two brief inscription IDs to the amended
(curated 30-signal) versions and voids 312 orphaned earnings that were
never paid out from the over-sized original briefs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@whoabuddy whoabuddy force-pushed the chore/curation-cleanup-339 branch from 691671f to 333ba7e Compare April 7, 2026 22:37
@whoabuddy whoabuddy merged commit f4a66bf into main Apr 7, 2026
7 checks passed
whoabuddy pushed a commit that referenced this pull request Apr 21, 2026
… + Mar 31 over-cap (closes #502) (#505)

Rebased onto main, renumbered migration 24 → 25 (migration 24 was taken by
signal-scoring #343, merged 2026-04-20). Also addresses reviewer feedback:

- voided_at writes use datetime('now') instead of a hardcoded 2026-04-17
  timestamp, so the audit trail reflects actual run time (Arc's suggestion).
- Part A un-void stmt pinned to voided_at >= 2026-04-14T00:00:00Z so only
  the wholesale-void is reversed; earlier unrelated voids stay intact
  (biwas's suggestion).
- History comment documents the intentional "advance version even on per-
  statement error" choice (idempotency makes retry safe; the alternative
  blocks all subsequent migrations on a transient storage blip).

Three parts — all UPDATE-only, idempotent, mirroring migration 20 (#385):

1. Apr 7 brief amendment. Inscription 2d999d7f…i0 committed 30 signals in
   its child-inscription witness; platform re-curated to a different 30
   after the 2026-04-14 wholesale void. Reconciles earnings with the
   on-chain record: voids 14 re-curated-only signals, un-voids 14 witness-
   only signals. Platform brief_signals left as-is (#500 guard keeps them
   immutable post-inscription).

2. Clears 8 dropped-mempool RBF payout_txid values (7 Mar 25 nonces 22-28
   + 1 Mar 31 nonce 589) so curated-payout.ts can resend the victimized
   transfers. Dropped txids preserved in operator manifest.

3. Mar 31 over-cap void — voids 98 brief_inclusion earnings not in the
   curated 30 from db/briefs/amended-2026-03-31.html. 29 already-paid
   earnings skipped by the payout_txid IS NULL guard; 1 unpaid canonical
   signal stays payable for the next payout run.

Co-authored-by: Jason Schrader <jason@joinfreehold.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

4 participants