Skip to content

Refuse a Mixed Companion and Script Pair When Hub Main Is Unresolved in hub_fetch_run.py - #3696

Merged
ptr727 merged 4 commits into
developfrom
feature/burndown-3533
Oct 31, 2026
Merged

ptr727 merged 4 commits into
developfrom
feature/burndown-3533

Conversation

@ptr727

@ptr727 ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Summary

When resolve_main_commit() cannot resolve a SHA, hub_fetch_run.py fetched the prose gate's companion and the script from moving main as separate raw URLs, so a push between the requests could pair revisions. In that case the helper now fetches the companion and script sequence twice and refuses (exit 1, "the gate did not run") when any file differs between the two reads. A resolved commit is still fetched once.

Why this design

The raw-only hosts that reach the unresolved path have no API, git, or archive route, so a single immutable fetch is unavailable there. Refusing outright would break the documented raw-only fallback. A bracketed double read needs no new endpoint, stays standard-library only, and turns a push landing mid-run into a loud refusal that names the re-run.

Residual limit, found in review and deliberately stated: raw.githubusercontent.com caches each URL separately at its CDN, so right after a push the two URLs can serve different revisions consistently, and the bracket cannot see that. The docstring claims only the mid-run push case. Closing the CDN case needs an immutable fetch (an archive, or a version stamp shared by script and data), which is a larger design change than this issue's snippet-only scope.

Docs in GOVERNANCE.md and the husky/pre-commit READMEs describe the unresolved fallback as still running the gate; they do not mention the new refusal. They were out of this change's file claim and are reported for a follow-up.

Closes on promotion: #3533

🤖 Generated with Claude Code

@ptr727 ptr727 added the script A defect in hub tooling label Oct 31, 2026
Copilot AI lite review requested due to automatic review settings October 31, 2026 14:56
@ptr727 ptr727 added the script A defect in hub tooling label Oct 31, 2026
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • 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

@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 68d20ea1dadb8a6b36e37a50c656e453d59ee5b5, the content this pull request carries at that commit against develop, and it recorded 3 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

An active nit remains in the docstring because it does not document that differing unresolved main reads are rejected before the gate runs.

1 open issue
What changed in this PR

This pull request hardens the unresolved-main fallback in hub_fetch_run.py by double-fetching the companion and script, refusing to run the gate when the reads differ, while preserving single-fetch behavior for resolved commits.

Changes:

  • Added shared fetching and structured fetch-error handling.
  • Added consistency checks for unresolved main reads.
  • Added refusal behavior for potentially mixed revisions.
  • Added tests for mixed-pair refusal, fallback fetch counts, and resolved-commit behavior.
  • The function docstring should document the new refusal case.
File Description
tests/​test_hub_fetch_run.py Tests mixed-pair refusal, fallback fetch counts, and resolved-commit behavior.
catalog/​snippets/​hub_fetch_run.py Implements shared fetching, error handling, and double-read consistency checks for unresolved main fetches.

Review effort: Lite

Comment thread catalog/snippets/hub_fetch_run.py Resolved
@ptr727

ptr727 commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head e892858ca72c7a7bae76330ccb1f100351bca749, the content this pull request carries at that commit against develop, and it recorded 1 finding.

@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.91%. Comparing base (431ffaf) to head (e892858).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3696   +/-   ##
========================================
  Coverage    81.91%   81.91%           
========================================
  Files           27       27           
  Lines         9224     9224           
========================================
  Hits          7556     7556           
  Misses        1668     1668           
Flag Coverage Δ
python-3.13 81.91% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727
ptr727 merged commit 1f44316 into develop Oct 31, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/burndown-3533 branch October 31, 2026 15:43
ptr727 added a commit that referenced this pull request Oct 31, 2026
…ne Revision, and Place Copilot's Outstanding Findings (#3703)

Promotes the changes merged into `develop` since promotion #3693 to
`main`, the second round of a backlog burndown.

- [#3698](#3698) Has
`drive-pr` read `state=` in every digest `wait` or `status` prints. On a
feature pull request a peer merged, the drive skips the merge and goes
on to the post-merge path. On a promotion it reports the merge as the
drive's end state. `state=CLOSED` is a stop. `state=` decides over any
exit code on such a pull request. `scripts/README.md` documents the
`state=`, `merged_at=`, `merge_commit=` and `closed_at=` fields.
- [#3696](#3696) Has
`hub_fetch_run.py` read the prose gate's companion and script twice from
`main` when no hub commit resolves, refusing with "the gate did not run"
when the reads differ, so a hub push between the two requests cannot
pair revisions. A resolved commit is still fetched once.
- [#3702](#3702) Places a
Copilot overview's `Outstanding findings:` or `Unresolved review
findings:` list and prints each item under FINDINGS WITH NO THREAD,
marked by whether a current thread sits at its code-span `path:line`. A
findings label with no readable list holds as an unplaced part. A
changed file with no changed line, added, modified or deleted, is left
out of the table match while a file with changed lines remains, so a
table omitting only binary files reads as covering.

Remaining for the maintainer, from #3702: an empty file, a mode-only
change, and a text file `.gitattributes` marks `binary` or `-diff` read
0/0 like a binary file, so a Copilot table leaving one out still reads
as covering. That is the trade #3489 asked for.

Deferred review findings: #3697 (open findings on a peer-merged feature
pull request get no outcome before cleanup in `drive-pr`) and #3700 (the
three documents describing `hub_fetch_run.py`'s fallback without its new
refusal).

Fixes #3688
Fixes #3533
Fixes #3672
Fixes #3489
Fixes #3701

🤖 Generated with [Claude Code](https://claude.com/claude-code)
ptr727 added a commit that referenced this pull request Nov 2, 2026
…r Refusal (#3829)

## Summary

- Bump the two stale hub caller snippet pins,
`merge-bot-pull-request.yml` (was 2.0.338) and
`run-periodic-codegen-pull-request.yml` (was 2.0.352), to the 2.0.1319
release commit `320713d9`. Each snippet's `secrets:` matches the
callee's `workflow_call` at that commit. The merge-bot's optional
`rules`, `delete-branch` and `app-login` inputs, which the snippet's
comments name, all exist there. The codegen callee dropped its optional
`NINJA_API_KEY` secret, which the snippet never passed.
`test-pull-request.yml`, `publish-release.yml` and
`test-pull-request-smoke.yml` were already past the prose gate's
non-UTF-8 fix and are unchanged.
- GOVERNANCE.md "Hub-Hosted Tooling" gains the one sentence the
maintainer chose on #3745: Dependabot keeps the `uses:` pin current, so
the never-pinned rule for a doc gate fetched from `main` does not reach
it.
- State `hub_fetch_run.py`'s mixed-pair refusal where its
unresolved-commit fallback is documented: GOVERNANCE.md "Running the
Linters Locally" and the husky and pre-commit snippet READMEs. The
fallback reads the prose gate and its data from `main` twice, refuses
when the reads differ, and a re-run is the remedy.

The residual per-URL CDN caching risk from #3696's review needs an
immutable fetch, a design change filed as #3827 (`deferred`).

Not changed: `docs/reusable-workflows.md`'s adopt-stub copies of these
two pins (the "Adopting the Merge-Bot" and codegen stubs) and
`catalog/snippets/workflows/README.md`'s history line still name 2.0.338
and 2.0.352. A Markdown-quoted pin is never bumped by Dependabot, which
is exactly #1472's open question, so they are left for that issue rather
than hand-bumped here.

Closes on promotion: #1666, #3700

## Pre-existing findings, not filed

- `catalog/snippets/workflows/publish-release.yml`,
`test-pull-request-smoke.yml`, `test-pull-request.yml`: these still pin
2.0.1122 and 2.0.1166, which are past the fix #1666 needed but older
than 2.0.1319, and the hub's Dependabot config does not scan
`catalog/snippets/workflows`. That is `pre-existing`, outside this
change's file claim. The class, a snippet pin nothing keeps current, is
#1472's.

## Verification

- `git rev-parse '2.0.1319^{commit}'` resolves to
`320713d9d491f578b5604a8d67b82478717d7b05`, the latest release per `gh
release list`.
- Callee `on.workflow_call` read at that commit for both snippets.
- Prose gate against `origin/develop`: clean. Repo gate: every check ok,
`sha-pin` resolving both new pins against GitHub.
`tests/test_release_guards.py`: 33 passed.
- `local-strict-review`, two recorded passes: the first raised two
`introduced` wording findings in GOVERNANCE.md (a carried sentence
leaning on a reason stated only in a hub-only section, and an ambiguous
"That fallback"), both fixed in the second commit. The second pass
raised nothing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

script A defect in hub tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants