Skip to content

fix(#4110): one shared definition of "a function" for counting and listing - #4113

Merged
squid-protocol merged 2 commits into
mainfrom
fix/4110-shared-function-population
Oct 2, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/4110-shared-function-population

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #4110.

Problem

On language-crucible the audit's "5. Function Analysis" listed 48,318 functions; the scan DB's function_data held 45,550. Both filter the same list, on different flags:

So 2,768 synthetic units (__global_context__ buckets, Anonymous_Block, Mode E slices like CREATE_Statement / Declarative_Block) were reported as functions across 555 files, mostly shell, lua, livecode and SQL. The golden master was tracking a different population from the one the DB and archetypes use.

Fix

  • gitgalaxy/core/function_population.py: is_population_function / population_functions, the one predicate (not is_synthetic_slice and not calls_only).
  • Applied to every site that counts or lists functions for reporting: audit Function Analysis, LLM brief top-impact and per-file lists, _generate_function_rankings, the folder roll-up func_count, and record_keeper's per-file population. Also corrected the record_keeper comment that said buckets keep function_data rows; they go to synthetic_unit_data.
  • Deliberately unchanged:

Golden master

Re-blessed against crucible v1.6.0. Only 6_parsed_files_scanned_artifacts/files/5_function_analysis moves in each fixture, and both now list exactly 45,550 functions, matching function_data. No signal, risk, archetype or summary value changed.

Tests

  • tests/core_engine/test_function_population.py: predicate cases, plus a guard that the reporting modules use the shared predicate and have no hand-rolled calls_only filter.
  • tests/tools_recorders/test_audit_recorder.py::test_function_analysis_lists_the_db_population.
  • core_engine + tools_recorders: 2,412 passed; audit_check all clear.

🤖 Generated with Claude Code

…sting

The audit's "5. Function Analysis" listed 48,318 functions on language-crucible
while the scan DB's function_data held 45,550. Both filter the same list, on
different flags: the DB (and every per-function statistic, #2691) excludes all
slicer-synthesized units (`is_synthetic_slice`), while the audit excluded only
`calls_only` -- so `__global_context__` buckets, `Anonymous_Block`s and Mode E
statement slices (`CREATE_Statement`, `Declarative_Block`, ...) were reported
as functions in 555 files (shell, lua, livecode, sql, ...).

- gitgalaxy/core/function_population.py: is_population_function /
  population_functions, the single predicate.
- Used by every site that counts or lists functions for reporting: the audit's
  Function Analysis, the LLM brief's top-impact and per-file function lists,
  the function rankings, the folder roll-up func_count, and record_keeper's
  per-file population (whose comment wrongly said buckets keep function_data
  rows -- they go to synthetic_unit_data).
- Deliberately unchanged: file mass/impact (buckets carry mass), the composition
  archetype's log_function_count (a trained feature -- changing it needs trainer
  parity), and language-identity's named-structure check.

Golden masters re-blessed: only 5_function_analysis moves; both fixtures now
list exactly 45,550 functions, matching function_data.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine data-integrity Issues relating to RAM state or SQLite database fidelity labels Oct 2, 2026
# Conflicts:
#	gitgalaxy/recorders/audit_recorder.py
#	gitgalaxy/recorders/llm_recorder.py
#	gitgalaxy/recorders/record_keeper.py
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 6fd9833 into main Oct 2, 2026
32 checks passed
@squid-protocol
squid-protocol deleted the fix/4110-shared-function-population branch October 2, 2026 14:39
squid-protocol added a commit that referenced this pull request Oct 2, 2026
…4123)

The loop guard skipped the bot's own record merge, but a queued-then-skipped
run still displaced (cancelled) the pending run of the real engine change ahead
of it in the concurrency group -- #4113's merge was never measured that way.
Exclude the record file from the trigger paths so those merges never queue.

Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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 data-integrity Issues relating to RAM state or SQLite database fidelity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audit and DB disagree on what a function is: 48,318 vs 45,550 on the crucible (slicer pseudo-units like CREATE_Statement in the audit only)

1 participant