Skip to content

fix(deploy-tab-diff): capture-time coverage gate with --allow-uncovered override - #581

Merged
danshapiro merged 7 commits into
mainfrom
fix/capture-coverage-gate
Jul 30, 2026
Merged

fix(deploy-tab-diff): capture-time coverage gate with --allow-uncovered override#581
danshapiro merged 7 commits into
mainfrom
fix/capture-coverage-gate

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

Summary

Coverage gate for the deploy-tab-diff safety script. Fixes production issue where scripts/deploy-tab-diff.sh capture exited 0 even when running terminals were covered by no persisted snapshot pane — the coverage guard only ran in verify, AFTER the restart, when the uncovered PTYs were already dead.

Changes

  1. capture-time coverage gate: capture now runs the same coverage guard on the state it just fetched and exits with distinct code 4 when uncovered terminals exist, printing an enriched failure report that distinguishes recoverable terminals (have session refs — claude/codex/etc., recoverable via the session ledger) vs unrecoverable (plain shells).

  2. Artifact always written first: The capture artifact is written to disk before the guard runs, enabling diagnosis even when the guard fails.

  3. --allow-uncovered override: New flag provides informed-consent override (warns on stderr, exits 0). Users can proceed with restart if they understand the risk.

  4. Shared coverage function: The coverage jq is extracted into a shared uncovered_terminals() function used by both capture and verify paths (no copy-paste divergence).

  5. Documentation updated: Header docs and usage message updated to explain exit 4, coverage gate semantics, and --allow-uncovered.

  6. verify guard unchanged: Defense in depth — verify's guard remains active as a final safety net.

Testing

  • Byte-exact pinning tests on verify guard behavior (no regression)
  • 6 new tests covering: full-coverage exit 0, uncovered exit 4 + artifact written + terminal listing, --allow-uncovered warn+exit 0, and unchanged verify behavior
  • All tests pass with ~19s execution (server config)

Files

  • scripts/deploy-tab-diff.sh: Core gate logic, --allow-uncovered flag, shared function
  • test/unit/server/deploy-tab-diff-coverage-gate.test.ts: Comprehensive test coverage
  • docs/plans/2026-07-29-capture-coverage-gate.md: Implementation plan
  • scripts/deploy-tab-diff.sh header: Updated usage docs

Note

A pre-existing failure in terminal-font-settings.test.tsx on main was discovered during testing, not introduced by this change. Also noted: CI does not run the server test suite.

…ation

Validated 17 load-bearing assumptions (15 verified, 2 falsified) against
the script, callers, server source, and tooling. Fixes:

- A5(a) falsified: uncovered session-bearing terminals (sessionRef) keep
  a manually recoverable session post-restart; only the pane/PTY dies.
  Messaging now truthful; enriched report gains a session=<provider|none>
  recoverability split (field verified in /api/terminals serializers).
- A13(d) falsified: no tsconfig covers test/**, so Task 1's typecheck
  step was a no-op; replaced with an honest note (vitest esbuild is the
  only type gate for tests).
- Noted the server config globalSetup build cost on first single-file run.

Ledger: .worktrees/.the-usual-logs/capture-coverage-gate/load-bearing-ledger.md
@danshapiro
danshapiro merged commit ca1a60d into main Jul 30, 2026
3 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