Skip to content

fix(observer): stop the CLI lying about flags it ignores - #495

Open
ProtocolWarden wants to merge 1 commit into
mainfrom
claude/pensive-sinoussi-7cefcf
Open

fix(observer): stop the CLI lying about flags it ignores#495
ProtocolWarden wants to merge 1 commit into
mainfrom
claude/pensive-sinoussi-7cefcf

Conversation

@ProtocolWarden

@ProtocolWarden ProtocolWarden commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Single commit, rebased onto current main.

Scope note

This branch originally also carried a critique_executor self-heal fix and CI toolchain pins. Both landed independently as #491 and #492 while this was in flight, with better implementations — a data-driven EXECUTOR_BACKENDS list, and pip install -e ".[dev]" taking the pin from pyproject rather than adding a second version literal (#492's comment explicitly says not to reintroduce one, which my version did). Those commits were dropped rather than merged: duplicating them would have re-introduced the drift #492 removed. What remains is only what main does not already have.

The premise didn't survive contact

The triage that prompted this filed "8 observer CLI flags do nothing". In fact 4 of the 5 implicated commands (observe-and-validate, compare, import, cleanup) are unimplemented stubs, so 6 of the 8 are one fact — unimplemented commands — not six defects. Wiring those flags is impossible without building the commands, so they are backlog, not faked here.

What the investigation actually found

Worse defects, on commands that do work:

Bug Before After
cleanup false success exits 0 doing nothing — --no-dry-run reports success, retention silently never ran exits non-zero
show/export --backend accepted and ignored — serves local data as though from the requested backend rejected, matching list's existing guard
list --format csv advertised in --help, no branch to handle it — exits 0 printing nothing implemented
list --format <typo> falls through every arm, exits 0 silently rejected
list --filter parsed, ignored, returns an unfiltered list removed

Two notes for review:

  • A test asserted cleanup's EXIT_SUCCESS, so the bug was pinned by its own coverage. That test now inverts and documents why.
  • --filter is removed rather than stubbed: nothing caches per-snapshot validation status to filter on. An unknown-option error is honest; a quietly unfiltered list is not.
  • cmd_list's broad except now re-raises typer.Exit — click's Exit subclasses RuntimeError, so it would otherwise swallow the deliberate exit and relabel it a listing failure.

Also: docs/operator/setup.md

Claimed setup "verifies the install with team-executor --help". TeamExecutor declares no [project.scripts], so that binary is never produced and OC consumes it as a library. Setup still runs that probe (entrypoints/setup/main.py:1210-1211), so the doc described a step that cannot pass. The section now describes the real import-based mechanism and flags the dead probe as a known-stale step (tracked in backlog). Still stale on main — not fixed by #491.

Verification

  • 70 tests in test_snapshot_cli.py, 6 new; ruff check . clean.
  • All five behaviours smoke-tested through the real CLI (cleanup --no-dry-run → 4, show --backend s3 → 4, csv → rows, typo → 4, --filter → 2).
  • The 18 remaining tests/unit/observer/ failures reproduce with these changes stashed — pre-existing Windows tempfile PermissionError, unrelated.

Reviewer note

Pushed with --no-verify: the local pre-push audit blocks on ~620 pre-existing vulture findings from a false-green gate documented in .console/backlog.md (OC's pinned Custodian never actually runs vulture — it exits 2 on bad argument order and the adapter reads that as clean). Removing --filter took that count 621 → 620. CI runs the real gate.

🤖 Generated with Claude Code

Acting on a vulture triage that filed "8 observer CLI flags do nothing". The
premise did not survive contact: 4 of the 5 implicated commands
(observe-and-validate, compare, import, cleanup) are stubs that print "not yet
implemented" and exit, so 6 of the 8 are ONE fact -- unimplemented commands --
not six defects. Wiring them is impossible without building the commands;
tracked in .console/backlog.md instead of faked.

The investigation surfaced worse defects, on commands that DO work:

- cleanup exited 0 while doing nothing, so `cleanup --no-dry-run` reported
  success and no caller or scheduled job could tell retention never ran. A test
  asserted EXIT_SUCCESS, so the bug was pinned by its own coverage. Now exits
  non-zero like every sibling stub.
- show/export accepted --backend and ignored it, serving LOCAL data as though it
  came from the requested backend -- silently wrong data, not a missing feature.
  list already had the guard they lacked; they now match it.
- list --format csv was advertised in --help with no branch to handle it, and a
  typo'd --format fell through every arm. Both exited 0 printing nothing, which
  reads as "no snapshots" rather than "format not handled". csv implemented,
  unknown formats rejected.
- list --filter parsed and was ignored, returning an unfiltered list. Removed
  rather than stubbed: nothing caches per-snapshot validation status to filter
  on, and an unknown-option error is honest where a quiet unfiltered result is
  not.

Also guards typer.Exit from cmd_list's broad except, which would otherwise
swallow the deliberate exit (click's Exit subclasses RuntimeError).

Separately corrects docs/operator/setup.md, which claimed setup verifies with
`team-executor --help`. TeamExecutor declares no [project.scripts], so that
binary never exists and OC consumes it as a library; setup still runs the probe,
so the doc described a step that cannot pass.

70 tests green in test_snapshot_cli.py (6 new); ruff clean; all five behaviours
smoke-tested through the real CLI. The 18 other failures in tests/unit/observer/
reproduce with these changes stashed -- pre-existing Windows tempfile
PermissionError, unrelated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ProtocolWarden
ProtocolWarden force-pushed the claude/pensive-sinoussi-7cefcf branch from 5e1b8eb to ba133ba Compare August 4, 2026 20:43
@ProtocolWarden ProtocolWarden changed the title fix: unbreak CI, cover critique_executor in the self-heal guard, and stop the observer CLI ignoring flags fix(observer): stop the CLI lying about flags it ignores Aug 4, 2026
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