Skip to content

Bound analyzer provenance tree lookup for broad squash commits - #1139

Merged
unbraind merged 2 commits into
mainfrom
fix/hosted-analysis-tree-metadata
Aug 28, 2026
Merged

unbraind merged 2 commits into
mainfrom
fix/hosted-analysis-tree-metadata

Conversation

@unbraind

@unbraind unbraind commented Aug 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • read squash-commit tree identities through GitHub's bounded Git Database commit endpoint instead of the heavyweight commit-with-files response
  • preserve strict fail-closed handling for unavailable, malformed, or mismatched tree metadata
  • strengthen the existing squash-provenance regression with a simulated 1,048,577-byte standard commit response and require the two narrow metadata reads
  • record the production recurrence, exact merged/head/tree evidence, TDD proof, structured gate evidence, closure, and generated changelog in PM

PM item

Production control

Merged-main CI run 33182695715 failed only Release analyzer readiness for merge 0480ab6. With this change, the real gate resolves PR #1133 head 9f56a49 as identical_tree_squash_pr_head, confirms the shared tree, and accepts DeepScan and CodeFactor at zero findings.

Verification

  • focused hosted-analysis suite: 120/120
  • linked PM acceptance: 3/3, including the real production SHA and package-first temporary-directory dogfood
  • package-first dogfood: 88 commands in an isolated temporary project
  • build, typecheck, repository static quality, graph composition, record integrity, SDK surface/import-cost/transport gates: passed
  • full suite: 585 files, 8,088 tests
  • exact coverage: 100/100/100/100 (60,000 statements, 45,190 branches, 12,477 functions, 57,779 lines)
  • tracked secret scan: passed
  • latest pm-changelog 2026.8.22 installed; CHANGELOG regenerated with the closed item
  • first exact-head hosted matrix: all checks passed; Greptile 5/5 and CodeRabbit full review had no actionable findings

The PM item is closed and released in this reviewed PR. The final closeout commit intentionally triggers a fresh exact-head hosted matrix and bot review before merge.

Read immutable tree metadata through the Git Database commit endpoint so broad squash payloads cannot overflow the analyzer provenance subprocess. Keep unavailable and malformed metadata fail-closed, and add a regression that models the previous response-size failure.

Record the production recurrence, TDD evidence, full coverage, and isolated package dogfood under pm-gactwj.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @unbraind, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 6 hours and 2 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 46 minutes.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bf66f1f0-3ed4-44cd-b513-8f9029030c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 0480ab6 and 434fde3.

📒 Files selected for processing (5)
  • .agents/pm/history/pm-gactwj.jsonl
  • .agents/pm/issues/pm-gactwj.toon
  • CHANGELOG.md
  • scripts/release/hosted-analysis-gate.mjs
  • tests/unit/scripts/release/hosted-analysis-gate.spec.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5a2c5e9d-98c3-496e-af3e-3274e719b347

📥 Commits

Reviewing files that changed from the base of the PR and between 0480ab6 and 9f72d42.

📒 Files selected for processing (4)
  • .agents/pm/history/pm-gactwj.jsonl
  • .agents/pm/issues/pm-gactwj.toon
  • scripts/release/hosted-analysis-gate.mjs
  • tests/unit/scripts/release/hosted-analysis-gate.spec.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved hosted-analysis validation for large squash commits.
    • Prevented oversized commit metadata from causing valid merge trees to be incorrectly rejected.
    • Preserved fail-closed behavior when commit tree information is missing or malformed.
  • Tests

    • Added coverage for bounded commit metadata responses and identical-tree squash scenarios.
    • Verified focused and repository-wide test suites pass.

Walkthrough

The hosted-analysis gate now reads commit trees from GitHub’s bounded Git Database endpoint. Tests update mocked response shapes, verify endpoint usage, and preserve fail-closed behavior. PM records document the defect, fix, regression coverage, and validation results.

Changes

Hosted-analysis provenance

Layer / File(s) Summary
Bounded commit lookup and regression coverage
scripts/release/hosted-analysis-gate.mjs, tests/unit/scripts/release/hosted-analysis-gate.spec.ts
readCommitTree uses repos/{owner}/{repo}/git/commits/{sha} and reads tree.sha. Tests cover identical-tree squash commits, bounded responses, endpoint selection, and fail-closed behavior.
Issue and verification records
.agents/pm/issues/pm-gactwj.toon, .agents/pm/history/pm-gactwj.jsonl
PM records document the production defect, resolution, affected files, regression tests, verification results, and release version.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9f72d

The change bounds squash-commit tree lookups while preserving fail-closed handling for invalid metadata, and adds regression coverage for oversized responses; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: it bounds analyzer provenance tree lookup for broad squash commits.
Description check ✅ Passed The description directly explains the endpoint change, fail-closed behavior, regression coverage, production evidence, and validation results.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@unbraind

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@greptileai please review this exact head.

@sourcery-ai

sourcery-ai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Bounds squash-commit tree lookups by using GitHub’s narrow Git Database commit endpoint, retains fail-closed metadata validation, and adds regression coverage for oversized responses alongside production/PM evidence.

Sequence diagram for bounded squash commit tree lookup

sequenceDiagram
    participant Gate as HostedAnalysisGate
    participant GitHub as GitHubGitDatabaseAPI

    Gate->>GitHub: gh api repos/{repository}/git/commits/{sha}
    GitHub-->>Gate: tree metadata response
    Gate->>Gate: parseObject(stdout, GitHub commit API)
    alt valid tree SHA
        Gate->>Gate: readCommitTree returns normalized tree SHA
    else unavailable, malformed, or mismatched metadata
        Gate->>Gate: readCommitTree returns null
    end
Loading

Flow diagram for fail-closed squash provenance validation

flowchart TD
    A[Read squash commit tree metadata] --> B{Request succeeded?}
    B -- No --> F[Reject provenance]
    B -- Yes --> C[Parse GitHub response]
    C --> D{Valid tree SHA?}
    D -- No --> F
    D -- Yes --> E{Tree matches PR head?}
    E -- No --> F
    E -- Yes --> G[Accept reviewed PR provenance]
Loading

File-Level Changes

Change Details Files
Switch squash-provenance tree resolution to GitHub’s bounded Git Database commit metadata endpoint.
  • Query /git/commits/{sha} instead of the heavyweight commit-with-files endpoint.
  • Read and validate the top-level tree.sha while preserving null-on-error, malformed, or invalid metadata behavior.
scripts/release/hosted-analysis-gate.mjs
Add regression coverage proving bounded metadata lookup avoids oversized standard commit responses.
  • Update mocked API responses and request expectations for the Git Database endpoint.
  • Simulate a 1,048,577-byte standard commit response and verify exactly two narrow tree metadata reads.
  • Retain identical-tree squash provenance assertions and update related fallback fixtures.
tests/unit/scripts/release/hosted-analysis-gate.spec.ts
Record the production recurrence, evidence, acceptance criteria, and implementation history in PM artifacts.
  • Add the PM issue and history entries documenting the overflow defect and production control evidence.
.agents/pm/issues/pm-gactwj.toon
.agents/pm/history/pm-gactwj.jsonl

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

@unbraind: I will perform a full review of the current head for #1139.

✅ Action performed

Full review finished.

@codspeed

codspeed Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 11 untouched benchmarks


Comparing fix/hosted-analysis-tree-metadata (434fde3) with main (0480ab6)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR replaces heavyweight commit-with-files reads with bounded Git Database commit metadata while preserving strict squash-provenance validation. It also strengthens regression coverage and records the completed production-defect closure.

  • Reads immutable tree identities from repos/{repository}/git/commits/{sha}.
  • Verifies broad squash commits through two bounded metadata requests while retaining malformed, unavailable, and mismatched-tree refusals.
  • Closes pm-gactwj, records its evidence history, and adds the generated changelog entry.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
scripts/release/hosted-analysis-gate.mjs Switches tree lookup to the bounded Git Database commit endpoint and correctly validates its top-level tree SHA.
tests/unit/scripts/release/hosted-analysis-gate.spec.ts Updates endpoint fixtures, models the former one-MiB overflow, requires two bounded reads, and retains negative provenance cases.
.agents/pm/issues/pm-gactwj.toon Records a consistent closed production-defect item with required structured gate evidence and verification details.
.agents/pm/history/pm-gactwj.jsonl Provides a consistent mutation history through implementation, verification, closure, and claim release.
CHANGELOG.md Adds the closed defect to the generated Unreleased Fixed section with the corresponding PM link.

Sequence Diagram

sequenceDiagram
  participant Gate as Hosted analysis gate
  participant GH as GitHub API
  Gate->>GH: Read reviewed PR association
  GH-->>Gate: Merge SHA and reviewed head SHA
  Gate->>GH: "GET git/commits/{mergeSha}"
  GH-->>Gate: tree.sha
  Gate->>GH: "GET git/commits/{headSha}"
  GH-->>Gate: tree.sha
  alt Trees match and analyzers pass
    Gate-->>Gate: Accept identical_tree_squash_pr_head
  else Metadata unavailable, malformed, or mismatched
    Gate-->>Gate: Fail closed
  end
Loading

Reviews (2): Last reviewed commit: "docs(pm): close broad squash provenance ..." | Re-trigger Greptile

@unbraind

Copy link
Copy Markdown
Owner Author

CodeRabbit review acknowledged: the exact head produced no actionable findings. The bounded Git Database endpoint, top-level tree validation, overflow negative control, and fail-closed cases are all covered by the green 120-test focused suite and exact hosted matrix.

@unbraind

Copy link
Copy Markdown
Owner Author

Sourcery guide acknowledged: its sequence and failure-path summary matches the implemented contract. The production SHA also passes live through identical_tree_squash_pr_head, so no remediation is required from this guide.

@unbraind

Copy link
Copy Markdown
Owner Author

CodeRabbit full-review completion acknowledged. The reviewed head is 9f72d42 and no actionable findings were emitted.

@unbraind

Copy link
Copy Markdown
Owner Author

CodSpeed result acknowledged: all 11 benchmarks are unchanged, consistent with this release-gate-only endpoint correction.

@unbraind

Copy link
Copy Markdown
Owner Author

Greptile 5/5 review acknowledged: the exact head retains strict provenance semantics, uses validated full SHAs, and has positive plus malformed, unavailable, missing, mismatched, and oversized-response controls. No actionable finding remains.

@unbraind

Copy link
Copy Markdown
Owner Author

Sourcery budget-limit review acknowledged as provider unavailability rather than approval. Its separate generated review guide was still inspected and contained no actionable finding; CodeRabbit, Greptile, hosted analyzers, and repository gates provide the terminal review evidence for this head.

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Record exact-head hosted evidence and structured defect-gate proof, close and release the tracked regression, and regenerate the changelog with pm-changelog 2026.8.22.
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai please review the new exact head 434fde3, including the PM closure and generated changelog.

@unbraind

Copy link
Copy Markdown
Owner Author

@coderabbitai full review of the new exact head 434fde3, including the PM closure and generated changelog.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

@unbraind: I will perform a full review of exact head 434fde3595df5d651c548d97a9ca5e97678164d4. The review includes the PM closure and generated changelog.

⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 46 minutes.

@unbraind

Copy link
Copy Markdown
Owner Author

Codecov exact-head result acknowledged: every modified and coverable line is covered and all tests passed.

@unbraind

Copy link
Copy Markdown
Owner Author

CodeRabbit exact-head request response acknowledged. The provider rate limit is recorded as unavailability, not approval; the same product change was fully reviewed at the prior head, while the closeout-only head passed the complete hosted matrix and Greptile 5/5.

@unbraind

Copy link
Copy Markdown
Owner Author

Edited CodeRabbit summary re-inspected at 2026-08-28T15:42:16Z: the exact-head request was rate-limited and emitted no new actionable comment. This is a provider limitation, not approval.

@unbraind

Copy link
Copy Markdown
Owner Author

CodSpeed exact-head update acknowledged: all 11 benchmarks remain unchanged for head 434fde3.

@unbraind

Copy link
Copy Markdown
Owner Author

Greptile exact-head review acknowledged: head 434fde3 received 5/5, explicitly validated the PM closure and changelog, and reported no blocking failure.

@unbraind
unbraind merged commit 430957a into main Aug 28, 2026
34 checks passed
@unbraind
unbraind deleted the fix/hosted-analysis-tree-metadata branch August 28, 2026 15:52
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.

1 participant