Skip to content

fix(ingest): scope body ledger rows to their PR or issue - #1270

Merged
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
claude/project-thread-u2zd46
Oct 22, 2026
Merged

Zach Dunn (zachdunn) merged 1 commit into
mainfrom
claude/project-thread-u2zd46

Conversation

@zachdunn

Copy link
Copy Markdown
Member

Requested by Zach · project thread

Why

ledgerRowsForSource matched rows on repo + source only. Every PR and issue in a repo has a "body" source, so reconciling any one body detached the imported attachments of every other PR and issue in that repo.

Found while verifying #1269 on sunny-sdk/sunny#3332. Its two imports were ledgered at 16:20 and then detached at 16:52, even though both images are still in the description and the PR hadn't changed since 16:09. Every older imported row for sunny-sdk/sunny is detached the same way. After #1269, a detached import also drops out of the managed comment, so the bug is now visible on GitHub, not only in the index.

What

  • ledgerRowsForSource(db, repo, kind, num, source) now matches kind and num too, the same way the adopt ledger (adoptLedgerRowsForSource) already does.
  • The in-memory ledger fake and the existing tests follow the new signature.
  • New regression tests: reconciling PR 8's body leaves PR 7's body import attached, and the sqlite ledger test checks that another PR's or an issue's "body" never matches.

Rows already detached by this bug reattach the next time their target reconciles: a body edit, or uploads ingest --pr N.

Tests

apps/api vitest: 3503 passed. pnpm typecheck and prettier pass.


Generated by Claude Code

ledgerRowsForSource matched on repo + source only, and every PR and issue
in a repo has a "body" source. Reconciling any one body therefore
detached the imported attachments of every other PR and issue in the
repo. Match on kind and number too, like the adopt ledger does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012CvhtYD1ej6agd8LiARpXp
@changeset-bot

changeset-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 83ff7c7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@zachdunn Zach Dunn (zachdunn) self-assigned this Oct 22, 2026
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 2
  • coderabbit:review
  • review
🚫 Excluded labels (none allowed): 1
  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a18a068e-b03d-4dfe-8fe3-c541bd597705

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zachdunn
Zach Dunn (zachdunn) merged commit 81a0e7e into main Oct 22, 2026
3 checks passed
@zachdunn
Zach Dunn (zachdunn) deleted the claude/project-thread-u2zd46 branch October 22, 2026 17:28
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.

2 participants