Skip to content

fix(ci): make three guards actually verify, and schedule the failure-class retirement - #10534

Merged
Git-on-my-level merged 7 commits into
mainfrom
fix/guards-that-verify-nothing
Jul 25, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
fix/guards-that-verify-nothing

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

Why

Three of this repository's guards were not doing what their green status implied,
each in a different way. All three are cheap to close and none of them needed a
new mechanism.

1. A check that executes nothing. backend-production-release-vector-guard-tests
runs python3 .github/scripts/test_check_release_rings.py. That module was
pytest-style with no __main__, so the command exited 0 having executed none of
its six cases. Registered by #10237, green ever since, never once verifying the
one-action production backend release contract it names.

2. Seven guard self-tests with no manifest entry. They ran only as bespoke
run: steps in repo-checks.yml — the shape root AGENTS.md calls "a manifest
bug" — so they never ran locally, never ran diff-scoped, and were invisible to
pr-preflight --list.

3. A lifecycle that shipped complete and never ran. scripts/failure-class report
computes closure eligibility against a quiet period and requires maintainer
confirmation, but it is non-mutating and has no event source: without
--events-file it returns zero events and a no_event_source warning. Nothing
ever supplied that feed, so 26 classes sit at status: open with zero
retirements since the registry was created on 2026-07-16.

What changed

Commit Change
fix(ci) test_check_release_rings.py converted to the stdlib unittest pattern used by the other 24 manifest test commands. Six cases preserved verbatim, no new dependency.
fix(ci) test_manifest_test_modules_execute_their_cases in the manifest contract tests: a test_*.py module handed straight to the interpreter must be self-running. Static ast parse.
feat(ci) repo-hygiene.yml (Mon 09:00 UTC) + failure_class_retirement.py: build the merged-PR feed, run the advisory report, apply the two-field retirement edit, open one PR on a reused branch.
fix(ci) Corrected the self-running rule, which false-positived on script-style tests.
fix(ci) Registered the seven orphaned self-tests; deleted the seven workflow steps (net −21 lines of workflow YAML).
chore Registered FC-nonexecuting-verification-command.

What the cron deliberately does not do

  • Gate anything. No manifest lane, no pre-push, no release coupling.
  • Open an issue for a retirement. A PR has a review queue and its own CI; an
    advisory issue joins a 400-issue backlog. Recurrence of an already-dormant
    class is different — that is judgment work (AGENTS.md asks for a reusable
    guard surface, not a field flip), so it exits 1 and skips the PR.
  • Author the PR with GITHUB_TOKEN. That PR would arrive with zero checks
    run, defeating the reason to prefer a PR. The Omi Bot app token is minted so
    the diff is verified like any human PR. It never auto-merges and never uses
    --admin.

The feed guard is the load-bearing part. A truncated feed makes every class
report "no classified instance", so the job would run green forever while
retiring nothing — the same defect as a check that executes no tests. The run
refuses a feed that hit the fetch limit, or an empty one.

Verification

python3 .github/scripts/test_check_release_rings.py       -> Ran 6 tests, OK
   (before: no output, exit 0, 0 tests executed)
python3 .github/scripts/test_run_checks.py               -> Ran 24 tests, OK
python3 .github/scripts/test_failure_class_retirement.py -> Ran 15 tests, OK
scripts/pr-preflight --lane local                        -> 21 selected, all PASS

Mutation evidence (a guard that cannot fail is not a guard):

  • Stubbing check_release_rings.check() to return [] makes the suite report
    FAILED (failures=4); before this change it still exited 0.
  • Restoring the pre-fix pytest-only module makes the new contract test FAIL,
    naming the offender: backend-production-release-vector-guard-tests: ... has no __main__ block invoking a test runner.

Cron, against live data:

  • Dry run (real gh, 14d): 748 events spanning 2026-07-11 → 2026-07-25, 292
    carrying a Failure-Class: line, 0 eligible, exit 0, no files modified.
  • Time-travel apply (--now 2026-08-20, real registry copied to a temp root):
    13 of 26 classes retired, 13 left open, and the diff per class is exactly
    -  "status": "open"
    +  "status": "dormant",
    +  "dormant_since": "2026-08-20T00:00:00Z"
    
    39 changed lines across 13 files, no formatting churn. (An earlier
    json.dumps round trip reflowed the hand-maintained inline arrays; caught by
    test_apply_touches_only_the_status_line.)

Expect zero retirements for roughly the next week: the registry is 9 days old
against a 14-day quiet period. That is correct behavior, and it is why the feed
assertion matters — it distinguishes "nothing to retire" from "the feed could not
tell".

Not in this PR

test_check_release_process_guards.py is in no lane and has 9 real failures on
main (#10351). Root cause, which #10351 does not record: the suite loads a
historical revision of the guard (4e391ee7) out of git and runs it against
synthetic or current workflow input. That parent hardcodes "exactly 21
approved script steps"; omi-desktop-swift-release has had 22 since INV-BETA-1
added "Create Omi Beta variant". Every one of the 9 failures is that single
mismatch. It will break again on the next approved step.

Fixing it means deciding what those assertions should mean — pair each historical
guard with its contemporaneous workflow, or narrow the assertions to the bypass
class under test. That is a release-guard semantics call, and getting it wrong
manufactures a false green, which is the defect this PR exists to remove. It
needs its own PR and a reviewer who owns that guard.

Failure-Class: new

🤖 Generated with Claude Code

Review in cubic

Git-on-my-level and others added 7 commits July 25, 2026 00:44
`backend-production-release-vector-guard-tests` runs
`python3 .github/scripts/test_check_release_rings.py`. The module was
pytest-only (bare `def test_*` with `tmp_path`/`monkeypatch` fixtures and no
`__main__`), so that command exited 0 having executed none of its six cases.
The check had been green since it was registered without ever testing the
one-action production backend release contract it claims to guard.

Converted to the stdlib `unittest` pattern used by the other 24 manifest test
commands, preserving all six cases verbatim. No new dependency.

Verification:
  python3 .github/scripts/test_check_release_rings.py  -> Ran 6 tests, OK
    (before: no output, exit 0, 0 tests executed)
  python3 -m pytest .github/scripts/test_check_release_rings.py -q -> 6 passed
  mutation: with check() stubbed to return [], the suite reports
    FAILED (failures=4); before this change it still exited 0.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The release-vector guard was green for its whole life because
`python3 <module>` on a pytest-only file exits 0 without collecting anything.
Fixing that one module leaves the class open: any future manifest entry can
reintroduce it, and the symptom is a passing check.

Adds `test_manifest_test_modules_execute_their_cases` to the manifest contract
tests. For every manifest command that hands a `test_*.py` module straight to
the interpreter (commands naming an explicit `-m pytest`/`-m unittest` runner
delegate discovery and are exempt), it requires a `unittest.TestCase` subclass
and a `__main__` block invoking a runner. Static ast parse, no execution, no
new dependency.

Verification:
  python3 .github/scripts/test_run_checks.py -> Ran 24 tests, OK
  mutation: restoring the pre-fix pytest-only test_check_release_rings.py makes
    it FAIL, naming the offending check id:
    "backend-production-release-vector-guard-tests: ... defines no
     unittest.TestCase subclass, so unittest.main() would collect nothing"
  test_pytest_only_module_is_reported_as_non_self_running covers all three
    shapes (pytest-only, missing __main__, correct) as unit cases.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… defines

`scripts/failure-class report` computes closure eligibility with a quiet period
and requires maintainer confirmation, but it is non-mutating and has no event
source: without `--events-file` it returns zero events and a `no_event_source`
warning. Nothing scheduled ever supplied that feed, so 26 classes sit at
`status: open` with zero retirements since the registry was created.

Adds a weekly Repo Hygiene workflow (Mon 09:00 UTC, clear of the release
cadence) that builds the merged-PR feed, runs the report, applies the two-field
retirement edit, and opens one PR on a reused branch. It never merges and never
decides; the reviewable diff is the output, and merging is the confirmation.

Three things this deliberately does NOT do:
- gate anything: no manifest lane, no pre-push, no release coupling
- open an issue for a retirement: a PR has a review queue and its own CI, an
  advisory issue joins a 400-issue backlog
- author the PR with GITHUB_TOKEN, which would arrive with zero checks run;
  the Omi Bot app token is minted so the diff is verified like any human PR

Recurrence of an already-dormant class exits 1 and skips the PR. That is
judgment work (AGENTS.md requires a reusable guard surface, not a field flip),
and a red weekly run is the notification without new machinery.

The feed guard is the load-bearing part. A truncated feed makes every class
report "no classified instance", so the job would run green forever while
retiring nothing -- the same false-green defect as a check that executes no
tests. The run refuses a feed that hit the fetch limit, or an empty one.

Verification:
  python3 .github/scripts/test_failure_class_retirement.py -> Ran 15 tests, OK
  python3 .github/scripts/test_run_checks.py -> Ran 24 tests, OK (manifest valid)
  live dry run (real gh, 14d): 748 events spanning 2026-07-11 -> 2026-07-25,
    292 carrying a Failure-Class line, 0 eligible, exit 0, no files modified
  time-travel apply (--now 2026-08-20, real registry copied to a temp root):
    13 of 26 classes retired, 13 left open, diff is exactly
    -  "status": "open"
    +  "status": "dormant",
    +  "dormant_since": "2026-08-20T00:00:00Z"
    per class (39 changed lines across 13 files, no formatting churn)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ests

The contract added in 1052af7 required a `unittest.TestCase` subclass, which
false-positives on the repository's other legitimate test shape: a module whose
`__main__` calls its own `main()` of assertions.
`test_check_desktop_auto_beta_candidate.py` is exactly that shape and does
execute its assertions when invoked as a script; flagging it would have blocked
wiring a working test into the manifest.

The rule now matches the two shapes that actually execute nothing:
  * no `__main__` block invoking anything (a pytest-only module), and
  * `__main__` calling `unittest.main()` in a module with no TestCase, where
    discovery collects nothing.
Script-style modules pass.

Verification:
  python3 .github/scripts/test_run_checks.py -> Ran 24 tests, OK
  unit cases cover all four shapes (pytest-only, missing __main__,
    unittest.main() without a TestCase, script-style)
  reclassifying the nine self-tests outside the manifest now reports 7
    self-running and 2 genuinely non-runnable
    (test_check_release_process_guards.py, test_desktop_release_manifest_schema.py)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…n a workflow

Root AGENTS.md: "A deterministic diff-scoped check failing for the first time in
CI is a manifest bug: fix the manifest instead of adding a one-off workflow
step." Seven guard self-tests were bespoke `run:` steps in repo-checks.yml with
no manifest entry at all, so they never ran locally, never ran diff-scoped, and
were invisible to `pr-preflight --list`.

Registered each beside the checker it covers with triggers on that checker, its
own source, and the data it reads; deleted the seven workflow steps. Net -21
lines of workflow YAML.

Verification:
  python3 .github/scripts/test_run_checks.py -> Ran 24 tests, OK (manifest valid,
    no remaining unregistered workflow check)
  each of the seven runs green as the manifest invokes it (exit 0)
  selection proven via resolve_checks:
    check_brand_ui.py            -> brand-ui-ratchet-tests
    check_lifecycle_headers.py   -> lifecycle-header-checker-tests
    docs/product/invariants/**   -> product-invariant-checker-tests
  grep for the seven test names in repo-checks.yml -> 0 matches

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… class

The release-vector guard's self-test was registered by #10237 and never executed
a case, so the check reported success from the moment it landed. The defect is
not specific to that module: any registered command whose invocation form cannot
reach its assertions is green forever, and green is exactly what a working guard
looks like.

Canonical prevention is the contract added in this PR — assert the invocation at
the point of registration instead of trusting the exit code — which is why the
class is registered with the fix that instantiates it.

Evidence: #10237 (registered the command; its six cases never ran).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`resolve_pr_metadata` short-circuits on OMI_PR_BODY_FILE before reaching the
GitHub API path, so the two cases asserting API failure behavior never exercised
it when that variable was set in the environment. `scripts/pre-push` explicitly
tells developers to export it ("or: OMI_PR_BODY_FILE=/tmp/pr-body.md git push"),
so following the repository's own instructions made the suite fail for a reason
unrelated to the behavior under test.

Surfaced by registering this suite into the manifest in the previous commit: it
passed standalone and failed inside the pre-push preflight run.

Verification, all three from a clean tree:
  python3 .github/scripts/test_pr_preflight.py                        -> 21 OK
  OMI_PR_BODY_FILE=<real file>   python3 ... test_pr_preflight.py      -> 21 OK
    (before this change: FAILED (failures=2))
  OMI_PR_BODY_FILE=/nope/missing.md python3 ... test_pr_preflight.py   -> 21 OK

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3cd353488

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


def fetch_events(cutoff: datetime, runner=subprocess.run) -> dict[str, Any]:
"""Fetch merged-PR bodies for the quiet period via gh."""
search = f"merged:>={cutoff.date().isoformat()}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fetch the last instance before the quiet-period cutoff

The scheduled query only returns PRs merged on or after the cutoff date, but report_command considers an open class eligible only when it sees a classified instance whose timestamp is at or before the cutoff. Except for PRs merged between midnight and the cutoff time on that exact date, an instance disappears from the feed as soon as it becomes old enough, becomes instance is None, and can never be retired. The end-to-end test masks this by manually supplying an event from before its query window; the production feed needs enough history to retain each class's latest pre-cutoff instance.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit acc591f into main Jul 25, 2026
30 of 33 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/guards-that-verify-nothing branch July 25, 2026 05:14
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
…class retirement (BasedHardware#10534)

## Why

Three of this repository's guards were not doing what their green status
implied,
each in a different way. All three are cheap to close and none of them
needed a
new mechanism.

**1. A check that executes nothing.**
`backend-production-release-vector-guard-tests`
runs `python3 .github/scripts/test_check_release_rings.py`. That module
was
pytest-style with no `__main__`, so the command exited 0 having executed
none of
its six cases. Registered by BasedHardware#10237, green ever since, never once
verifying the
one-action production backend release contract it names.

**2. Seven guard self-tests with no manifest entry.** They ran only as
bespoke
`run:` steps in `repo-checks.yml` — the shape root `AGENTS.md` calls "a
manifest
bug" — so they never ran locally, never ran diff-scoped, and were
invisible to
`pr-preflight --list`.

**3. A lifecycle that shipped complete and never ran.**
`scripts/failure-class report`
computes closure eligibility against a quiet period and requires
maintainer
confirmation, but it is non-mutating and has no event source: without
`--events-file` it returns zero events and a `no_event_source` warning.
Nothing
ever supplied that feed, so 26 classes sit at `status: open` with zero
retirements since the registry was created on 2026-07-16.

## What changed

| Commit | Change |
|---|---|
| `fix(ci)` | `test_check_release_rings.py` converted to the stdlib
`unittest` pattern used by the other 24 manifest test commands. Six
cases preserved verbatim, no new dependency. |
| `fix(ci)` | `test_manifest_test_modules_execute_their_cases` in the
manifest contract tests: a `test_*.py` module handed straight to the
interpreter must be self-running. Static `ast` parse. |
| `feat(ci)` | `repo-hygiene.yml` (Mon 09:00 UTC) +
`failure_class_retirement.py`: build the merged-PR feed, run the
advisory report, apply the two-field retirement edit, open one PR on a
reused branch. |
| `fix(ci)` | Corrected the self-running rule, which false-positived on
script-style tests. |
| `fix(ci)` | Registered the seven orphaned self-tests; deleted the
seven workflow steps (net −21 lines of workflow YAML). |
| `chore` | Registered `FC-nonexecuting-verification-command`. |

## What the cron deliberately does not do

- **Gate anything.** No manifest lane, no pre-push, no release coupling.
- **Open an issue for a retirement.** A PR has a review queue and its
own CI; an
advisory issue joins a 400-issue backlog. Recurrence of an
already-dormant
class is different — that is judgment work (`AGENTS.md` asks for a
reusable
  guard surface, not a field flip), so it exits 1 and skips the PR.
- **Author the PR with `GITHUB_TOKEN`.** That PR would arrive with zero
checks
run, defeating the reason to prefer a PR. The Omi Bot app token is
minted so
the diff is verified like any human PR. It never auto-merges and never
uses
  `--admin`.

The feed guard is the load-bearing part. A truncated feed makes every
class
report "no classified instance", so the job would run green forever
while
retiring nothing — the same defect as a check that executes no tests.
The run
refuses a feed that hit the fetch limit, or an empty one.

## Verification

```
python3 .github/scripts/test_check_release_rings.py       -> Ran 6 tests, OK
   (before: no output, exit 0, 0 tests executed)
python3 .github/scripts/test_run_checks.py               -> Ran 24 tests, OK
python3 .github/scripts/test_failure_class_retirement.py -> Ran 15 tests, OK
scripts/pr-preflight --lane local                        -> 21 selected, all PASS
```

Mutation evidence (a guard that cannot fail is not a guard):

- Stubbing `check_release_rings.check()` to return `[]` makes the suite
report
  `FAILED (failures=4)`; before this change it still exited 0.
- Restoring the pre-fix pytest-only module makes the new contract test
FAIL,
naming the offender: `backend-production-release-vector-guard-tests: ...
has no
  __main__ block invoking a test runner`.

Cron, against live data:

- Dry run (real `gh`, 14d): 748 events spanning 2026-07-11 → 2026-07-25,
292
carrying a `Failure-Class:` line, 0 eligible, exit 0, no files modified.
- Time-travel apply (`--now 2026-08-20`, real registry copied to a temp
root):
13 of 26 classes retired, 13 left open, and the diff per class is
exactly
  ```
  -  "status": "open"
  +  "status": "dormant",
  +  "dormant_since": "2026-08-20T00:00:00Z"
  ```
  39 changed lines across 13 files, no formatting churn. (An earlier
`json.dumps` round trip reflowed the hand-maintained inline arrays;
caught by
  `test_apply_touches_only_the_status_line`.)

Expect zero retirements for roughly the next week: the registry is 9
days old
against a 14-day quiet period. That is correct behavior, and it is why
the feed
assertion matters — it distinguishes "nothing to retire" from "the feed
could not
tell".

## Not in this PR

`test_check_release_process_guards.py` is in no lane and has 9 real
failures on
`main` (BasedHardware#10351). Root cause, which BasedHardware#10351 does not record: the suite
loads a
**historical** revision of the guard (`5de82050`) out of git and runs it
against
**synthetic or current** workflow input. That parent hardcodes "exactly
21
approved script steps"; `omi-desktop-swift-release` has had 22 since
INV-BETA-1
added "Create Omi Beta variant". Every one of the 9 failures is that
single
mismatch. It will break again on the next approved step.

Fixing it means deciding what those assertions should mean — pair each
historical
guard with its contemporaneous workflow, or narrow the assertions to the
bypass
class under test. That is a release-guard semantics call, and getting it
wrong
manufactures a false green, which is the defect this PR exists to
remove. It
needs its own PR and a reviewer who owns that guard.

Failure-Class: new

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


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10534?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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