Skip to content

fix(recorders): persist prism's doc_loc in file_data; rehydrate it (#2625 engine half) - #2632

Merged
squid-protocol merged 1 commit into
mainfrom
fix/2625-persist-doc-loc
Sep 1, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/2625-persist-doc-loc

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Engine half of #2625. file_data only ever persisted total_loc (blank-inclusive) and
coding_loc (blank-exclusive), so any consumer needing documentation mass had to re-derive it
as total_loc − coding_loc — silently counting every blank line as documentation
(keyword-rosetta's comment_lines measured python at 52, of which 31 are blank lines). prism
has computed the honest doc_loc (non-blank, non-code lines) all along — it just never reached
the DB. Now it round-trips.

Changes

  • record_keeper.py — doc_loc INTEGER in the file_data schema + INSERT, with a
    try/except ALTER TABLE auto-heal for pre-comment_lines conflates blank lines with real documentation (engine-wide, found via #2593) #2625 databases (the is_zero_dependency_mode
    precedent), placed after the CREATE so fresh DBs hit the expected duplicate-column branch.
  • state_rehydrator.py — reads doc_loc back into ram_state with the silo_risk-style
    schema-drift guard. Fixes a pre-existing incremental-scan bug found during this work:
    unchanged files reported "Documentation LOC: 0" on every rehydrated scan, because the RAM
    reconstruction had no column to read the value from.
  • Tests (4 new): round-trip (proves the column is prism's value, not the subtraction:
    200−150=50 ≠ 30), legacy-DB migration mid-mission, legacy-DB rehydration defaults to 0,
    modern-DB rehydration reads the value back.

Verification

  • Full suite 7185 passed; the two touched test files 16/16.
  • crucible_check.py PASS both venvs with no re-bless — additive column only, the audit
    JSONs never read the DB, zero behavior change to parsing/scoring.
  • audit_check.py all clear (ruff baseline regenerated for pure line-shifts only).

Cross-repo

🤖 Generated with Claude Code

https://claude.ai/code/session_01BsVATdyMPhUoAUNBKbMUVi

…2625)

file_data historically persisted only total_loc (blank-inclusive) and
coding_loc (blank-exclusive), so consumers needing documentation mass had
to re-derive it as total_loc - coding_loc -- silently counting every BLANK
line as documentation (keyword-rosetta's comment_lines metric measured
python at 52 where 31 lines are blank). prism.py has computed the honest
doc_loc (non-blank, non-code lines) all along; now it round-trips:

- record_keeper.py: doc_loc column in file_data (schema + INSERT), with a
  try/except ALTER TABLE auto-heal for pre-#2625 databases placed AFTER the
  CREATE (the is_zero_dependency_mode precedent).
- state_rehydrator.py: doc_loc read back into ram_state with the silo_risk
  schema-drift guard. Fixes a pre-existing incremental-scan bug: unchanged
  files reported "Documentation LOC: 0" on every rehydrated scan because
  the reconstruction had no column to read.
- Tests: round-trip, legacy-DB migration, legacy-DB rehydration default,
  modern-DB rehydration read-back (16/16 in the two files).

Additive column only -- no parsing or scoring change; crucible_check PASS
both venvs with no re-bless; full suite 7185 passed; ruff baseline
regenerated for pure line-shifts only.

Part of #2625 (engine half). The consumer half -- keyword-rosetta's
bias_report.py switching comment_lines to the honest column and the
46-language re-baseline -- follows as the companion corpus PR.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BsVATdyMPhUoAUNBKbMUVi
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine metrics Heuristics, risk exposures, and topological math updates labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 1388e53 into main Sep 1, 2026
65 checks passed
@squid-protocol
squid-protocol deleted the fix/2625-persist-doc-loc branch September 1, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine metrics Heuristics, risk exposures, and topological math updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant