Skip to content

fix: case registry locking, watchdog proof verification, viewer matching, export paths - #123

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-issues-0333
Draft

fix: case registry locking, watchdog proof verification, viewer matching, export paths#123
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-issues-0333

Conversation

@cursor

@cursor cursor Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Daily critical-correctness scan found four high-severity bugs still present on main (previously fixed on automation branches but never merged).

Bugs fixed

1. litigation/run.py — duplicate Case Nos / registry corruption

  • Impact: When courtroom/case-registry.yaml is missing, every save_transcript() call returns YYYY-DEL-001-001 without persisting a registry. Concurrent saves can also corrupt the registry via unlocked read-modify-write.
  • Fix: Create registry on first use, exclusive file locking (fcntl), year rollover reset, and atomic write with truncate/fsync.

2. executive/watchdog.py — override approval bypass

  • Impact: Actions with action_type containing "override" skip approval checks entirely. Any non-empty override_proof field suppresses alerts without HMAC verification.
  • Fix: Require OverrideProof.verify() for override actions; alert on missing/invalid proof.

3. courtroom/portal/export_transcript.py — double-prefix path resolution

  • Impact: Passing courtroom/transcripts/foo.md resolves to courtroom/courtroom/transcripts/foo.md (404).
  • Fix: Added resolve_transcript_path() to normalize paths relative to courtroom/.

4. litigation/viewer.py — substring transcript matching

  • Impact: Query test matches contest.md, serving the wrong transcript.
  • Fix: Exact/prefix/suffix matching via _matches_transcript_query().

Validation

  • 69 tests passing (python3 -m pytest tests/)
  • New regression tests for all four fixes
Open in Web View Automation 

…ing, export paths

- allocate_case_no: create registry when missing, exclusive fcntl lock, fsync,
  and year rollover reset to prevent duplicate Case Nos under concurrent saves
- watchdog: require OverrideProof.verify() for override actions instead of
  skipping checks when action_type contains override or proof is non-empty
- litigation viewer: resolve transcripts by exact/prefix/suffix rules, not
  arbitrary substring match (bar must not match foo-bar)
- export_transcript: resolve_transcript_path strips courtroom/ prefix so
  repo-root paths do not double-prefix to courtroom/courtroom/transcripts

Co-authored-by: Jack J Burleson // LJM <Exios66@users.noreply.github.com>
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