Repository navigation
fix(recorders): persist prism's doc_loc in file_data; rehydrate it (#2625 engine half) - #2632
Merged
Merged
Conversation
…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
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Engine half of #2625.
file_dataonly ever persistedtotal_loc(blank-inclusive) andcoding_loc(blank-exclusive), so any consumer needing documentation mass had to re-derive itas
total_loc − coding_loc— silently counting every blank line as documentation(keyword-rosetta's
comment_linesmeasured python at 52, of which 31 are blank lines). prismhas computed the honest
doc_loc(non-blank, non-code lines) all along — it just never reachedthe DB. Now it round-trips.
Changes
record_keeper.py—doc_loc INTEGERin thefile_dataschema + INSERT, with atry/except
ALTER TABLEauto-heal for pre-comment_lines conflates blank lines with real documentation (engine-wide, found via #2593) #2625 databases (theis_zero_dependency_modeprecedent), placed after the CREATE so fresh DBs hit the expected duplicate-column branch.
state_rehydrator.py— readsdoc_locback intoram_statewith thesilo_risk-styleschema-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.
200−150=50 ≠ 30), legacy-DB migration mid-mission, legacy-DB rehydration defaults to 0,
modern-DB rehydration reads the value back.
Verification
crucible_check.pyPASS both venvs with no re-bless — additive column only, the auditJSONs never read the DB, zero behavior change to parsing/scoring.
audit_check.pyall clear (ruff baseline regenerated for pure line-shifts only).Cross-repo
bias_report.py'scomment_linestorow["doc_loc"](fallback to the old proxy when the column is absent) + the full46-language re-baseline, run against this PR via
ENGINE_REF=pull/<N>/head. That PR closesthe metric-side distortion; comment_lines conflates blank lines with real documentation (engine-wide, found via #2593) #2625 closes when both land.
rosetta-auditshould stay green (the corpus gates don't readdoc_locyet).🤖 Generated with Claude Code
https://claude.ai/code/session_01BsVATdyMPhUoAUNBKbMUVi