Skip to content

Audit That a Merge-Bot Caller Stub Subscribes to auto_merge_disabled - #4326

Merged
ptr727 merged 3 commits into
developfrom
burndown/merge-bot-stub-types-audit
Nov 20, 2026
Merged

ptr727 merged 3 commits into
developfrom
burndown/merge-bot-stub-types-audit

Conversation

@ptr727

@ptr727 ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Summary

#4310 moved the merge bot's re-arm onto the pull request auto_merge_disabled event, which each caller stub has to subscribe to. Nothing audited that subscription. requireTokensInJob reads one job, and a stub's on: types sit outside every job, so a repository keeping its old stub passed the audit while the re-arm job never ran there.

  • spec/audit_contract.py (new): a file-level requireTokens contract key, read against the whole caller file's code view, so a comment naming the token does not satisfy it. A missing token is DRIFT, matching the other interface contract keys. The module holds every contract token check, so artifactNameToken, requireTokensInJob, and forbidTokensInJob move here too, with their findings, messages, and order unchanged.
  • spec/audit.py: check_interface calls the new module. The file goes from 2996 to 2977 lines. Its 3000-line ceiling is unchanged.
  • spec/files.json: the merge-bot entry requires auto_merge_disabled.
  • spec/files.schema.json and spec/validate.py: declare the key and validate it as an array of strings.
  • tests/test_audit_helpers.py: a pass case, a fail case, a comment-only case, and a check that the hub's own stub and the catalog snippet meet the carried contract. A further case runs the validator over a manifest whose requireTokens is a single string and asserts its refusal. The two shipped-stub cases share one contract lookup.
  • tests/test_audit_size.py: a 200-line ceiling for the new module.
  • spec/fidelity-model.md: a caller stub's contract now also covers an activity type its hub task needs it to subscribe to.

Fleet effect: drift, not an advisory

A read of each registry repository's default-branch stub found that 20 cataloged repositories still lack auto_merge_disabled, plus 1 archived one. Only the hub's own stub has it. Each of those now draws one DRIFT finding from the interface check on merge-bot-pull-request.yml.

That is drift rather than an advisory, for these reasons:

  • The stub is carried content. A hub change to a carried unit puts every carrier out of line until that carrier's next resync, and the drift finding is what drives the resync to carry it. The new subscription rides each repository's next resync the way any other carried-stub change does.
  • Nothing else moves it. An advisory fits a gap an automatic mechanism closes on its own, as Dependabot does for a hub pin under pins.age. No mechanism edits a stub's on: types.
  • The gap is a functional one. Without the subscription the re-arm job never runs, which is the silent stall The Merge Bot's Auto-Merge Is Silently Disabled on Workflow-File Bumps #4063 fixed.

A repository that holds the old stub on purpose can say so with a registry driftNote, as for any other drift.

Verification

  • uv run --no-project --script spec/validate.py: OK.
  • python -m unittest discover -s tests with tests/requirements.txt: 4618 tests, OK (12 skipped).
  • spec/audit.py --selftest passes.
  • ruff check, ruff format --check, mypy, and the prose gate are clean.

Closes on promotion: #4313

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 20, 2026 06:55
Add a file-level requireTokens contract key, read against the whole
caller file's code view, in a module of its own so spec/audit.py stays
under its ceiling. The merge-bot entry now requires auto_merge_disabled,
which the hub task's re-arm job needs the stub to subscribe to.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fidelity model said a caller stub's contract is the hub task and the
secrets it maps. The merge-bot stub's contract now also covers the event
its hub task needs it to subscribe to.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move artifactNameToken, requireTokensInJob, and forbidTokensInJob into
audit_contract beside requireTokens, so one function reads every token
against the file's or a job's code view. Share the carried-contract
lookup between the shipped stub tests, test the validator's refusal of a
single-string requireTokens, and call the stub's subscription an activity
type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 20, 2026 15:15
@ptr727

ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

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

@coderabbitai

coderabbitai Bot commented Nov 20, 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 48 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

Commits

Reviewing files that changed from the base of the PR and between 0d399c3 and 6284664.

Files selected for processing: 8

  • spec/audit.py
  • spec/audit_contract.py
  • spec/fidelity-model.md
  • spec/files.json
  • spec/files.schema.json
  • spec/validate.py
  • tests/test_audit_helpers.py
  • tests/test_audit_size.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

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.

🟢 Approval recommended

No active issues were identified, and the change addresses the stated interface-contract gap requiring merge-bot caller stubs to subscribe to auto_merge_disabled.

No open issues 🎉

What changed in this PR

This pull request extends interface auditing so merge-bot caller stubs must subscribe to auto_merge_disabled, preventing silent re-arm failures across fleet repositories.

Changes:

  • Adds file-level requireTokens auditing and centralizes token validation.
  • Requires auto_merge_disabled in the merge-bot workflow contract.
  • Adds schema, validator, documentation, tests, and a module size limit.
File Description
tests/​test_audit_size.py Adds a line-count ceiling for the new contract auditing module.
tests/​test_audit_helpers.py Adds coverage for token detection, comment exclusion, shipped stubs, and malformed contract definitions.
spec/​validate.py Validates requireTokens as an array of strings.
spec/​files.schema.json Declares the requireTokens contract property in the manifest schema.
spec/​files.json Requires auto_merge_disabled for merge-bot caller stubs.
spec/​fidelity-model.md Documents activity subscriptions as part of caller interface fidelity.
spec/​audit.py Delegates interface token validation to the new contract auditing module.
spec/​audit_contract.py Centralizes file-level and job-level interface token checks.

Review effort: Lite

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.26%. Comparing base (0d399c3) to head (6284664).

Files with missing lines Patch % Lines
spec/audit_contract.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4326      +/-   ##
===========================================
+ Coverage    79.25%   79.26%   +0.01%     
===========================================
  Files           44       45       +1     
  Lines        15887    15890       +3     
===========================================
+ Hits         12592    12596       +4     
+ Misses        3295     3294       -1     
Flag Coverage Δ
python-3.13 79.26% <94.73%> (+0.01%) ⬆️

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 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit af07941 into develop Nov 20, 2026
15 checks passed
@ptr727
ptr727 deleted the burndown/merge-bot-stub-types-audit branch November 20, 2026 15:32
ptr727 added a commit that referenced this pull request Nov 22, 2026
…udit, Co-Author (#4330)

## Summary

Promotes `develop` to `main`. It carries four changes:

- [#4325](#4325) reads
Jinja template comments in the prose gate.
- [#4323](#4323) names the
registration grace refusal and routes a missing shared hook to the
maintainer.
- [#4326](#4326) audits
that a merge-bot caller stub subscribes to `auto_merge_disabled`.
- [#4324](#4324) allows a
co-author line by default and never a session link.

Closes #4308
Closes #3869
Closes #1264
Closes #4307
Closes #4313

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* The installer now sets `attribution.sessionUrl` to `false` when the
setting is absent, while preserving existing host values. Reports
identify missing settings and note host-owned values.
* Prose checks now recognize Jinja templates and handle their comments
more accurately.
* Workflow specifications can require tokens across entire workflows,
with validation for the new requirement.

* **Documentation**
* Updated guidance clarifies hook reporting, check-registration timing,
and commit and pull request attribution rules.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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