Skip to content

Fix "House of Cards" report section and per-file repo_z_score (#370, #371) - #382

Merged
squid-protocol merged 1 commit into
mainfrom
fix/370-371-house-of-cards-repo-z-score
Jul 24, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/370-371-house-of-cards-repo-z-score

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Closes #370, #371. Two report-accuracy bugs in the same family: real data is computed somewhere in the pipeline, but never actually threaded through to the recorder that's supposed to display it.

#370: llm_recorder.py's "House of Cards" markdown section read sys_bots.get("house_of_cards", []) -- but signal_processor.py's real bottleneck-detector key is "fragile_dependency_chain". The section's own field reads (h['close'], h['err']) already matched that key's real entry shape exactly, confirming this was purely a top-level key mismatch, not a deeper schema drift -- fixed by reading the right key.

#371: record_keeper.py and llm_recorder.py both read a per-file telemetry["repo_z_score"], but the only real z-score signal_processor.py computes is repo-wide, at summary["repo_macro_species"]["z_score"] -- nothing ever copied it down into each file's own telemetry. Fixed by backfilling it in galaxyscope.py right after summary is computed, in both pipeline modes (the main orchestrate() path and the incremental "Delta Mode" path) -- summary can only exist after repository_graph is fully assembled, so this has to be a post-hoc backfill loop, not a per-file computation.

Test plan

  • test_llm_recorder.py: new test driving _build_markdown() with a real fragile_dependency_chain bottleneck entry, proving the House of Cards section renders it.
  • test_galaxyscope.py: new end-to-end test running the real execute_pipeline() (mocking only the heavy engines, matching the existing SARIF sanitization test's harness) with a mocked summarize_galaxy_metrics() z-score, proving it survives into scope.parsed_files[0]["telemetry"]["repo_z_score"].
  • tests/dead_key_audit_baseline.json: "house_of_cards"/"repo_z_score" removed now that they're fixed (python tests/dead_key_audit.py --ci confirmed clean at 7 baselined keys, zero regressions).
  • python -m pytest tests/ -q -- full suite, 858 passed, 1 pre-existing xfail.
  • flake8 . --count --select=E9,F63,F7,F82 -- 0.

🤖 Generated with Claude Code

…371)

Two report-accuracy bugs in the same family: real data is computed
somewhere in the pipeline, but never actually threaded through to the
recorder that's supposed to display it.

#370: llm_recorder.py's "House of Cards" markdown section read
sys_bots.get("house_of_cards", []) -- but signal_processor.py's real
bottleneck-detector key is "fragile_dependency_chain". The section's own
field reads (h['close'], h['err']) already matched that key's real entry
shape exactly, confirming this was purely a top-level key mismatch, not
a deeper schema drift -- fixed by reading the right key.

#371: record_keeper.py and llm_recorder.py both read a per-file
telemetry["repo_z_score"], but the only real z-score signal_processor.py
computes is repo-WIDE, at summary["repo_macro_species"]["z_score"] --
nothing ever copied it down into each file's own telemetry. Fixed by
backfilling it in galaxyscope.py right after summary is computed, in
both pipeline modes (the main orchestrate() path and the incremental
"Delta Mode" path) -- summary can only exist after repository_graph is
fully assembled, so this has to be a post-hoc backfill loop, not a
per-file computation.

Tests:
- test_llm_recorder.py: new test driving _build_markdown() with a real
  fragile_dependency_chain bottleneck entry, proving the House of Cards
  section renders it.
- test_galaxyscope.py: new end-to-end test running the real
  execute_pipeline() (mocking only the heavy engines, matching the
  existing SARIF sanitization test's harness) with a mocked
  summarize_galaxy_metrics() z-score, proving it survives into
  scope.parsed_files[0]["telemetry"]["repo_z_score"].

tests/dead_key_audit_baseline.json: "house_of_cards"/"repo_z_score"
removed now that they're fixed (`python tests/dead_key_audit.py --ci`
confirmed clean at 7 baselined keys, zero regressions).

Full suite: 858 passed, 1 pre-existing xfail.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 421c014 into main Jul 24, 2026
23 checks passed
@squid-protocol
squid-protocol deleted the fix/370-371-house-of-cards-repo-z-score branch July 24, 2026 15:57
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.

[BUG/METRICS] llm_recorder.py's "House of Cards" report section is always empty -- real key is "fragile_dependency_chain"

1 participant