Repository navigation
fix(projector): delete issues and projection rows #7194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,6 +190,18 @@ export async function getItems(db: Client, refs: string[]): Promise<ItemRow[]> { | |
| return r.rows as unknown as ItemRow[]; | ||
| } | ||
|
|
||
| /** Remove a deleted GitHub item and its projected activity/link rows atomically. */ | ||
| export async function deleteItem(db: Client, ref: string): Promise<void> { | ||
| await db.batch( | ||
| [ | ||
| { sql: "DELETE FROM pmp_links WHERE ref = ?", args: [ref] }, | ||
| { sql: "DELETE FROM pmp_comments WHERE ref = ?", args: [ref] }, | ||
| { sql: "DELETE FROM pmp_items WHERE ref = ?", args: [ref] }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If an older issue/comment delivery arrives after the deletion, or an in-flight reconciliation fetched the issue before it was deleted, removing the row entirely allows Useful? React with 👍 / 👎.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed on main (PR #6792 lineage): deleteItem persists a monotonic tombstone in pmp_item_deletions in the same write batch as the row removals, and upsertItem/deletionBlocks reject later upserts for the ref at or before the marker, including reconciliation replays. This PR is being closed as superseded; see the salvage note on the PR. |
||
| ], | ||
| "write", | ||
| ); | ||
| } | ||
|
|
||
| export async function listItems( | ||
| db: Client, | ||
| opts: { repo?: string; state?: string; kind?: string; limit?: number }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For an
issueswebhook with actiondeleted, this branch bypassesapplyIssue, which previously queued the normalized event throughhot(), without adding a replacement event. Consequently, the deletion changes the projection and is recorded as applied, but/hotnever reports it or advances its high-water cursor for it. This breaks the documented change-ledger contract and prevents a checkpoint-based consumer from discovering the deletion. Queue an issue-deletion hot event alongside the delete operation.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed on main: the issues/deleted branch in projector.ts now calls store.deleteItem AND queues a hot(issue:...) event for the deletion, so /hot reports it and advances its high-water cursor. This PR is being closed as superseded; see the salvage note on the PR.