Skip to content

pre-commit registers only the commit's own tests - #22056

Merged
teamleaderleo merged 6 commits into
feat-cmux-nextfrom
claude/hooks-own-files-only
Oct 20, 2026
Merged

teamleaderleo merged 6 commits into
feat-cmux-nextfrom
claude/hooks-own-files-only

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

The pre-commit hook registers only the commit's own tests: the ones it adds, and the ones its workflow changes name. Part of #21946.

Before, the hook ran the registry writer over every unregistered test in the repository. If the base had a straggler, whichever pull request committed a test next carried it too. Every PR then added the same registry entries, and they conflicted with each other. The click-through lane hit this on #21272 with tests/test_cmux_next_base_autofix_finishes.py and tests/test_nightly_next_feed_rollback.py. This PR registers those two once on the base.

Change

  • validate_test_execution_registry.py --write takes a repeatable --only PATH, and register_derivable(root, only=...) registers just those paths. With no --only, it registers everything, as before.
  • The hook collects the tests it passes from git diff --cached:
    • test files the commit adds;
    • tests/test_*.py paths on added lines in workflow files.

Tests (committed failing first)

  • tests/test_install_git_hooks.py, test_pre_commit_registers_only_the_commits_own_tests. A repository whose base has an unregistered test_base.py commits test_mine.py.
    • Red: the hook registered both.
    • Green: it registers only test_mine.py.
  • tests/test_ci_test_execution_registry.py, test_write_only_registers_the_named_tests.
    • Red: TypeError, since only didn't exist.
    • Green at the head.
  • All of test_install_git_hooks passes.
  • LaneRunnerTests.test_verify_local_jobs_option_keeps_recipe_tests_live fails both before and after this change in this sparse checkout.
  • The registry validator's "not run by any workflow" errors appear identically with the base registry, so they also predate this change.

The installed hook copies refresh when scripts/install-git-hooks.sh reruns, which post-merge does. A clone that still has the old validator copy ignores --only with an error, and the hook continues because registration is best effort.

Changelog

none

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Stops the pre-commit hook from writing the base's unregistered tests into every pull request. Part of #21946.

Before, the hook ran the registry writer over every unregistered test in the repository, so a stray test on the base got carried into whichever PR committed a test next, and identical registry entries conflicted across PRs. Now the hook registers only the tests the commit adds or that its workflow changes name. The base's two stragglers (tests/test_cmux_next_base_autofix_finishes.py, tests/test_nightly_next_feed_rollback.py) are registered once here.

Changes

  • validate_test_execution_registry.py --write accepts a repeatable --only PATH; without it, behavior is unchanged.
  • The hook collects candidates from git diff --cached: added tests/test_*.py files and test paths on added lines in workflow files.

Written for commit e571cad. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 2 commits October 19, 2026 08:03
Red: committing tests/test_mine.py also registers the base's unregistered
tests/test_base.py, so every pull request that commits a test carries the same
registry entries and they conflict (#21946); register_derivable has no way to
name the tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hook ran the registry writer over every unregistered test, so whichever
pull request committed a test next also carried the base's stragglers, and
those identical entries conflicted across pull requests. register_derivable
takes --only; the hook passes the tests the commit adds and the ones its
workflow changes name. The base's two stragglers are registered here once.

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

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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
  • Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1c6b82ac-d8b4-42f1-9b1d-73b8ba458a83

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.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-kud98 created for this PR by the cmux coordinator.

@blacksmith-sh

This comment has been minimized.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review e571cad: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr22056 -f ref=claude/hooks-own-files-only -f platform=macos -f backend_mode=local

Unclear: web / react-apps-check (2) failed: no known signature; failed step: Check webviews (Oxlint, Oxfmt, type check).

CI failed on e571cad5b0 (run 39341670320 attempt 1): 3 unknown.

Job Verdict Why
web / react-apps-check (2) unknown no known signature; failed step: Check webviews (Oxlint, Oxfmt, type check)
web / react-apps-check (1) unknown no known signature; failed step: Check webviews (Oxlint, Oxfmt, type check)
web / react-apps-check unknown no known signature; failed step: Check webview test shards

Not re-run automatically: web / react-apps-check (2), web / react-apps-check (1), web / react-apps-check are not machine failures.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

red: web / Web status; do not merge until green; see lane-rules
red: web / react-apps-check; do not merge until green; see lane-rules
red: web / react-apps-check (1); do not merge until green; see lane-rules
red: web / react-apps-check (2); do not merge until green; see lane-rules

CI fast guards failed on e571cad5b0 (https://github.com/manaflow-ai/cmux/actions/runs/39341670320). It does not block the merge; a red guard merged into main breaks it for every open PR.
The log named no failed step; see the run.

Agents: python3 scripts/ci/guard_attribution.py fix applies the mechanical fixes locally.

…s-own-files-only

# Conflicts:
#	tests/test-execution.toml
@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a non-blocking filename mismatch in workflow-only registration.

Findings

  1. P2 Some test names get skipped ▶

Summary

Limits automatic registration to tests added by the commit or named on added workflow lines.

  • Pre-commit registers only tests named by the commit.

The previous and current commits have different merge bases with the supplied target, so this review used the full PR diff. Tests were not run.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/fea..." · Reviewed by Greptile

Comment thread scripts/git-hooks/pre-commit Resolved
teamleaderleo and others added 3 commits October 19, 2026 21:46
Greptile on #22056: the hook test added the test file, so the path that
collects tests from added workflow lines went untested. Fails on the old
hook (it also registers the base's unregistered test).

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

cursor Bot commented Oct 19, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

done < <(
{
git diff --cached --name-only --diff-filter=A -- 'tests/test_*.py'
git diff --cached -U0 -- .github/workflows | grep -E '^\+' | grep -oE 'tests/test_[A-Za-z0-9_]+\.py' || true

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.

P2 Some test names get skipped

The workflow matcher excludes supported test names containing - or .. If a commit adds a workflow line for an existing unregistered tests/test_foo-bar.py, the hook finds no path and leaves it unregistered. The old hook registered these tests; contributors now need to do that manually.

Use the validator's [A-Za-z0-9_.-]+ filename pattern here too.

Suggested change
git diff --cached -U0 -- .github/workflows | grep -E '^\+' | grep -oE 'tests/test_[A-Za-z0-9_]+\.py' || true
git diff --cached -U0 -- .github/workflows | grep -E '^\+' | grep -oE 'tests/test_[A-Za-z0-9_.-]+\.py' || true

@github-actions

Copy link
Copy Markdown
Contributor

Shipped in:

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