Skip to content

fix: duplicate Case Nos when registry missing and export path double-prefix - #102

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

fix: duplicate Case Nos when registry missing and export path double-prefix#102
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-issues-a4e7

Conversation

@cursor

@cursor cursor Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Critical correctness fixes found during nightly bug audit of recent commits.

Bug 1: Duplicate Case Numbers when registry is missing (High)

Impact: Every litigation/run.py save assigned YYYY-DEL-001-001 when courtroom/case-registry.yaml was absent, with no registry created. Multiple deliberations received identical Case Nos — a data-integrity failure matching the legacy 2026-DEL-001 collision problem.

Root cause: allocate_case_no() early-returned without persisting state when the registry file did not exist (introduced in #66).

Fix: Initialize case-registry.yaml on first allocation with categories[DEL]=2 after assigning 001.

Bug 2: export_transcript path double-prefix (Medium)

Impact: Documented README usage (python3 courtroom/portal/export_transcript.py courtroom/transcripts/foo.md) resolved to courtroom/courtroom/transcripts/foo.md and failed with "File not found". launch.sh was unaffected (uses absolute paths).

Root cause: BASE_DIR is already courtroom/; joining with a courtroom/transcripts/ prefix doubled the segment.

Fix: Added resolve_transcript_path() to strip a leading courtroom/ prefix before joining.

Validation

  • Added test_allocate_case_no_creates_registry_when_missing
  • Added test_resolve_transcript_path_accepts_repo_root_prefix and _courtroom_relative_prefix
  • Full suite: 63 tests passing
Open in Web View Automation 

…prefix

allocate_case_no() returned 2026-DEL-001-001 on every call when
courtroom/case-registry.yaml was absent, without creating the registry.
Now initializes the registry on first allocation and increments normally.

export_transcript.py joined BASE_DIR (courtroom/) with paths like
courtroom/transcripts/foo.md, resolving to a nonexistent double path.
Documented README usage now works via resolve_transcript_path().

Regression tests added for both issues.

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