Skip to content

ci: a scope_hint that matches zero paths is an error, not a pass - #14466

Merged
Git-on-my-level merged 2 commits into
mainfrom
task/msd-ci-scope-hints-fail-closed
Sep 18, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
task/msd-ci-scope-hints-fail-closed

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

What changed and why

scripts/failure-class prepare matches a class definition's scope_hints with fnmatch, so a
hint written the way a person naturally writes one — with a trailing slash, or without ** —
matches zero paths. It then passed. A hint that matches nothing is not a narrow gate, it is
no gate, and it looks identical to a gate that is working. Failing open is the worst behaviour a
check can have, because nothing in the output tells you it stopped protecting anything.

A newly added scope_hint on a changed definition that matches zero paths under git ls-files
is now scope_hint_matches_nothing, in both prepare and validate.

Scoped deliberately, so this does not become a tree-wide lint. A fix that reddened every
open PR on day one would have been reverted rather than absorbed, and the existing definitions
are not this PR's change set.

Correction to an earlier draft of this body, found by the App core lane's adversarial review.
I originally wrote that existing dead hints "fail when their own JSON is next edited." That is
wrong, and the reviewer proved it rather than arguing it: the check compares current - previous,
so editing a definition while keeping a pre-existing dead hint fires nothing; only a newly
added hint that matches zero paths is caught. The reviewer scanned the live registry — 9 of
260 classes, out of 606 hints total, carry a hint that matches nothing today
— and those nine
stay fail-open through artifact-only instance-fix edits.

That is a deliberate limit of this PR, not a claim that the tree is clean. Sweeping those nine
is a separate change with its own blast radius, and it should be measured before it is written.

Product invariants affected

none

How it was verified

test_scope_hint_matching_zero_paths_is_error asserts exit 1, not merely a warning — the
test would fail if the check went back to passing. The full scripts/test_failure_class.py
suite passed, including the existing cases that pin prepare and validate behaviour on hints
that do match.

Failure class (fixes)

Failure-Class: none

The defect class here is "a matcher that finds nothing reports success", which is worth
registering; it is not registered in this PR because the protocol allows exactly one added
definition per PR and the companion change-set fix is in flight alongside this one. Flagged for
a follow-up rather than silently dropped.

🤖 Generated with Claude Code

A hint that matches nothing is skipped during candidate narrowing, so the
class disappears and the author invents a new one. Fail closed when a
changed definition adds a hint that hits zero tracked files.

Co-authored-by: Cursor <[email protected]>
…merged

#14465 rewrote the change-set helpers in scripts/failure-class to diff three-dot
against the live base, which collides with this branch's additions to the same
file. Resolved by taking main's file wholesale and re-applying this branch's
three additions onto it, rather than hand-editing conflict markers:

- tracked_paths() and dead_scope_hint_errors(), inserted before
  added_definition_paths() where they sat relative to the merge base.
- The prepare call site, at the same indent as the try/except it follows.
- The validate call site, as the first statement of the else: block.

The second call site is the reason this needed care. Placing it inside the
except: block instead of the else: left it running only when the diff raised,
and scripts/test_failure_class.py caught that: 27 of 28 passed and the one
failure was test_scope_hint_matching_zero_paths_is_error, the exact test this
branch exists to add. Corrected placement, then the full suite: 28 of 28 OK.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 80d1faa into main Sep 18, 2026
37 checks passed
@Git-on-my-level
Git-on-my-level deleted the task/msd-ci-scope-hints-fail-closed branch September 18, 2026 04:01
summersmile1984 added a commit to summersmile1984/omi that referenced this pull request Sep 26, 2026
…definition

Upstream BasedHardware#18722 (43c27b7) deleted
backend/utils/task_intelligence/rollout.py but left its scope_hint in
.github/failure-classes/FC-gate-principal-outside-consolidated-entitlement.json;
scripts/failure-class treats a hint matching zero tracked paths as an
error, so failure-class-protocol fails for any range spanning that
deletion — ours does. Retarget the hint to the surviving
task_intelligence directory (upstream repairs dead hints the same way:
BasedHardware#14493, BasedHardware#14466, BasedHardware#14495).

Registered as T1 (max_added_lines 1) with upstream-prs queue row #18.

Evidence: scripts/failure-class validate --base origin/main --head HEAD
--pr-body-file /tmp/pr-body.md passes the declaration and this error;
re-run after commit.

Failure-Class: none
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