Skip to content

Facts port: the snapshot's diff and files read by one compare pinned to the head commit (#284) - #303

Merged
don-petry merged 6 commits into
mainfrom
adapters/pin-diff-to-head
Oct 22, 2026
Merged

don-petry merged 6 commits into
mainfrom
adapters/pin-diff-to-head

Conversation

@don-petry

@don-petry don-petry commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

A snapshot's diff and file list now come from one compare, pinned to the head of the snapshot's first read. A head pushed away and back while the snapshot is read no longer pairs one commit's content with another head. This is the working ruling on #284, closing the hole the security pass on #278 found.

What changes

  • adapters/pull.py.
    • diff reads GET /repos/{base repo}/compare/{base_head}...{head} with the diff Accept. That is the read timeline._content already makes for a review's commit, so the two content ids are made the same way. P-29 shows the bytes equal the pull request's own diff.
    • changed_paths reads the same compare as JSON and takes files.
    • Both commits are checked as 40-hex before the path is built.
    • A 404 refuses the snapshot.
    • A 406 too_large reads as truncated, as before. That is grounded for the pull request's diff, not for compare's, and the design says so.
  • More than 300 files. A compare lists at most 300 files, as GitHub documents it; no trial records this. A change of more is read short by changed_files alone, with nothing asked, so no answer GitHub gives can refuse the snapshot. The Kernel defers it for the Maintainer.
  • adapters/facts.py. The snapshot passes the base branch's head it already read, and the known-limit sentence is gone.
  • Docs. The design's §3.3 rows for content_id and changed_paths say so, and so does a new Boundaries row on decision 0020.

Boundaries, each with a mutant:

  • A diff or a file list read at another commit is never asked for.
  • The pull request's own diff and list are never read.
  • A base head that is not a commit is refused.
  • A fork's head is compared in the base repo.
  • A compare with no files, or files that are not a list, is refused.
  • A change of more than 300 files is read short with nothing asked.
  • 200 and 300 files read whole.
  • Facts compares against the branch's head, not the pull request's last-named base.

Tests. The port tests replay P-29's recorded diff and files answers as compare reads at the head (as_compare). The diff bytes are P-29's own; the file rows have the same keys a compare gives.

Not done. The fresh review raised a hardening question: could GitHub resolve a 40-hex branch name ahead of the commit? That is unverified, and timeline._content has the same exposure today. It is left for a trial; this PR does not change it.

Reviews, all on 1638f8e, with the fix rounds after.

  • Claude review (fresh context). One major: the contract check for a_path_list_can_leave_out_a_file read made-up rows. Minors: the 300 was not marked unverified; a change of more than 300 files could be refused rather than deferred; the Router's docstring was stale. All are answered in 7b2293a.
  • Security pass. The same review covered it. No path lets an author pair a head with another commit's content or read more than 300 files whole. The branch-name question above stays open.
  • AGY (Gemini 4 Argon). No findings.
  • Muse (Muse Wonder Full). Approve, with two test gaps: the base repo for a fork, and a compare with no files. Both have a test and a mutant in ca40688.
  • Verify. make verify passes on a fresh export of the head.

Closes #284

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

don-petry and others added 4 commits October 21, 2026 18:43
… the head

pull.diff and pull.changed_paths read GET /repos/{repo}/compare/{base_head}...{head}
at the head of the snapshot's first read and the base branch's head the pass read,
never off the pull request: a head pushed away and back during the snapshot gives
the parts of one commit. P-29 shows the compare's diff bytes equal the pull
request's own, so the content id is unchanged. A compare lists at most 300 files,
so a change of more is read short and deferred (the working ruling on #284).

Tests show a diff or a file list read at another commit is never asked for, a
base head that is not a commit is refused, and more than 300 files reads short;
each has a mutant. The design's section 3.3 rows and a row on decision 0020 say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its count alone

The fresh review found the contract check for a_path_list_can_leave_out_a_file read
made-up rows, and that a change of more than 300 files could be refused, not deferred,
by any answer the compare gave. Such a change is now read short by changed_files alone,
with nothing asked, which the fixture's 3,001 files ground; the 300 is marked as GitHub
documents it, unverified, in the port, the design and decision 0020's row. The Router's
docstring says what it now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no files is refused

Muse on #284's first head: neither had a test a mutant would fail. Each now has both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@don-petry
don-petry requested a review from a team as a code owner October 22, 2026 00:57
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-22T00:57:41.507547Z
We couldn’t complete this review. Comment @codex review to try again.
210afac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: combsmith/software-factory/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: beb6e76c-fdc9-4a16-a2be-64de1700bbe4
📥 Commits

Reviewing files that changed from the base of the PR and between 9e927b4 and f71e7c8.

📒 Files selected for processing: 7
  • adapters/facts.py
  • adapters/pull.py
  • docs/architecture/software-factory-design.md
  • docs/decisions/0020-a-change-to-the-factorys-own-rules-or-a-lenss-inputs-is-reviewed-by-a-model-lens.md
  • sim/grounding.py
  • tests/test_adapters.py
  • tools/mutants.py
  • 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.

@don-petry
don-petry added this pull request to the merge queue Oct 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 22, 2026
don-petry and others added 2 commits October 21, 2026 20:30
…he head and #296's closing read

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 72fd89a Oct 22, 2026
20 checks passed
@don-petry
don-petry deleted the adapters/pin-diff-to-head branch October 22, 2026 04:03
don-petry added a commit that referenced this pull request Oct 22, 2026
Co-Authored-By: Claude Opus 5.5 <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.

Facts port: the snapshot's diff and files pinned to the head commit, so a head pushed away and back is seen

1 participant