Skip to content

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

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

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

Conversation

@cursor

@cursor cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Cherry-picks critical correctness fixes onto main that were previously identified but not merged.

Bugs fixed

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

  • Impact: Concurrent transcript saves could assign duplicate Case Nos; missing registry returned fixed YYYY-DEL-001-001 without persisting, causing repeated collisions.
  • Fix: Exclusive file lock (fcntl), create registry on miss, year rollover reset, atomic read-modify-write with fsync.

2. executive/watchdog.py — override approval bypass

  • Impact: Actions with action_type containing "override" skipped judicial approval checks entirely; any non-empty override_proof was accepted without HMAC verification.
  • Fix: Require OverrideProof.verify() for all override actions; alert on missing/invalid proof.

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

  • Impact: Passing courtroom/transcripts/foo.md resolved to nonexistent courtroom/courtroom/transcripts/foo.md, causing export 404s from launch.sh.
  • Fix: Added resolve_transcript_path() to normalize relative paths.

4. litigation/viewer.py — substring transcript matching

  • Impact: Query 2026-01-01 could match 2026-01-01-sample and 2026-01-01-border-dispute ambiguously, serving wrong transcript.
  • Fix: Exact/prefix/suffix matching via _matches_transcript_query() and _resolve_transcript().

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