Implements Q7 of the queue-schema design (#14170; design of record doc/2026-11-24T07-23-14Z_design_queue-metadata-history/, §8 + §11): GitHub-side history in the mirror projector (pkgs/github-ci/worker). Q7 depends on nothing in the Q-chain and lands independently of Q1.
What
github_issue_history (mirror.sql + MIRROR_DDL, ensured idempotently like every mirror table): one append-only row per observed change — body_edited (hashes only, never bodies), comment_added / comment_removed / comment_count_changed (counts only; the direction kinds only when the delivery itself is an issue_comment action; an agent-note pointer change rides the same row's detail), parent_changed. Diffs are computed from a pre-upsert read under the upserts' own acceptance rules — the tombstone guard and the snapshot/count version guards, spelled in TS beside their SQL twins (the deletionBlocks pattern) — so history never records a change that did not land, and first sights write nothing. Capture is fail-open (design §10.3): history rows are written in their own batch after the mirror batch lands, inside a catch.
parent_number projection on github_mirror_issues (additive column, ensureMirrorColumns migration like comments_gh_updated_at): parsed from parent_issue_url in snapshot objects — a parent_known CASE in the upsert keeps the stored value when an object does not state a parent, and a cross-repo parent's repo rides the parent_changed detail — and from sub_issues webhook deliveries (new route in index.ts; unseen children are seeded minimal, as the comment path seeds).
- Backfill sweep: parent joins the diff key (so the projection populates on the first post-Q7 sweep), and the sweep writes its own diff rows (actor
backfill) for the body/count/parent changes it lands, including forced count repairs — flushed fail-open and counted in the run summary (history_rows / history_failed).
Reserved vocabulary, deliberately not written by this slice (per §11 scope): linked / unlinked / state_changed. Emoji reactions remain the design's considered rejection (§8.3). No new dependencies.
Oracle (§11 Q7) — as named tests
Editing a watched issue's body, commenting, and re-parenting a sub-issue each produce exactly one correct row; a killed history write still lands the mirror upsert. All four are tests in test/mirror.test.ts ("mirror history (#14170 Q7)"), plus redelivery, stale-snapshot, first-sight, and silent-parent cases.
Evidence
Remote run (fleet queue dispatch; the executor image has no node/npm, so Node came from nix shell nixpkgs#nodejs_22): run 45372159946 — npm ci (140 packages), tsc --noEmit clean, vitest: 7 files, 91 tests, all passed — mirror.test.ts 34 (15 new Q7 tests), worker.test.ts 20 (incl. the new sub_issues route test), backfill.test.ts 10 (incl. the new parent-bind test).
Side finding, filed + enqueued separately: plain npm ci currently fails on a pre-existing peer conflict (wrangler 4.167 wants @cloudflare/workers-types ^5; the package pins ^4) — #14298, queue task 23064. The verification run used --legacy-peer-deps for that reason only.
Ops note
The sub_issues route receives deliveries only if the webhook subscription includes the sub_issues event — worth confirming in the webhook/App settings at deploy time. The snapshot + sweep parent projection works regardless.
Part of #14170. Queue task 21705.
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.