Fix file_data.class_count to use the real named class list - #1980
Merged
Conversation
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>
Contributor
🐦⬛ Muninn Security Scan
ℹ️ Info Findings[checkov] Ensure that a user for the container has been createdFile: [checkov] Ensure that HEALTHCHECK instructions have been added to container imagesFile: [checkov] Ensure the base image uses a non latest version tagFile: |
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
file_data.class_countwas sourced from the rawclass_startSIGNAL vector (hv[class_idx], the same value stored asstruct_class_start), notlen(classes)-- the actual named class list that also backs theclass_datatable.function_countalready correctly usedlen(functions); this bringsclass_countin line with the same pattern.How this was found
Found while manually verifying dockerfile's tri-comparison numbers (
tri-comparison-ledger-sweepskill's manual-verification fallback -- dockerfile has no tree-sitter/ctags comparison tool).file_data.class_countreported 69 for a Dockerfile with 69 realFROMbuild stages, butclass_datahad 0 rows -- dockerfile has no named class extraction wired yet (tracked separately as #1974, not this PR).class_countshould honestly reportlen(classes)regardless of which language it's counting for -- this is a general bug affectingclass_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 existingmock_pipeline_statefixture already had 1 real class with"class_start"not even present in its mockSIGNAL_SCHEMA-- so the bug was silently producingclass_count == 0there even though nothing asserted it. Addedassert file_row["class_count"] == 1andassert file_row["function_count"] == 1.Verification
pytest tests/tools_recorders/test_record_keeper.py -v: 4/4 passedruff_audit.py --ci/mypy_audit.py --ci: clean against baselinedetector.py/prism.py/language_standards.pyuntouched) --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