Skip to content

fix(port): fail an exemption fragment that names more or fewer than one rule - #30

Merged
AlexNegrescu26 merged 4 commits into
mainfrom
fix/exemption-fragments-one-rule
Oct 25, 2026
Merged

AlexNegrescu26 merged 4 commits into
mainfrom
fix/exemption-fragments-one-rule

Conversation

@AlexNegrescu26

Copy link
Copy Markdown
Collaborator

Why

The rule staleness gate exempts a stale rule by a text fragment. Seven fragments each matched more than one rule, so an exemption written for one stale rule could silently keep a different one from failing the gate. This already happened once, with a swarm rule that went stale behind a run_in_background: true fragment.

What changed

  • stale exemptions now fails a fragment that names more or fewer than one rule in rules.sed. The message names the row and the lines.
  • Each ambiguous fragment is pinned to the one rule it was written for. Where two rules were stale only by accident, one is fixed to match what upstream writes and the duplicates and their exemption rows are deleted.
  • A new mutation proves the check can fail.

Scope

  • The generated skills do not change.
  • Other stale rules match only text the port writes itself. Each has its own single-rule exemption, so the gate passes. Fixing those is separate.

Blast Radius

It affects only the gate and the rule table. A future edit that makes a fragment ambiguous now fails the gate instead of hiding a stale rule.

Verification

  • bash omp-port/check-port.sh prints check-port: PASS, with stale exemptions at 74 fragments each naming exactly one rule and reproducible unchanged at e73df47.
  • bash omp-port/test-gate-mutations.sh passes with 17 mutations, each rejected by its own check. A loosened copy of the check made the new mutation report that it unexpectedly passed.

rules.sed carried the same `run_in_background: true` token rule twice. The
first copy consumes every match, so the second could never fire, and no
exemption fragment can tell two identical lines apart. Tree unchanged.
…rites

Both `interrogate reviewers` line rules matched `task.agentModelOverrides`
in `~/.omp/agent/config.yml`, text only the path net further down writes,
so neither could fire and one exemption fragment covered both. The surviving
rule now matches the `~/.cursor/rules/pstack-models.mdc` path upstream
writes, like the runner and judge rules beside it, and is no longer stale.
The other copy goes, with the rule that only rewrote its output and both
exemptions. Tree unchanged: the per-entry sentence rule consumes the one
upstream occurrence first.
Five fragments matched a second rule, either that rule's replacement text or
a whole-sentence rule containing the same token. Each now starts with the `s#`
opener of the rule it was written for. Two rows were byte-identical copies of
another row and go.
…ne rule

A stale-rule exemption is a substring of a rules.sed line, so one fragment
could match several rules and keep every one of them from failing
`rule staleness`. That already hid a swarm Phase B rule once.

One resolver now maps each fragment to the rules it matches. `stale
exemptions` fails a fragment that matches several rules or none, naming the
tsv row and the rules.sed lines, and only a fragment naming exactly one rule
exempts anything. The lint runs before the contracts-only exit, so the
mutation harness covers it: copying the rule an exemption names must fail it.
@AlexNegrescu26
AlexNegrescu26 merged commit aec3e5a into main Oct 25, 2026
2 checks passed
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