Skip to content

feat(core-engine): per-file dynamism replaces the flat language irc in four risk equations (#2719) - #2723

Merged
squid-protocol merged 8 commits into
mainfrom
feat/2719-per-file-dynamism
Sep 4, 2026
Merged

feat(core-engine): per-file dynamism replaces the flat language irc in four risk equations (#2719)#2723
squid-protocol merged 8 commits into
mainfrom
feat/2719-per-file-dynamism

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Child of #2716; stacked on #2721 (PR 1). After PR 1 the per-language irc was still a flat integer summed into six formulas in six different units. This PR gives each of those formulas the term it can justify, one commit per formula.

Per formula

formula commit change why
documentation 46890c5d ircper-file dynamism (reflection_metaprogramming, tuning documentation.dynamism_weight 1.0) undocumented runtime-decided behaviour is exactly what needs documenting; the formula read neither signal before
cognitive load 3263483d heat_density reads dynamism at its existing 5× weight; the irc / mass_loc pseudo-hit is removed reflection and eval are the same opacity to a reader; one definition. Counting eval here and in safety is two risk dimensions, not a double count
concurrency 266dff79 language term removed (irc × 0.1, tuning key deleted) no strictness column is about concurrency and dynamism is not concurrency; the inputs are the file's own spawns and locks
state flux d4d17b07 language term removed (irc × 0.15, tuning key deleted) "implicit mutability defaults" is not a strictness column and dynamism is not mutation
safety keeps the strictness irc the language-hazard claim (C's memory model) is defensible in a safety score; high_risk_execution is already the ×4 attack term
tech debt keeps the strictness irc × 0.5 "things left unsaid" is maintenance overhead; dynamism is not debt

SignalProcessor._dynamism() is the single definition: the file's reflection_metaprogramming count. The first cut also summed high_risk_execution; attribution showed that signal is the safety attack vocabulary across the registry — panic!/todo!, os.Exit/log.Fatal, System.exit, STOP RUN, rm -rf/sudo — carrying eval/exec only in the dynamic languages, and it was importing aborts and destructive commands into cognitive load (three STOP RUNs in a 31-line COBOL file: +33). It is read at ×4 by safety, where it belongs; python's eval/exec therefore do not count as dynamism until a dedicated signal exists. Pointer arithmetic, macros and type bypasses stay in their own equations too.

Net: the language-level irc is read by exactly two formulas, each with a written reason a reviewer can disagree with; four formulas lost a constant that corresponded to nothing measurable. keyword-rosetta's tier_sensitive set shrinks to those two rows on its own (it AST-reads which formulas take irc).

Tests and tools

  • test_uef_length_invariance.py: the 51-LOC pins are re-pinned per commit for exactly the equation that commit changed (the re-pin script refuses to run if any other equation moved); the engine PR 1: language-strictness table + measured fidelity coefficient replace _get_tier (child of #2716) #2718 exemption block is gone. The strictness-direction test still passes — equations that no longer read irc are equal across profiles.
  • audit_risk_equations.py: _calc_concurrency and _calc_state_flux move to NOT_TIER_PARAMETERIZED (the tool asserts on this). audit_length_invariance.py updated. Both run clean.
  • Dead tuning key documentation.irc_mult (never read) replaced by dynamism_weight; concurrency.irc_mult and state_flux.irc_mult removed.

What moved

Golden master regenerated in both venvs and attributed with golden_diff.deep_compare against PR 1's fixture: 5,231 substantive diffs, 0 topological, confined to the four changed columns and their aggregates — Safety, Tech Debt, Testing and everything structural are untouched, as intended.

column cells mean Δ range reading
Cognitive Load 1,654 −1.24 −7.47 … −0.01 only down: the irc / mass_loc pseudo-hit is gone and reflection was already in the heat term
State Flux 714 −1.73 −5.98 … −0.01 only down: term removed
Concurrency 291 −2.65 −7.89 … −0.01 only down: term removed
Documentation 643 −0.41 −25.84 … +87.89 down where the language irc exceeded the file's reflection count (jcl −4.7, livecode −4.3, assembly −2.9 means); up where the file is reflection-heavy

The upward Documentation tail is shell: 15 of the crucible's 46 shell files jump ≥ 25 points because the shell reflection_metaprogramming rule counts every $(...), backtick and plain ${var} (configure-helper.sh: 1,019 hits in 2,823 lines) — filed as #2722. That is the per-file term doing its job: it made a vocabulary over-match visible that the flat language constant had hidden. The fix belongs to the rule, not the formula.

The first cut of this PR summed high_risk_execution into dynamism; its attribution showed Cognitive Load moving up by +33 on a 31-line COBOL file with three STOP RUNs. That is what led to narrowing the definition (bec8522b).

Gauntlet

  • Full suite: 7,566 passed, 3 skipped, 9 xfailed (the 51-LOC pins re-pinned per commit, see above).
  • audit_check.py: all clear at every commit (ruff baseline regenerated for line-shifts; mypy 2-error baseline; dead-key; ast-accuracy).
  • tree_sitter_accuracy_audit.py --ci --all: 30/30. tri_comparison_chart.py --all --ci: 3/3.
  • rosetta_audit.py: 46/46, 0 regressions — §2 signals untouched, so no corpus re-bless owed; the risk_* rows move on the next bias-history regen and tier_sensitive shrinks to safety + tech debt on its own.
  • audit_risk_equations.py and audit_length_invariance.py: no direction or invariance flags.
  • Golden master: blessed in both venvs (crucible_check.py --update --yes), scoped diff above.

Closes #2719

🤖 Generated with Claude Code

squid-protocol and others added 8 commits September 4, 2026 12:34
…he language irc (#2719)

Undocumented runtime-decided behaviour -- eval/exec and reflection, counted in THIS
file -- is what the flat per-language irc stood in for in _calc_documentation.
One definition, SignalProcessor._dynamism(), read where the term used to be, at
tuning key documentation.dynamism_weight (1.0; the dead irc_mult key is removed).
The #2655 zero-evidence guard is unchanged: no public surface -> 0 in every language.

Pins at 51 LOC re-pinned for documentation and for the tier-2/3 safety values #2718
had exempted (its exemption block is gone).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…; language irc term removed (#2719)

Reflection and eval are the same opacity to a reader -- you cannot follow what runs --
so heat_density now reads _dynamism() (reflection + high_risk_execution) at its
existing 5x weight, and the flat per-language `irc / mass_loc` pseudo-hit is gone.
Counting eval here AND in safety is not double counting: two risk dimensions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`density += irc * 0.1` corresponded to nothing: no strictness column is about
concurrency and dynamism is not concurrency. The inputs are the file's own spawns
and locks. Tuning key concurrency.irc_mult removed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`density += irc * 0.15` was documented as "implicit mutability defaults", which no
strictness column measures and dynamism does not describe. The inputs are the file's
own writes and immutability locks. Tuning key state_flux.irc_mult removed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… after #2719

08-05 and 08-09 read per-file dynamism (reflection + high_risk_execution); 08-15 and
08-16 no longer carry a language term; 08-03's third input row is marked done and
names which equations still read the strictness Irc (safety, tech debt) and why.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
5,269 substantive diffs, 0 topological, confined to the four changed columns and their
aggregates: Cognitive Load (dynamism in heat_density, language irc gone), Documentation
(per-file dynamism replaces irc), Concurrency and State Flux (language term removed --
every cell moves down). Safety, Tech Debt and Testing are untouched, as intended.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…count alone (#2719)

Attribution of the first cut showed high_risk_execution is the safety ATTACK
vocabulary across the registry -- panic!/todo!, os.Exit/log.Fatal, System.exit,
STOP RUN, rm -rf/sudo -- carrying eval/exec only in the dynamic languages. Summing
it into dynamism imported aborts and destructive commands into cognitive load and
documentation (three STOP RUNs in a 31-line COBOL file: +33 cognitive load). It is
already read at 4x by _calc_safety, where it belongs. reflection_metaprogramming is
consistent across all 46 languages: getattr, Reflect/Proxy, method_missing,
AUTOLOAD, Class.forName, transmute, macro_rules!.

Shell's reflection rule over-matches plain ${var} and every $(...): #2722.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
5,231 substantive diffs, 0 topological, confined to the four changed columns and their
aggregates. Cognitive Load, Concurrency and State Flux move only DOWN (a language term
was removed; dynamism replaces reflection in the heat term at the same weight).
Documentation moves both ways: down where the language irc exceeded the file's
reflection count, up where the file is reflection-heavy -- the large shell moves are
the rule over-match filed as #2722, not the formula.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@squid-protocol squid-protocol added metrics Heuristics, risk exposures, and topological math updates core-engine Modifications to the central physics and parsing engine labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 4c283ed into main Sep 4, 2026
57 checks passed
@squid-protocol
squid-protocol deleted the feat/2719-per-file-dynamism branch September 4, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-engine Modifications to the central physics and parsing engine metrics Heuristics, risk exposures, and topological math updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

engine PR 2: per-file dynamism count replaces the flat irc term (child of #2716)

1 participant