Skip to content

fix: critical correctness — case registry locking, watchdog proof verification, viewer/export paths - #113

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

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

Conversation

@cursor

@cursor cursor Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Daily critical-correctness scan found four high-severity bugs still present on main after recent portal path fixes (#54, #66, #84). This PR applies minimal, targeted fixes with regression tests.

Bugs fixed

1. Duplicate Case Nos / registry corruption (litigation/run.py)

  • Impact: Concurrent transcript saves could assign duplicate Case Nos; missing registry returned fixed DEL-001 without persisting.
  • Fix: Create registry on first use, exclusive fcntl lock, fsync, year rollover reset.

2. Watchdog override bypass (executive/watchdog.py)

  • Impact: Override actions skipped approval checks when action_type contained "override" or any non-empty override_proof was present without HMAC verification.
  • Fix: Require OverrideProof.verify() for all override actions.

3. Wrong transcript served (litigation/viewer.py)

  • Impact: Substring matching (name in stem) could serve foo-bar when user requested bar.
  • Fix: Exact/prefix/suffix resolution only.

4. Export path double-prefix (courtroom/portal/export_transcript.py)

  • Impact: Repo-root paths like courtroom/transcripts/foo.md resolved to nonexistent courtroom/courtroom/transcripts/.
  • Fix: resolve_transcript_path() strips courtroom/ prefix before joining.

Validation

  • 69 tests passing (python3 -m pytest tests/ -q)
  • Added 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