diff --git a/.github/workflows/rosetta-audit.yml b/.github/workflows/rosetta-audit.yml index 73ffb22bf..29dfe3905 100644 --- a/.github/workflows/rosetta-audit.yml +++ b/.github/workflows/rosetta-audit.yml @@ -18,6 +18,14 @@ name: rosetta-audit on: pull_request: + # `labeled` matters: `rosetta:rebless-owed` is what turns an intentional + # corpus-visible change's regressions into warnings, and without this type + # the audit only ever runs on the event that OPENED the PR. gh's + # `pr create --label` attaches the label after that payload is built, so + # the first run of #2703 read zero labels and failed red on a regression + # the author had already declared -- and no later label change could + # re-trigger it. `unlabeled` is here for the same reason in reverse. + types: [opened, synchronize, reopened, labeled, unlabeled] branches: [main, v6-dev] paths: - "gitgalaxy/**" diff --git a/docs/self_scan/ROSETTA_AUDIT.md b/docs/self_scan/ROSETTA_AUDIT.md index 5dfa7f34f..5b16f458e 100644 --- a/docs/self_scan/ROSETTA_AUDIT.md +++ b/docs/self_scan/ROSETTA_AUDIT.md @@ -40,7 +40,12 @@ Decide which of these you are in: 2. **Intentional, corpus-visible improvement** (a rule fix or addition, a stripper change). The expected values live in the corpus repo, so: - add the **`rosetta:rebless-owed`** label to this PR — the audit reports the regressions - as warnings and goes green, with the languages still listed in the summary; + as warnings and goes green, with the languages still listed in the summary. Adding the + label re-runs the audit (the workflow listens for `labeled`), so an already-red run + turns green on its own; you do not need to push an empty commit. Note that + `gh pr create --label` attaches the label *after* the `opened` payload is built, so the + very first run of a new PR reads no labels and goes red — the `labeled` event that + follows is the one that counts; - merge; - open the re-bless PR in keyword-rosetta **against engine main** (manifests + ledger per its `docs/GATING.md`). Its `verify.yml` checks out engine main, so it is green by diff --git a/gitgalaxy/core/detector.py b/gitgalaxy/core/detector.py index af13a268c..c449ecceb 100644 --- a/gitgalaxy/core/detector.py +++ b/gitgalaxy/core/detector.py @@ -5594,6 +5594,18 @@ def _matching_paren_end(self, text: str, open_idx: int) -> int: _LISP_FORM_HEAD: ClassVar[re.Pattern[str]] = re.compile(r'[ \t\r\n]*([^\s()\[\];"]{1,200})') _LISP_LET_FAMILY: ClassVar[frozenset[str]] = frozenset({"let", "let*", "letrec", "letrec*"}) + # #2654: every MATLAB function declaration, whether or not it declares + # outputs. The output list is optional so a `function helper(x)` still + # opens a span -- otherwise its body would be scanned as part of the + # PRECEDING function's, and a same-named local there could be dropped as + # if it were that function's return channel. Both name lists are bounded + # (no adjacent unbounded quantifiers), so the scan stays linear. + _MATLAB_FUNC_DECL: ClassVar[re.Pattern[str]] = re.compile( + r"^[ \t]*function\b" + r"(?:[ \t]*(?:\[(?P[^\]\n]{0,400})\]|(?P[a-zA-Z_]\w{0,127}))[ \t]*=(?![=]))?", + re.M, + ) + def _apply_scope_filter( self, filter_name: str, @@ -5621,11 +5633,92 @@ def _apply_scope_filter( if paren != -1 and paren in keep: kept.append(m) return kept + if filter_name == "matlab_return_channel": + if filter_name not in cache: + cache[filter_name] = self._matlab_return_channel_offsets(code) + drop = cache[filter_name] + kept = [] + for m in matches: + # The assignment alternative is `^[ \t]*` anchored, so its + # identifier is the line's first non-space character; the + # `clear`/`clearvars` alternative is unanchored and can only + # start further in, which is what keeps a `out = 1; clear y` + # line from losing its cleanup hit along with its binding. + idx = m.start() + while idx < len(code) and code[idx] in " \t": + idx += 1 + if idx not in drop: + kept.append(m) + return kept self.logger.warning( f"[DIAGNOSTIC] Unknown scope filter '{filter_name}' declared for '{seg_lang}::{rule_name}'. Ignoring." ) return matches + def _matlab_return_channel_offsets(self, code: str) -> set[int]: + """ + Offsets of every bare assignment to a MATLAB output variable that its + function only ever WRITES -- the return-channel bindings (#2654). + + MATLAB has no `return `: a result is an assignment to a name in + the `function [out] = f(...)` signature, so `out = env;` is the exact + statement c/go/java write as `return env;` for zero state_mutation. + Dropping every write to an output variable would be wrong the other + way -- runica.m uses `weights` as the working accumulator for a whole + ICA loop and assigns it repeatedly -- so the discriminator is whether + the body ever reads the name back. A name whose every occurrence in + the body is a bare left-hand side (`name =`, no subscript, no field, + no mention on the right) is pure return channel; one that appears + anywhere else -- read in an expression, `out(i) = x`, `out = out + 1`, + passed as an argument -- is working state and keeps all of its hits. + + A function's body runs to the next `function` declaration. For a + nested function that truncates the parent's body early, which can only + make the parent's name look MORE read (the nested span is scanned + under the nested declaration) and so only ever KEEPS hits: the failure + direction is the pre-filter count, never a zeroed metric. + + Measured over Prism code streams: the rosetta corpus drops 15 of 19 + hits (25 -> 4 once the per-function x3 flux weighting is applied, + against a corpus median of 2); language-crucible's eeglab drops 15 of + 1321 (1.1%), each a terminal `com = ''` / `varargout = {...}` / + `name = dirName;` binding, with `weights`, `y` and `EEG` untouched. + """ + decls = list(self._MATLAB_FUNC_DECL.finditer(code)) + if not decls: + return set() + + offsets: set[int] = set() + for i, decl in enumerate(decls): + raw_outs = decl.group("outs") + if raw_outs is not None: + names = {t.strip() for t in raw_outs.split(",") if t.strip()} + elif decl.group("out1"): + names = {decl.group("out1")} + else: + continue + + body_start = decl.end() + body_end = decls[i + 1].start() if i + 1 < len(decls) else len(code) + body = code[body_start:body_end] + + for name in names: + if not name.isidentifier(): + continue + quoted = re.escape(name) + write = re.compile(rf"^[ \t]*({quoted})[ \t]*=(?![=])", re.M) + write_starts = {m.start(1) for m in write.finditer(body)} + if not write_starts: + continue + # Any occurrence that is not one of those bare left-hand sides + # is a read (or a structured write), which disqualifies the + # whole name -- MATLAB's output variable is then ordinary + # working state, not just the return channel. + if all(m.start() in write_starts for m in re.finditer(rf"\b{quoted}\b", body)): + offsets.update(body_start + start for start in write_starts) + + return offsets + def _lisp_module_level_define_offsets(self, code: str) -> set[int]: """ Offsets of the "(" of every `(define ...)` in `code` whose nearest diff --git a/gitgalaxy/standards/language_standards/languages/matlab.py b/gitgalaxy/standards/language_standards/languages/matlab.py index 98f50259f..c83720c04 100644 --- a/gitgalaxy/standards/language_standards/languages/matlab.py +++ b/gitgalaxy/standards/language_standards/languages/matlab.py @@ -140,6 +140,23 @@ r"[ \t]*=[ \t]*[^=]|\b(?:clear|clearvars)\b", re.M, ), + # #2654: MATLAB has no `return ` statement -- a function result + # IS an assignment to a variable named in the `function [out] = f(...)` + # signature. So the rule above charged every language-crucible and + # rosetta function one state_mutation just for RETURNING, the one + # language in the registry that pays for it (c/go/java's `return env;` + # costs nothing for the identical statement). The discriminator is not + # anything on the assignment's own line -- it is whether the enclosing + # function ever READS the variable back. `out = env;` in a body that + # never mentions `out` again is the return channel; runica.m's + # `weights = startweights;` in a body that reads `weights` throughout + # is genuine working state and still counts, as does any indexed or + # self-referential write (`out(i) = x`, `out = out + i`). See + # `_matlab_return_channel_offsets` in detector.py. Measured: the + # rosetta corpus drops 15 of 19 hits (all four files' `out = ;` + # returns), eeglab drops 15 of 1321 (1.1%) and every one of those is a + # terminal `com = ''` / `varargout = {...}` / `h = uimenu(...)` binding. + "_scope_filters": {"state_mutation": "matlab_return_channel"}, # 12. dead_code (Commented Logic / Deprecated Trails) "dead_code": re.compile(r"^[ \t]*%[ \t]*(?:if|for|while|function|classdef)\b", re.M), # doc: Standard MATLAB Help text (`%%` sections) or typed annotations. diff --git a/tests/extraction/languages/test_matlab_strict.py b/tests/extraction/languages/test_matlab_strict.py index d793c7ef7..5c55cbd5d 100644 --- a/tests/extraction/languages/test_matlab_strict.py +++ b/tests/extraction/languages/test_matlab_strict.py @@ -541,3 +541,132 @@ def test_matlab_redos_immunity_sweep(): assert MATLAB_RULES["func_start"].search("function y = foo(x)") assert MATLAB_RULES["class_start"].search("classdef Foo") assert MATLAB_RULES["state_mutation"].search("data(idx(1)) = value;") + + +# ============================================================================== +# #2654: state_mutation -- MATLAB's return channel is an assignment +# ============================================================================== +# MATLAB has no `return ` statement: a result is an assignment to a name +# declared in `function [out] = f(...)`. The bare regex therefore charged every +# function one state_mutation just for returning -- the only language in the +# registry that pays for the statement c/go/java write as `return env;` for +# free. The discriminator is not on the assignment's line but in the enclosing +# function: a name the body never READS back is the return channel; one the +# body works with (`out = out + 1`, `out(i) = x`, `y` in runica.m's ICA loop) +# is genuine state. detector.py's coding_analysis applies the registry-declared +# `matlab_return_channel` scope filter, so these go through the real extractor. + + +def _matlab_state(code: str) -> int: + """ + RAW state_mutation hits, straight out of coding_analysis. Deliberately not + `splice()["equations"]`, whose value has #2546's per-function x3 proximity + flux applied on top -- that weighting is what turns matlab's four surviving + rosetta hits into a cell value, and mixing it in here would hide which of + the two effects a regression came from. + """ + from gitgalaxy.core.detector import StructuralExtractor + + counts, *_ = StructuralExtractor("matlab", LANGUAGE_DEFINITIONS).coding_analysis([("matlab", code, 0)]) + return counts["state_mutation"] + + +def test_matlab_scope_filter_is_declared_for_state_mutation(): + assert MATLAB_RULES["_scope_filters"] == {"state_mutation": "matlab_return_channel"} + + +def test_matlab_return_convention_assignment_is_not_a_mutation(): + """The issue's own example: `out = env;` IS `return env;`.""" + code = "function out = probe_globals(env)\nout = env;\nend\n" + assert MATLAB_RULES["state_mutation"].search(code), "sanity: the bare regex still matches the binding" + assert _matlab_state(code) == 0 + + +def test_matlab_branch_exclusive_returns_are_all_return_channel(): + """Three mutually exclusive `out = k` are three `return k`, not three mutations.""" + code = "function out = probe_branch(flag)\nif flag > 0\nout = 1;\nelseif flag < 0\nout = 2;\nelse\nout = 3;\nend\nend\n" + assert _matlab_state(code) == 0 + + +def test_matlab_output_variable_read_back_is_working_state(): + """runica.m's shape: an output used as the accumulator keeps every hit.""" + accumulate = "function out = total(n)\nout = 0;\nfor i = 1:n\nout = out + i;\nend\nend\n" + assert _matlab_state(accumulate) == 2 + indexed = "function out = fill(n)\nout = zeros(1, n);\nout(1) = 5;\nend\n" + assert _matlab_state(indexed) == 2 + passed_along = "function out = wrap(x)\nout = x;\ndisp(out);\nend\n" + assert _matlab_state(passed_along) == 1 + + +def test_matlab_multiple_outputs_are_judged_independently(): + """parsepluginname's shape: `name` is write-only, `vers` is read back.""" + code = ( + "function [name, vers] = parse(dirName)\n" + "name = dirName;\n" + "vers = '';\n" + "vers(vers == '_') = '.';\n" + "end\n" + ) + # `name` drops; `vers`'s bare binding AND its indexed write both stay. + assert _matlab_state(code) == 2 + + +def test_matlab_non_output_locals_still_count(): + code = "function out = probe_debt(level)\nhack_level = level;\nout = hack_level;\nend\n" + assert _matlab_state(code) == 1 + + +def test_matlab_script_level_and_void_functions_are_untouched(): + """No declared output means nothing to drop; a void function opens its own span.""" + assert _matlab_state("x = 5;\ny = 6;\n") == 2 + # `out` here belongs to the void helper, not to the preceding function. + code = "function out = f(a)\nout = a;\nend\nfunction helper(b)\nout = b;\nend\n" + assert _matlab_state(code) == 1 + + +def test_matlab_clear_on_a_dropped_binding_line_keeps_its_own_hit(): + """The `clear` alternative is unanchored; it must survive its line's binding being dropped.""" + code = "function out = f(a)\nout = a; clear scratch\nend\n" + assert _matlab_state(code) == 1 + + +def test_matlab_return_channel_filter_keeps_counts_and_locations_consistent(): + from gitgalaxy.core.detector import StructuralExtractor + + d = StructuralExtractor("matlab", LANGUAGE_DEFINITIONS) + code = "function out = f(a)\nout = a;\nend\nfunction out = g(b)\nnote = b;\nout = note;\nend\n" + counts, _mit, spatial_maps, _parents, locations = d.coding_analysis([("matlab", code, 0)]) + assert counts["state_mutation"] == 1 + assert len(spatial_maps[0]["state_mutation"]) == 1 + assert locations["state_mutation"] == [5] + + +def test_matlab_unknown_scope_filter_name_is_ignored_not_zeroed(): + import copy + + from gitgalaxy.core.detector import StructuralExtractor + + defs = copy.deepcopy(LANGUAGE_DEFINITIONS) + defs["matlab"]["rules"]["_scope_filters"] = {"state_mutation": "no-such-filter"} + code = "function out = f(a)\nout = a;\nend\n" + counts, *_ = StructuralExtractor("matlab", defs).coding_analysis([("matlab", code, 0)]) + assert counts["state_mutation"] == 1 + + +def test_matlab_return_channel_scan_is_linear_on_pathological_input(): + """The scan is a bounded declaration regex plus per-name passes, not backtracking.""" + import time + + from gitgalaxy.core.detector import StructuralExtractor + + d = StructuralExtractor("matlab", LANGUAGE_DEFINITIONS) + payloads = [ + "function out = f(a)\n" + "out = a;\n" * 20000 + "end\n", + "function out = f(a)\n" + "out = out + a;\n" * 20000 + "end\n", + ("function out = f(a)\nout = a;\nend\n" * 5000), + "function [" + ",".join(f"o{i}" for i in range(40)) + "] = f(a)\n" + "o1 = a;\n" * 5000 + "end\n", + ] + for payload in payloads: + start = time.perf_counter() + d.coding_analysis([("matlab", payload, 0)]) + assert time.perf_counter() - start < 10.0, "return-channel scan went superlinear" diff --git a/tests/golden_master_audit.json b/tests/golden_master_audit.json index 181cf55c9..c987df46c 100644 --- a/tests/golden_master_audit.json +++ b/tests/golden_master_audit.json @@ -12,8 +12,8 @@ }, "Target Root Name": "data", "Absolute Project Path": "/home/joe/nyx_projects/language-crucible/data", - "Analysis ISO Timestamp": "2026-09-03T23:11:26.960010+00:00", - "Total Scan Duration": "51.76 seconds" + "Analysis ISO Timestamp": "2026-09-03T23:50:41.001794+00:00", + "Total Scan Duration": "51.07 seconds" }, "Source Control Footprint (Immutable Anchor)": { "Active Branch": "HEAD", @@ -236,8 +236,8 @@ } }, "health": { - "avg_cognitive_load": 25.046, - "avg_safety_score": 45.644, + "avg_cognitive_load": 25.039, + "avg_safety_score": 45.641, "avg_tech_debt": 31.075, "avg_documentation": 12.205 }, @@ -430,7 +430,7 @@ "matlab": { "files": 6, "loc": 3669, - "impact": 4972.18 + "impact": 4927.18 }, "mlir": { "files": 3, @@ -1342,15 +1342,15 @@ }, "matlab/eeglab": { "file_count": 7, - "total_mass": 4973.24, + "total_mass": 4928.24, "avg_exposures": { - "cognitive_load": 62.99, - "safety_score": 80.36, + "cognitive_load": 60.13, + "safety_score": 79.18, "tech_debt": 4.77, "verification": 57.49, "api_exposure": 0.0, "concurrency": 12.31, - "state_flux": 85.71, + "state_flux": 84.81, "dead_code": 9.02, "spec_match": 78.57, "stability": 42.86, @@ -455751,20 +455751,20 @@ } }, "matlab/eeglab": { - "Directory Group Magnitude": 4973.24, + "Directory Group Magnitude": 4928.24, "File Count": 7, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "85.7%", "Static: Literature & Documentation": "14.3%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "62.99%", - "Error & Exception Exposure": "80.36%", + "Cognitive Load Exposure": "60.13%", + "Error & Exception Exposure": "79.18%", "Tech Debt Exposure": "4.77%", "Testing Exposure": "57.49%", "API Exposure": "0.0%", "Concurrency Exposure": "12.31%", - "State Flux Exposure": "85.71%", + "State Flux Exposure": "84.81%", "Commented Logic Exposure": "9.02%", "Specification Exposure": "78.57%", "Instability Exposure": "42.86%", @@ -455786,9 +455786,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": -6581.0, - "Y": 172.11, - "Z": -5076.48 + "X": -6580.83, + "Y": 172.08, + "Z": -5076.53 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -455943,9 +455943,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6957.59, - "Y": 31.7, - "Z": -5531.66 + "X": -6957.0, + "Y": 31.77, + "Z": -5531.47 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -455957,7 +455957,7 @@ "Total LOC": 193, "Coding LOC": 115, "Documentation LOC": 61, - "Structural Magnitude": 214.7, + "Structural Magnitude": 208.7, "Control Flow Ratio": "58.2%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -455967,7 +455967,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "90.56%", - "Error & Exception Exposure": "98.96%", + "Error & Exception Exposure": "98.73%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -456014,7 +456014,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 130, + "State Mutations / Variable Reassignments": 124, "Commented-out Code (Dead Logic)": 1, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -456121,9 +456121,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6471.94, + "X": -6471.82, "Y": 134.89, - "Z": -5520.32 + "Z": -5520.21 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -456135,7 +456135,7 @@ "Total LOC": 2293, "Coding LOC": 1724, "Documentation LOC": 356, - "Structural Magnitude": 2033.98, + "Structural Magnitude": 2012.98, "Control Flow Ratio": "57.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -456145,7 +456145,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "76.43%", - "Error & Exception Exposure": "94.13%", + "Error & Exception Exposure": "93.82%", "Tech Debt Exposure": "11.04%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -456912,7 +456912,7 @@ "High-Risk Execution Commands": 3, "I/O and Network Boundaries": 7, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 1198, + "State Mutations / Variable Reassignments": 1177, "Commented-out Code (Dead Logic)": 9, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -457019,9 +457019,9 @@ "Identity Proof": "Ecosystem Consensus Lock (100% Local Dominance)" }, "2. Topological Coordinates": { - "X": -5990.57, - "Y": 121.05, - "Z": -5732.9 + "X": -5993.26, + "Y": 121.13, + "Z": -5731.02 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -457033,22 +457033,22 @@ "Total LOC": 15, "Coding LOC": 13, "Documentation LOC": 0, - "Structural Magnitude": 20.06, + "Structural Magnitude": 14.06, "Control Flow Ratio": "50.0%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.66 + "Raw Cognitive Density": 0.42 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "41.1%", - "Error & Exception Exposure": "78.78%", + "Cognitive Load Exposure": "21.08%", + "Error & Exception Exposure": "71.62%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.4%", "API Exposure": "0.0%", "Concurrency Exposure": "0.0%", - "State Flux Exposure": "99.94%", + "State Flux Exposure": "93.7%", "Commented Logic Exposure": "0.0%", "Specification Exposure": "100.0%", "Instability Exposure": "50.0%", @@ -457080,7 +457080,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 12, + "State Mutations / Variable Reassignments": 6, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -457187,9 +457187,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6180.09, - "Y": 256.87, - "Z": -5045.35 + "X": -6180.16, + "Y": 256.79, + "Z": -5045.49 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -457201,7 +457201,7 @@ "Total LOC": 432, "Coding LOC": 293, "Documentation LOC": 102, - "Structural Magnitude": 456.06, + "Structural Magnitude": 450.06, "Control Flow Ratio": "54.3%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -457211,7 +457211,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "79.44%", - "Error & Exception Exposure": "95.16%", + "Error & Exception Exposure": "94.75%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -457378,7 +457378,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 5, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 266, + "State Mutations / Variable Reassignments": 260, "Commented-out Code (Dead Logic)": 2, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -457485,8 +457485,8 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6795.32, - "Y": 143.2, + "X": -6795.08, + "Y": 143.19, "Z": -5269.21 }, "3. Architectural Profile": { @@ -457843,9 +457843,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6463.6, - "Y": -13.0, - "Z": -5896.42 + "X": -6463.51, + "Y": -12.94, + "Z": -5896.02 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -457857,7 +457857,7 @@ "Total LOC": 606, "Coding LOC": 382, "Documentation LOC": 175, - "Structural Magnitude": 552.64, + "Structural Magnitude": 546.64, "Control Flow Ratio": "61.2%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -457867,7 +457867,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "77.3%", - "Error & Exception Exposure": "97.29%", + "Error & Exception Exposure": "97.11%", "Tech Debt Exposure": "12.89%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -458164,7 +458164,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 363, + "State Mutations / Variable Reassignments": 357, "Commented-out Code (Dead Logic)": 5, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -889222,9 +889222,9 @@ "Identity Proof": "Single Indicator (Ext: .proto)" }, "2. Topological Coordinates": { - "X": -7573.0, + "X": -7572.69, "Y": -160.84, - "Z": -5505.73 + "Z": -5505.48 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -889379,9 +889379,9 @@ "Identity Proof": "Single Indicator (Ext: .proto)" }, "2. Topological Coordinates": { - "X": -7350.18, + "X": -7349.88, "Y": -103.73, - "Z": -6239.27 + "Z": -6239.03 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -889536,9 +889536,9 @@ "Identity Proof": "Single Indicator (Ext: .proto)" }, "2. Topological Coordinates": { - "X": -7371.29, + "X": -7370.99, "Y": -123.93, - "Z": -5972.86 + "Z": -5972.62 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -899796,9 +899796,9 @@ "Identity Proof": "Ecosystem Consensus Lock (75% Local Dominance)" }, "2. Topological Coordinates": { - "X": -7244.26, + "X": -7243.87, "Y": 164.39, - "Z": -6711.97 + "Z": -6711.63 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902298,9 +902298,9 @@ "Identity Proof": "Metadata Anchor (COPYING)" }, "2. Topological Coordinates": { - "X": -6640.67, + "X": -6640.28, "Y": 98.47, - "Z": -6408.18 + "Z": -6407.8 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -902455,9 +902455,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6242.48, + "X": -6242.09, "Y": 101.11, - "Z": -6701.0 + "Z": -6700.62 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902623,9 +902623,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -7032.17, + "X": -7031.78, "Y": 78.48, - "Z": -6399.19 + "Z": -6398.81 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902780,9 +902780,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6788.68, + "X": -6788.29, "Y": 122.85, - "Z": -6132.76 + "Z": -6132.38 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902937,9 +902937,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6387.13, + "X": -6386.74, "Y": 68.89, - "Z": -6164.09 + "Z": -6163.71 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -903094,9 +903094,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6612.69, + "X": -6612.3, "Y": 61.87, - "Z": -6727.7 + "Z": -6727.32 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -916514,9 +916514,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": -6937.49, + "X": -6937.11, "Y": 266.93, - "Z": -7013.79 + "Z": -7013.4 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -922851,9 +922851,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": -7628.46, + "X": -7628.16, "Y": -9.01, - "Z": -6239.64 + "Z": -6239.4 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", diff --git a/tests/golden_master_zero_dep_audit.json b/tests/golden_master_zero_dep_audit.json index 4d341d96b..2e22d0c7e 100644 --- a/tests/golden_master_zero_dep_audit.json +++ b/tests/golden_master_zero_dep_audit.json @@ -12,8 +12,8 @@ }, "Target Root Name": "data", "Absolute Project Path": "/home/joe/nyx_projects/language-crucible/data", - "Analysis ISO Timestamp": "2026-09-03T23:12:23.227920+00:00", - "Total Scan Duration": "46.09 seconds" + "Analysis ISO Timestamp": "2026-09-03T23:51:37.920776+00:00", + "Total Scan Duration": "46.72 seconds" }, "Source Control Footprint (Immutable Anchor)": { "Active Branch": "HEAD", @@ -236,8 +236,8 @@ } }, "health": { - "avg_cognitive_load": 25.046, - "avg_safety_score": 45.644, + "avg_cognitive_load": 25.039, + "avg_safety_score": 45.641, "avg_tech_debt": 31.075, "avg_documentation": 12.205 }, @@ -430,7 +430,7 @@ "matlab": { "files": 6, "loc": 3669, - "impact": 4972.18 + "impact": 4927.18 }, "mlir": { "files": 3, @@ -1342,15 +1342,15 @@ }, "matlab/eeglab": { "file_count": 7, - "total_mass": 4973.24, + "total_mass": 4928.24, "avg_exposures": { - "cognitive_load": 62.99, - "safety_score": 80.36, + "cognitive_load": 60.13, + "safety_score": 79.18, "tech_debt": 4.77, "verification": 57.49, "api_exposure": 0.0, "concurrency": 12.31, - "state_flux": 85.71, + "state_flux": 84.81, "dead_code": 9.02, "spec_match": 78.57, "stability": 42.86, @@ -455751,20 +455751,20 @@ } }, "matlab/eeglab": { - "Directory Group Magnitude": 4973.24, + "Directory Group Magnitude": 4928.24, "File Count": 7, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "85.7%", "Static: Literature & Documentation": "14.3%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "62.99%", - "Error & Exception Exposure": "80.36%", + "Cognitive Load Exposure": "60.13%", + "Error & Exception Exposure": "79.18%", "Tech Debt Exposure": "4.77%", "Testing Exposure": "57.49%", "API Exposure": "0.0%", "Concurrency Exposure": "12.31%", - "State Flux Exposure": "85.71%", + "State Flux Exposure": "84.81%", "Commented Logic Exposure": "9.02%", "Specification Exposure": "78.57%", "Instability Exposure": "42.86%", @@ -455786,9 +455786,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": -6581.0, - "Y": 172.11, - "Z": -5076.48 + "X": -6580.83, + "Y": 172.08, + "Z": -5076.53 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -455943,9 +455943,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6957.59, - "Y": 31.7, - "Z": -5531.66 + "X": -6957.0, + "Y": 31.77, + "Z": -5531.47 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -455957,7 +455957,7 @@ "Total LOC": 193, "Coding LOC": 115, "Documentation LOC": 61, - "Structural Magnitude": 214.7, + "Structural Magnitude": 208.7, "Control Flow Ratio": "58.2%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -455967,7 +455967,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "90.56%", - "Error & Exception Exposure": "98.96%", + "Error & Exception Exposure": "98.73%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -456014,7 +456014,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 130, + "State Mutations / Variable Reassignments": 124, "Commented-out Code (Dead Logic)": 1, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -456121,9 +456121,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6471.94, + "X": -6471.82, "Y": 134.89, - "Z": -5520.32 + "Z": -5520.21 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -456135,7 +456135,7 @@ "Total LOC": 2293, "Coding LOC": 1724, "Documentation LOC": 356, - "Structural Magnitude": 2033.98, + "Structural Magnitude": 2012.98, "Control Flow Ratio": "57.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -456145,7 +456145,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "76.43%", - "Error & Exception Exposure": "94.13%", + "Error & Exception Exposure": "93.82%", "Tech Debt Exposure": "11.04%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -456912,7 +456912,7 @@ "High-Risk Execution Commands": 3, "I/O and Network Boundaries": 7, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 1198, + "State Mutations / Variable Reassignments": 1177, "Commented-out Code (Dead Logic)": 9, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -457019,9 +457019,9 @@ "Identity Proof": "Ecosystem Consensus Lock (100% Local Dominance)" }, "2. Topological Coordinates": { - "X": -5990.57, - "Y": 121.05, - "Z": -5732.9 + "X": -5993.26, + "Y": 121.13, + "Z": -5731.02 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -457033,22 +457033,22 @@ "Total LOC": 15, "Coding LOC": 13, "Documentation LOC": 0, - "Structural Magnitude": 20.06, + "Structural Magnitude": 14.06, "Control Flow Ratio": "50.0%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.66 + "Raw Cognitive Density": 0.42 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "41.1%", - "Error & Exception Exposure": "78.78%", + "Cognitive Load Exposure": "21.08%", + "Error & Exception Exposure": "71.62%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.4%", "API Exposure": "0.0%", "Concurrency Exposure": "0.0%", - "State Flux Exposure": "99.94%", + "State Flux Exposure": "93.7%", "Commented Logic Exposure": "0.0%", "Specification Exposure": "100.0%", "Instability Exposure": "50.0%", @@ -457080,7 +457080,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 12, + "State Mutations / Variable Reassignments": 6, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -457187,9 +457187,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6180.09, - "Y": 256.87, - "Z": -5045.35 + "X": -6180.16, + "Y": 256.79, + "Z": -5045.49 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -457201,7 +457201,7 @@ "Total LOC": 432, "Coding LOC": 293, "Documentation LOC": 102, - "Structural Magnitude": 456.06, + "Structural Magnitude": 450.06, "Control Flow Ratio": "54.3%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -457211,7 +457211,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "79.44%", - "Error & Exception Exposure": "95.16%", + "Error & Exception Exposure": "94.75%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -457378,7 +457378,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 5, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 266, + "State Mutations / Variable Reassignments": 260, "Commented-out Code (Dead Logic)": 2, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -457485,8 +457485,8 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6795.32, - "Y": 143.2, + "X": -6795.08, + "Y": 143.19, "Z": -5269.21 }, "3. Architectural Profile": { @@ -457843,9 +457843,9 @@ "Identity Proof": "Single Indicator (Shebang)" }, "2. Topological Coordinates": { - "X": -6463.6, - "Y": -13.0, - "Z": -5896.42 + "X": -6463.51, + "Y": -12.94, + "Z": -5896.02 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -457857,7 +457857,7 @@ "Total LOC": 606, "Coding LOC": 382, "Documentation LOC": 175, - "Structural Magnitude": 552.64, + "Structural Magnitude": 546.64, "Control Flow Ratio": "61.2%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -457867,7 +457867,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "77.3%", - "Error & Exception Exposure": "97.29%", + "Error & Exception Exposure": "97.11%", "Tech Debt Exposure": "12.89%", "Testing Exposure": "80.0%", "API Exposure": "0.0%", @@ -458164,7 +458164,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 363, + "State Mutations / Variable Reassignments": 357, "Commented-out Code (Dead Logic)": 5, "Structured Documentation Blocks": 0, "Unit Test Assertions": 0, @@ -889222,9 +889222,9 @@ "Identity Proof": "Single Indicator (Ext: .proto)" }, "2. Topological Coordinates": { - "X": -7573.0, + "X": -7572.69, "Y": -160.84, - "Z": -5505.73 + "Z": -5505.48 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -889379,9 +889379,9 @@ "Identity Proof": "Single Indicator (Ext: .proto)" }, "2. Topological Coordinates": { - "X": -7350.18, + "X": -7349.88, "Y": -103.73, - "Z": -6239.27 + "Z": -6239.03 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -889536,9 +889536,9 @@ "Identity Proof": "Single Indicator (Ext: .proto)" }, "2. Topological Coordinates": { - "X": -7371.29, + "X": -7370.99, "Y": -123.93, - "Z": -5972.86 + "Z": -5972.62 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -899796,9 +899796,9 @@ "Identity Proof": "Ecosystem Consensus Lock (75% Local Dominance)" }, "2. Topological Coordinates": { - "X": -7244.26, + "X": -7243.87, "Y": 164.39, - "Z": -6711.97 + "Z": -6711.63 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902298,9 +902298,9 @@ "Identity Proof": "Metadata Anchor (COPYING)" }, "2. Topological Coordinates": { - "X": -6640.67, + "X": -6640.28, "Y": 98.47, - "Z": -6408.18 + "Z": -6407.8 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -902455,9 +902455,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6242.48, + "X": -6242.09, "Y": 101.11, - "Z": -6701.0 + "Z": -6700.62 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902623,9 +902623,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -7032.17, + "X": -7031.78, "Y": 78.48, - "Z": -6399.19 + "Z": -6398.81 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902780,9 +902780,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6788.68, + "X": -6788.29, "Y": 122.85, - "Z": -6132.76 + "Z": -6132.38 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -902937,9 +902937,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6387.13, + "X": -6386.74, "Y": 68.89, - "Z": -6164.09 + "Z": -6163.71 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -903094,9 +903094,9 @@ "Identity Proof": "Single Indicator (Ext: .css)" }, "2. Topological Coordinates": { - "X": -6612.69, + "X": -6612.3, "Y": 61.87, - "Z": -6727.7 + "Z": -6727.32 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -916514,9 +916514,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": -6937.49, + "X": -6937.11, "Y": 266.93, - "Z": -7013.79 + "Z": -7013.4 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -922851,9 +922851,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": -7628.46, + "X": -7628.16, "Y": -9.01, - "Z": -6239.64 + "Z": -6239.4 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation",