Skip to content

Fix file_data.class_count to use the real named class list - #1980

Merged
squid-protocol merged 1 commit into
mainfrom
fix/class-count-source-1972
Aug 21, 2026
Merged

Fix file_data.class_count to use the real named class list#1980
squid-protocol merged 1 commit into
mainfrom
fix/class-count-source-1972

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

file_data.class_count was sourced from the raw class_start SIGNAL vector (hv[class_idx], the same value stored as struct_class_start), not len(classes) -- the actual named class list that also backs the class_data table. function_count already correctly used len(functions); this brings class_count in line with the same pattern.

How this was found

Found while manually verifying dockerfile's tri-comparison numbers (tri-comparison-ledger-sweep skill's manual-verification fallback -- dockerfile has no tree-sitter/ctags comparison tool). file_data.class_count reported 69 for a Dockerfile with 69 real FROM build stages, but class_data had 0 rows -- dockerfile has no named class extraction wired yet (tracked separately as #1974, not this PR). class_count should honestly report len(classes) regardless of which language it's counting for -- this is a general bug affecting class_count's accuracy for every language, not dockerfile-specific.

Fix

gitgalaxy/recorders/record_keeper.py: one-line change, class_count = len(file_data.get("classes", [])).

Regression test

Added to test_record_keeper_data_insertion (tests/tools_recorders/test_record_keeper.py): the existing mock_pipeline_state fixture already had 1 real class with "class_start" not even present in its mock SIGNAL_SCHEMA -- so the bug was silently producing class_count == 0 there even though nothing asserted it. Added assert file_row["class_count"] == 1 and assert file_row["function_count"] == 1.

Verification

  • pytest tests/tools_recorders/test_record_keeper.py -v: 4/4 passed
  • ruff_audit.py --ci / mypy_audit.py --ci: clean against baseline
  • Not a parsing-logic change (detector.py/prism.py/language_standards.py untouched) -- crucible_check.py/golden master reblessing not needed.

Implemented via a Gemini/agy dispatch from a fully diagnosed issue, independently re-verified (diff read, tests/audits re-run from scratch) before this PR.

Fixes #1972.

🤖 Generated with Claude Code

class_count was sourced from the raw class_start SIGNAL vector
(hv[class_idx], the same value as struct_class_start), not
len(classes) -- the actual named list that also backs the class_data
table. function_count already correctly used len(functions); this
brings class_count in line with the same pattern.

Found while manually verifying dockerfile's tri-comparison numbers:
class_count reported 69 for a Dockerfile with 69 real FROM stages,
but class_data had 0 rows (dockerfile has no named class extraction
wired yet, tracked separately as #1974). class_count should honestly
report len(classes) regardless of which language it's counting for.

Adds a regression assertion to test_record_keeper_data_insertion --
the existing mock_pipeline_state fixture already had 1 real class
with no 'class_start' key in its mock SIGNAL_SCHEMA, so the bug was
silently producing class_count=0 there even though nothing asserted
it.

Fixes #1972.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Gemini 3.1 Pro <noreply@google.com>
@squid-protocol
squid-protocol merged commit 7f9a7c0 into main Aug 21, 2026
24 of 26 checks passed
@squid-protocol
squid-protocol deleted the fix/class-count-source-1972 branch August 21, 2026 01:05
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 0
🟢 Low 0
ℹ️ Info 3

ℹ️ Info Findings

[checkov] Ensure that a user for the container has been created

File: /docs/language_status/dockerfile.md:1
Rule: CKV_DOCKER_3
Ensure that a user for the container has been created

[checkov] Ensure that HEALTHCHECK instructions have been added to container images

File: /docs/language_status/dockerfile.md:1
Rule: CKV_DOCKER_2
Ensure that HEALTHCHECK instructions have been added to container images

[checkov] Ensure the base image uses a non latest version tag

File: /docs/language_status/dockerfile.md:157
Rule: CKV_DOCKER_7
Ensure the base image uses a non latest version tag

🐦‍⬛ Powered by Muninn · Skald Lab

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.

file_data.class_count sourced from raw class_start signal, not the real named class list

1 participant