From 41dd511e983302f081c0b199eda0cb328d44a3a9 Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 1 Sep 2026 20:35:43 -0400 Subject: [PATCH 1/7] fix(swift): allow single-char module names in _dependency_capture (#2543) The capture group tail used [\w.]+ (requiring 2+ char module names), so `import a` captured nothing and the dependency edge was silently dropped from the DAG. Changed to [\w.]* to match other languages' capture shapes. Co-Authored-By: Claude Fable 5 --- gitgalaxy/standards/language_standards/languages/swift.py | 2 +- tests/extraction/languages/test_swift.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gitgalaxy/standards/language_standards/languages/swift.py b/gitgalaxy/standards/language_standards/languages/swift.py index 041005b83a..7618a01226 100644 --- a/gitgalaxy/standards/language_standards/languages/swift.py +++ b/gitgalaxy/standards/language_standards/languages/swift.py @@ -196,7 +196,7 @@ # 24. import (Dependency Inclusions) "import": re.compile(r"^[ \t]*(?:@_exported[ \t]+)?import\s+[a-zA-Z_]\w*", re.M), "_dependency_capture": re.compile( - r"^[ \t]*(?:@_exported[ \t]+)?import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([a-zA-Z_][\w.]+)", + r"^[ \t]*(?:@_exported[ \t]+)?import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([a-zA-Z_][\w.]*)", re.M, ), # 25. ownership (Authorship Metadata) diff --git a/tests/extraction/languages/test_swift.py b/tests/extraction/languages/test_swift.py index 37152785b3..9cdf7323ee 100644 --- a/tests/extraction/languages/test_swift.py +++ b/tests/extraction/languages/test_swift.py @@ -237,6 +237,7 @@ def test_swift_class_start_pathological(payload, expected_name): "valid": [ ("import Foundation", "Foundation"), ("@_exported import UIKit", "UIKit"), + ("import a", "a"), # #2543: single-char module name must still capture ], "invalid": [ "var importData = true", From 236e0ca0af545f65f95fc7dc81cd3f6c45c4139b Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 1 Sep 2026 20:36:32 -0400 Subject: [PATCH 2/7] fix(go): only count dot-imports as safety_bypasses (#2542) The import alternation in go's safety_bypasses rule made the dot optional (`\bimport\s+(?:\.[ \t]+)?"`), so every plain quoted import (`import "fmt"`) counted as a safety bypass, not just the namespace-polluting dot-import form (`import . "fmt"`). The dot is now mandatory (`\bimport\s+\.[ \t]+"`). Grouped imports (`import (\n . "pkg"\n)`) were never matched by this alternation before the fix (the `(` between `import` and the quoted path blocks the pattern) and still aren't after -- the change only removes the false positive on the single-line plain form. Co-Authored-By: Claude Fable 5 --- .../language_standards/languages/go.py | 10 ++++++- tests/extraction/languages/test_go_strict.py | 27 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/gitgalaxy/standards/language_standards/languages/go.py b/gitgalaxy/standards/language_standards/languages/go.py index d67840067e..3af964c763 100644 --- a/gitgalaxy/standards/language_standards/languages/go.py +++ b/gitgalaxy/standards/language_standards/languages/go.py @@ -103,7 +103,15 @@ ), # 7. safety_neg (Safety Bypasses / Unchecked Types) # Explicitly ignoring errors via blank identifier. - "safety_bypasses": re.compile(r'_\s*,\s*err[ \t]*=|_[ \t]*=\s*\w+|\bimport\s+(?:\.[ \t]+)?"'), + # BUG FIX (#2542): the import alternation made the dot OPTIONAL + # (`import\s+(?:\.[ \t]+)?"`), so EVERY plain quoted import + # (`import "fmt"`) counted as a safety bypass, not just the + # namespace-polluting dot-import form (`import . "fmt"`). The dot + # is now mandatory. Note this alternation only ever matched the + # single-line form either way: grouped imports (`import (\n...\n)`) + # have a `(` between `import` and the quoted path, which the + # pattern never crossed before and still doesn't. + "safety_bypasses": re.compile(r'_\s*,\s*err[ \t]*=|_[ \t]*=\s*\w+|\bimport\s+\.[ \t]+"'), # 8. danger (High-Risk Execution / System Calls) # Process-killing commands and direct syscalls. EXCLUDES TODO (debt) and fmt.Print (print_hits). "high_risk_execution": re.compile(r"\b(os\.Exit|syscall\.Kill|syscall\.RawSyscall|log\.Fatal(?:f|ln)?)\b"), diff --git a/tests/extraction/languages/test_go_strict.py b/tests/extraction/languages/test_go_strict.py index aeb08e5d8c..038e4d51f7 100644 --- a/tests/extraction/languages/test_go_strict.py +++ b/tests/extraction/languages/test_go_strict.py @@ -85,6 +85,7 @@ ('regex_execution', 'regexp.MustCompile(pattern)', 'regexp.Compiled = true'), ('safety', 'if err != nil {', 'err == nil'), ('safety_bypasses', '_, err = foo()', 'x, err = foo()'), + ('safety_bypasses', 'import . "fmt"', 'import "fmt"'), ('scientific', 'math.Sqrt(4)', 'foo.math()'), ('serialization_parsing', 'json.Unmarshal(data, &v)', 'json.Marshaled = true'), ('spec_exposure', '// [SPEC-123] implements the contract', '// spec sheet'), @@ -292,6 +293,32 @@ def test_go_ambiguity_sweep_shared_literals_are_not_bugs(): assert casts.search("uintptr(p)") and pointers.search("uintptr(p)") +def test_go_safety_bypasses_dot_import_only_regression(): + """ + Regression test (#2542): the import alternation made the dot OPTIONAL + (`import\\s+(?:\\.[ \\t]+)?"`), so EVERY plain quoted import + (`import "fmt"`) counted as a safety bypass -- Go's completely normal, + idiomatic import form -- not just the namespace-polluting dot-import + (`import . "fmt"`). The dot is now mandatory. + + Grouped imports are documented, not changed, by the fix: the `(` between + `import` and the quoted path means this alternation never matched any + line of a grouped block (dot-prefixed or not) before the fix, and still + doesn't after -- the fix only removes the false positive on the + single-line plain form. + """ + pattern = GO_RULES["safety_bypasses"] + + assert len(pattern.findall('import . "fmt"')) == 1, "dot-import must count exactly one safety bypass" + assert not pattern.search('import "fmt"'), "a plain quoted import is not a safety bypass" + assert not pattern.search('import f "fmt"'), "an aliased import is not a safety bypass" + assert pattern.search('import .\t"unsafe"'), "tab-separated dot-import must still match" + + # Grouped forms: never matched by this alternation, before or after. + assert not pattern.search('import (\n\t"fmt"\n\t"os"\n)') + assert not pattern.search('import (\n\t. "fmt"\n)') + + def test_go_test_vs_regex_execution_no_false_collision(): """ Known ambiguity pattern from the issue template (TypeScript's From 54ba907787a132b4cb1d72d1a9e826b1c4b30515 Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 1 Sep 2026 20:39:20 -0400 Subject: [PATCH 3/7] fix(php): stop counting open/close tags as branch (#2541) The branch rule's bare ternary `\?` alternation matched the `?` inside PHP's own tag syntax, so every PHP file recorded branch >= 1 from its ``). Guard the `?` alternations with tag-shape exclusions: `(?)` blocks a `?` directly before `>` (the close tag). Real ternary `?`/`?:` and null-coalescing `??`/`??=` still count exactly once -- no valid PHP operator use of `?` sits immediately after `<` or before `>`. Co-Authored-By: Claude Fable 5 --- .../language_standards/languages/php.py | 11 +++++- tests/extraction/languages/test_php_strict.py | 35 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/gitgalaxy/standards/language_standards/languages/php.py b/gitgalaxy/standards/language_standards/languages/php.py index d26ce43ed8..02aadd6775 100644 --- a/gitgalaxy/standards/language_standards/languages/php.py +++ b/gitgalaxy/standards/language_standards/languages/php.py @@ -63,8 +63,17 @@ # --- PHASE 1: LOGIC TOPOLOGY & STRUCTURE --- # 1. branch (Control Flow / Branching) # Control flow. Includes modern match expression. EXCLUDES throw (bailout_hits). + # BUG FIX (#2541): the bare ternary `\?` alternation matched the `?` + # inside PHP's own tag syntax -- `` + # -- so every PHP file recorded branch >= 1 from its open tag alone. + # Excluded via tag-shape guards on the `?` alternations: `(?)` blocks a `?` directly before `>` (the + # close tag). Real ternaries (`$a ? $b : $c`, Elvis `?:`) and + # null-coalescing `??`/`??=` are unaffected: no valid PHP operator + # use of `?` sits immediately after `<` or immediately before `>`. "branch": re.compile( - r"(?)(?)(?)" ), # 2. args (Parameters / Coupling) # Signatures for functions and arrow functions. Bounded to prevent ReDoS. diff --git a/tests/extraction/languages/test_php_strict.py b/tests/extraction/languages/test_php_strict.py index 35aad99992..41127e13bc 100644 --- a/tests/extraction/languages/test_php_strict.py +++ b/tests/extraction/languages/test_php_strict.py @@ -116,6 +116,12 @@ def test_php_state_mutation_redos_immunity(): ("branch", "$x = $y ?? $z;", "Foo::if();"), ("branch", "$x = $y ? $z : $w;", "$while = 2;"), ("branch", "match ($x) {", "$match = 1;"), + # #2541: PHP's own tag syntax must not count as a branch -- the bare + # ternary `\?` alternation used to match the `?` in ``. + ("branch", "$x = $y ?: $w;", ""), + ("branch", "", ""), # args ("args", 'function foo($a = ")\\"") {', "foo($a = array(1,2));"), @@ -189,6 +195,35 @@ def test_php_globals_superglobals_leading_boundary_regression(): assert pattern.search('$GLOBALS["x"]') +def test_php_branch_open_close_tags_not_counted_regression(): + """ + Regression test (#2541): every PHP file recorded branch >= 1 from its own + `` close tags and `")) == 0, "close tag still counts as a branch" + + # Short-echo tag: the tag itself must not count... + assert len(pattern.findall("")) == 0, "short-echo tag still counts as a branch" + # ...but a real ?? inside one still counts exactly once. + assert len(pattern.findall("")) == 1 + + # Real operators are unaffected, each counted exactly once. + assert len(pattern.findall("$x = $y ? $z : $w;")) == 1 # ternary + assert len(pattern.findall("$x = $y ?: $w;")) == 1 # Elvis + assert len(pattern.findall("$x = $y ?? $z;")) == 1 # null coalescing + assert len(pattern.findall("$x ??= $y;")) == 1 # null-coalescing assignment + + def test_php_safety_bypasses_at_operator_on_variable_regression(): """ Regression test: the `@` error-suppression check required the next From d0ea9c40829621a6bfe60eb4731bb1a345659acb Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 1 Sep 2026 20:40:38 -0400 Subject: [PATCH 4/7] fix(javascript): exclude 'with' statement from func_start/args (#2539) Sloppy-mode `with (shape) {` has the exact `keyword (...) {` shape the class-method branches of javascript's func_start and args rules match, and `with` was missing from both branches' control-flow exclusion lists (if|for|while|switch|catch|return) -- so every with-statement was counted as a function/method named `with`. - javascript: `with` added to both exclusion alternations (plain unconditional add, matching how those lists already treat catch). - typescript: duplicates the rules with its own lists, so it gets the same fix -- but as a CONDITIONAL exclusion (only the spaced statement shape `with (...)`, per the #2276 catch/return/throw precedent), because `with` is a real method name in modern code (Array.prototype.with ES2023, Temporal's .with() in .d.ts files) that formatters always emit with zero space before the paren. - Audited the other block-statement keywords per the issue: `do` cannot be caught the same way (`do {` puts no parens between keyword and block); if/for/while/switch/catch were already excluded. `with` was the only offender. Co-Authored-By: Claude Fable 5 --- .../languages/javascript.py | 15 +++++--- .../languages/typescript.py | 18 ++++++++-- tests/extraction/languages/test_javascript.py | 34 +++++++++++++++++++ tests/extraction/languages/test_typescript.py | 31 +++++++++++++++++ 4 files changed, 91 insertions(+), 7 deletions(-) diff --git a/gitgalaxy/standards/language_standards/languages/javascript.py b/gitgalaxy/standards/language_standards/languages/javascript.py index a180bffea6..7552edcdb1 100644 --- a/gitgalaxy/standards/language_standards/languages/javascript.py +++ b/gitgalaxy/standards/language_standards/languages/javascript.py @@ -83,8 +83,11 @@ # FIX 1 (Invocation Shield): Injected `(?=[ \t\n]*\{)` at the end of the class # method branch, demanding structural proof that the signature opens a logic block. # FIX 2 (Control Flow Shield): `while (i < 10) {` structurally mimics a method. - # Injected `(?!(?:if|for|while|switch|catch|return)\b)` to prevent reserve words - # from being mapped as method names. + # Injected `(?!(?:if|for|while|switch|catch|return|with)\b)` to prevent reserve words + # from being mapped as method names. (#2539: `with (shape) {` -- sloppy-mode + # statement syntax, same `keyword (...) {` shape -- was missing from the list + # and counted as a method named `with`. `do` needs no entry: `do {` has no + # parens between keyword and block, so this branch can't match it.) # FIX 3 (Quadratic Blowup Shield): The arrow-function branch's identifier # match used an unbounded `[\w$]*`. On a long line with no `=>` at all # (e.g. a single massive minified/obfuscated line), the engine retried the @@ -117,7 +120,7 @@ r"(?:" r"\b(?:async[ \t\n]+)?function[ \t\n]*\*?[ \t\n]*(\w*)[ \t\n]*(\([^)]*\))|" r"(\([^)]*\)|[a-zA-Z_$][\w$]{0,100})[ \t\n]*=>|" - r"^[ \t]*(?:static[ \t\n]+)?(?:async[ \t\n]+)?(?:get[ \t\n]+|set[ \t\n]+)?\*?(?!(?:if|for|while|switch|catch|return)\b)(#?[a-zA-Z_$][\w$]*)[ \t\n]*(\([^)]*\))(?=[ \t\n]*\{)" + r"^[ \t]*(?:static[ \t\n]+)?(?:async[ \t\n]+)?(?:get[ \t\n]+|set[ \t\n]+)?\*?(?!(?:if|for|while|switch|catch|return|with)\b)(#?[a-zA-Z_$][\w$]*)[ \t\n]*(\([^)]*\))(?=[ \t\n]*\{)" r")", re.M, ), @@ -174,7 +177,11 @@ # working the same as before; only a bare statement with # neither `{` nor `=>` anywhere (e.g. `next();`) is newly # rejected. - r"^[ \t]*(?:static[ \t\n]+)?(?:async[ \t\n]+)?(?:get\s+|set\s+)?\*?(?!(?:if|for|while|switch|catch|return|throw|new|typeof|jQuery|function)\b|\$)#?[a-zA-Z_$][\w$]*(?=[ \t\n]*\([^)(]*\)[ \t\n]*(?::[^{=;]+)?[ \t\n]*(?:=>[ \t\n]*)?\{)" + # #2539: `with` added to the exclusion -- `with (shape) {` (sloppy-mode + # statement) has the exact `keyword (...) {` shape this branch matches, + # so it was counted as a method named `with`. `do` can't be caught the + # same way (`do {` has no parens), so it needs no entry. + r"^[ \t]*(?:static[ \t\n]+)?(?:async[ \t\n]+)?(?:get\s+|set\s+)?\*?(?!(?:if|for|while|switch|catch|return|throw|new|typeof|jQuery|function|with)\b|\$)#?[a-zA-Z_$][\w$]*(?=[ \t\n]*\([^)(]*\)[ \t\n]*(?::[^{=;]+)?[ \t\n]*(?:=>[ \t\n]*)?\{)" r")", re.M, ), diff --git a/gitgalaxy/standards/language_standards/languages/typescript.py b/gitgalaxy/standards/language_standards/languages/typescript.py index 30d94b12ef..7611d4aceb 100644 --- a/gitgalaxy/standards/language_standards/languages/typescript.py +++ b/gitgalaxy/standards/language_standards/languages/typescript.py @@ -84,7 +84,13 @@ r"function\s+(\w*)(?:[ \t\n]{0,50}<(?:[^<>]|<[^<>]*>)*>)?[ \t\n]{0,50}(\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\))|" r"(\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\))[^=;{]*=>|" r"([a-zA-Z_$][\w$]{0,100})[ \t]*=>|" - r"^[ \t]*(?:(?:public|private|protected|static|override|abstract|readonly)[ \t]+){0,4}(?:async[ \t]+)?(?:\*[ \t]*)?(?:get\s+|set[ \t]+)?(?!(?:if|for|while|switch|catch|return|throw|new|typeof|yield|await|void)\b)(\[[^\]]+\]|[#]?[a-zA-Z_$][\w$]*)(?:[ \t\n]{0,50}<(?:[^<>]|<[^<>]*>)*>)?[ \t\n]{0,50}(\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\))", + # #2539: `with` excluded CONDITIONALLY (only when followed by whitespace + # then `(` -- the `with (shape) {` statement shape) rather than added to + # the unconditional keyword list: `with` is a real, prominent method name + # in modern code (`Array.prototype.with` ES2023, Temporal's `.with()`), + # and formatters never put a space before a method definition's paren -- + # same discriminator func_start's #2276 catch/return/throw fix uses. + r"^[ \t]*(?:(?:public|private|protected|static|override|abstract|readonly)[ \t]+){0,4}(?:async[ \t]+)?(?:\*[ \t]*)?(?:get\s+|set[ \t]+)?(?!(?:if|for|while|switch|catch|return|throw|new|typeof|yield|await|void)\b|with\b[ \t\n]+\()(\[[^\]]+\]|[#]?[a-zA-Z_$][\w$]*)(?:[ \t\n]{0,50}<(?:[^<>]|<[^<>]*>)*>)?[ \t\n]{0,50}(\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\))", re.M, ), # 3. linear (Sequential Boundaries) @@ -338,7 +344,12 @@ # testing that `} catch (e) {` still correctly does NOT # match, while `catch(...)` and # `return: () => {...}` now do. - r"(?!(?:class|interface|enum|if|for|while|switch|new|typeof|jQuery|function|yield|await|void)\b|type\b(?![ \t\n]*\()|\$|(?:catch|return|throw)\b[ \t\n]+(?:\(|<))(\[[^\]]+\]|[#]?[a-zA-Z_$][\w$]*)(?=\??[ \t\n]{0,50}(?:<(?:[^<>]|<[^<>]*>)*>)?[ \t\n]{0,50}\()" + # #2539: `with` joined the CONDITIONAL exclusion group -- `with (shape) {` + # (a statement, always spaced) must not count as a method, but a real + # method/signature named `with` (`Array.prototype.with` ES2023, + # Temporal's `.with()` -- ubiquitous in `.d.ts`) never has that space, + # exactly the discriminator this group already relies on. + r"(?!(?:class|interface|enum|if|for|while|switch|new|typeof|jQuery|function|yield|await|void)\b|type\b(?![ \t\n]*\()|\$|(?:catch|return|throw|with)\b[ \t\n]+(?:\(|<))(\[[^\]]+\]|[#]?[a-zA-Z_$][\w$]*)(?=\??[ \t\n]{0,50}(?:<(?:[^<>]|<[^<>]*>)*>)?[ \t\n]{0,50}\()" r"|" # BUG FIX (R3): The arrow-value (Branch 5 / standalone value) branch # is known to fail on mid-statement function values (e.g. `const a = b || () => {}`) @@ -418,7 +429,8 @@ # `[^<>=]` vs `<`), so still linear (Rule 11). The mandatory # `:Type;` / `{` terminator below keeps a bare generic call # statement (`useCallback<() => void>(cb);`) from matching. - r"(?:^[ \t]*|(?<=[,{])[ \t\n]*)(?!(?:class|interface|enum|if|for|while|switch|new|typeof|jQuery|function|yield|await|void|constructor)\b|type\b(?![ \t\n]*\()|\$|(?:catch|return|throw)\b[ \t\n]+(?:\(|<))(\[[^\]]+\]|[#]?[a-zA-Z_$][\w$]*)(?=\??[ \t\n]{0,50}(?:<(?:=>|=(?!>)|[^<>=]|<(?:=>|=(?!>)|[^<>=])*>)*>)?[ \t\n]{0,50}\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\)[ \t\n]{0,50}(?:(?::[^{;]{0,200})?[ \t\n]{0,50}(?:=>[ \t\n]{0,50})?\{|:[^{;]{0,200}[ \t\n]{0,50};))" + # #2539: same conditional `with` exclusion as Branch A -- see its comment. + r"(?:^[ \t]*|(?<=[,{])[ \t\n]*)(?!(?:class|interface|enum|if|for|while|switch|new|typeof|jQuery|function|yield|await|void|constructor)\b|type\b(?![ \t\n]*\()|\$|(?:catch|return|throw|with)\b[ \t\n]+(?:\(|<))(\[[^\]]+\]|[#]?[a-zA-Z_$][\w$]*)(?=\??[ \t\n]{0,50}(?:<(?:=>|=(?!>)|[^<>=]|<(?:=>|=(?!>)|[^<>=])*>)*>)?[ \t\n]{0,50}\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\)[ \t\n]{0,50}(?:(?::[^{;]{0,200})?[ \t\n]{0,50}(?:=>[ \t\n]{0,50})?\{|:[^{;]{0,200}[ \t\n]{0,50};))" r")", re.M, ), diff --git a/tests/extraction/languages/test_javascript.py b/tests/extraction/languages/test_javascript.py index 0e364f9cf0..33fa408aa1 100644 --- a/tests/extraction/languages/test_javascript.py +++ b/tests/extraction/languages/test_javascript.py @@ -80,6 +80,8 @@ "typeof TargetFunc", # typeof lookalike "if ((TargetFunc = compute()) !== null) {", # assignment-in-condition lookalike "class Foo {\n [Symbol.iterator]() {}\n}", # computed method name, out of scope + "with (shape) {", # #2539: sloppy-mode with-statement lookalike + " with (document.forms[0]) {", # #2539: indented with-statement ], "pathological": [ ( @@ -181,6 +183,37 @@ def test_javascript_func_start_bare_call_site_identifier_no_longer_matches(): assert not func_start.search(swap_block), "the inline function in the arguments prevents match" +def test_javascript_with_statement_not_counted_as_function_regression(): + """ + Regression test for issue #2539: the sloppy-mode `with (shape) {` + statement has the exact `keyword (...) {` shape func_start's and args' + class-method branches match, and `with` was missing from both branches' + control-flow exclusion lists (`if|for|while|switch|catch|return`), so + every with-statement was counted as a function/method named `with`. + + Also documents the #2539 audit of the OTHER block-statement keywords: + `do` cannot be caught the same way (`do {` puts no parens between the + keyword and the block, and its trailing `while (cond);` is already + excluded), and if/for/while/switch/catch were already in both lists -- + `with` was the only offender. + """ + func_start = JS_RULES["func_start"] + args = JS_RULES["args"] + with_block = "function render(shape) {\n with (shape) {\n draw(x, y);\n }\n}" + + for match in func_start.finditer(with_block): + assert "with" not in match.group(0), f"with-statement counted as func_start: {match.group(0)!r}" + assert func_start.search(with_block), "sanity: the real enclosing function must still count" + + assert not args.search("with (shape) {"), "with-statement counted as args" + assert args.search("function render(shape) {"), "sanity: a real signature's args must still count" + + # `do { ... } while (cond);` -- verified NOT catchable by this bug class. + do_block = "do {\n poll();\n} while (pending);" + assert not func_start.search(do_block), "do/while must not count as func_start" + assert not args.search(do_block), "do/while must not count as args" + + def test_javascript_func_start_string_literal_lookalike_still_matches_at_regex_level(): """ Documents a known, NOT-fixed limitation: func_start's own regex has no @@ -221,6 +254,7 @@ def test_javascript_func_start_string_literal_lookalike_still_matches_at_regex_l "invalid": [ "TargetFunc(req, res)", "while (i < 10) {", + "with (shape) {", # #2539: sloppy-mode with-statement lookalike ], "pathological": [ ( diff --git a/tests/extraction/languages/test_typescript.py b/tests/extraction/languages/test_typescript.py index 242ec3213b..dd9893ca2a 100644 --- a/tests/extraction/languages/test_typescript.py +++ b/tests/extraction/languages/test_typescript.py @@ -101,6 +101,7 @@ "class Foo {\n @Input() TargetFunc: string;\n}", # decorated field, not a method "type TargetFunc = () => void;", "if (this.TargetFunc as unknown as boolean) {", + "with (shape) {", # #2539: with-statement lookalike (invalid TS, but real in misrouted JS-ish text) # NOTE: string-literal lookalikes (`let query = "function Foo() {";`) are # NOT tested here as an invalid case -- func_start's own regex has no # way to know it's inside a string (that's Prism's/detector.py's job). @@ -269,6 +270,7 @@ def test_typescript_func_start_known_limitation_generic_nesting_beyond_one_level "invalid": [ "return TargetFunc(val);", "catch (e: any) {", + "with (shape) {", # #2539: with-statement lookalike (statement shape: space before paren) ], "pathological": [ ( @@ -313,6 +315,35 @@ def test_typescript_args_pathological(payload, expected_name): assert_pathological_match(TS_RULES["args"], payload, expected_name, "typescript.args") +def test_typescript_with_statement_excluded_but_with_method_still_counts_regression(): + """ + Regression test for issue #2539 (TypeScript side). TypeScript duplicates + javascript's func_start/args class-method branches with its own exclusion + lists, and `with` was missing from both. Unlike javascript's plain + exclusion-list add, `with` here joins the CONDITIONAL exclusion group + (#2276 precedent: excluded only in the spaced statement shape + `with (...)`), because `with` is a real, prominent method name in modern + code (`Array.prototype.with` ES2023, Temporal's `.with()` -- ubiquitous + in `.d.ts` files) that formatters always emit with zero space before the + paren -- an unconditional exclusion would have permanently hidden those. + """ + func_start = TS_RULES["func_start"] + args = TS_RULES["args"] + + # Statement shape (space before paren) must NOT count. + assert not func_start.search("with (shape) {"), "with-statement counted as func_start" + assert not args.search("with (shape) {"), "with-statement counted as args" + + # Real `with` members (zero space, per every formatter) must STILL count. + m = func_start.search("class Wrapper {\n with(index: number, value: T): Wrapper {\n") + assert m, "a real method named `with` must still count as func_start" + dts = "interface PlainDate {\n with(dateLike: PlainDateLike): PlainDate;\n}" + assert func_start.search(dts), "a bodyless `.d.ts` signature named `with` must still count" + assert args.search(" with(index: number, value: T): Wrapper {"), ( + "a real method named `with` must still count for args" + ) + + def test_typescript_args_known_limitation_bare_call_at_line_start(): """ Same fundamental ambiguity as func_start's own known-limitation test From 8d37126be145ce5c554e371876fbf2ed355e5a61 Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 1 Sep 2026 20:45:24 -0400 Subject: [PATCH 5/7] fix(dag): case-fold dependency lookup for case-insensitive languages (#2540) Fortran resolves module references case-insensitively, so legacy-style `USE A` never matched `a.f90` in the dependency DAG's exact-case suffix-hash-map lookup: popularity stayed 0 and the orphan->api conversion never fired. Haskell (`import A` vs a.hs -- module names are necessarily capitalized) and cobol (`COPY A.` vs a.cpy) lost their DAGs the same way. Design: a per-language "case_insensitive_imports" flag on the language DEFINITION dicts (fortran, cobol, haskell), plus a lowercase-keyed folded view of the resolution map in network_risk_sensor.py. The fold is a Stage 1c fallback consulted only when both exact-case stages miss AND the importing file's language declares the flag -- exact-case matches always win first, and case-sensitive languages (python et al.) never gain cross-case resolution. Stage 2 ambiguity disambiguation compares case-folded only for folded hits. Applied uniformly to build_dependency_graph, _fallback_build_graph (zero-dependency mode), and extract_test_coverage_mapping. Co-Authored-By: Claude Fable 5 --- gitgalaxy/core/network_risk_sensor.py | 83 +++++++- .../language_standards/languages/cobol.py | 4 + .../language_standards/languages/fortran.py | 6 + .../language_standards/languages/haskell.py | 7 + .../test_network_risk_sensor.py | 188 ++++++++++++++++++ 5 files changed, 281 insertions(+), 7 deletions(-) diff --git a/gitgalaxy/core/network_risk_sensor.py b/gitgalaxy/core/network_risk_sensor.py index 39385be5c7..2c39852d65 100644 --- a/gitgalaxy/core/network_risk_sensor.py +++ b/gitgalaxy/core/network_risk_sensor.py @@ -9,6 +9,16 @@ from typing import Any, Optional from gitgalaxy.standards.analysis_lens import RECORDING_SCHEMAS +from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS + +# #2540: languages whose import/module references resolve case-insensitively +# (fortran `USE A` binds a.f90, cobol `COPY A.` binds a.cpy, haskell's +# necessarily-capitalized `import A` may live in a.hs). Declared per-language +# via the "case_insensitive_imports" flag on each language DEFINITION; +# resolution for every other language stays strictly case-sensitive. +CASE_INSENSITIVE_IMPORT_LANGS = frozenset( + lang_id for lang_id, definition in LANGUAGE_DEFINITIONS.items() if definition.get("case_insensitive_imports") +) HAS_NETWORKX = False try: @@ -57,12 +67,40 @@ def _build_resolution_map(self, files: list[dict[str, Any]]) -> dict[str, list[s return resolution_map - def _resolve_target(self, target_token: str, resolution_map: dict[str, list[str]], curr_path: str) -> Optional[str]: + def _build_folded_resolution_map(self, resolution_map: dict[str, list[str]]) -> dict[str, list[str]]: + """ + #2540: derives a lowercase-keyed view of the resolution map so + imports from case-insensitive-resolution languages (fortran, cobol, + haskell — see CASE_INSENSITIVE_IMPORT_LANGS) can fall back to a + case-folded lookup. Kept separate from the exact-case map so + case-sensitive languages never gain cross-case resolution, and so + exact-case matches always win first even for the folding languages. + """ + folded_map: dict[str, list[str]] = defaultdict(list) + for key, paths in resolution_map.items(): + folded_map[key.lower()].extend(paths) + return folded_map + + def _resolve_target( + self, + target_token: str, + resolution_map: dict[str, list[str]], + curr_path: str, + folded_map: Optional[dict[str, list[str]]] = None, + fold: bool = False, + ) -> Optional[str]: """ Resolves an import token to a single file path, refusing to guess when genuinely ambiguous rather than silently misattributing an edge. + + When `fold` is True (the importing file's language resolves imports + case-insensitively, #2540) and no exact-case key matches, the lookup + retries against `folded_map` with a lowercased token. Exact matches + always win first, so mixed-case repos keep their precise edges. """ token_as_path = target_token.replace(".", "/").replace("\\", "/") + bare_component = token_as_path.rsplit("/", 1)[-1] + folded_hit = False # Stage 1: direct key lookup — handles full-path, bare-filename, and # bare-stem tokens that match a stored key exactly. @@ -74,9 +112,18 @@ def _resolve_target(self, target_token: str, resolution_map: dict[str, list[str] # token's final path component so there's something to disambiguate # against in Stage 2. if not candidates: - bare_component = token_as_path.rsplit("/", 1)[-1] candidates = resolution_map.get(bare_component) + # Stage 1c (#2540): case-insensitive-resolution languages retry the + # same two lookups case-folded, only after both exact-case stages + # miss — fortran `USE A` -> a.f90, cobol `COPY A.` -> a.cpy, + # haskell `import A` -> a.hs. + if not candidates and fold and folded_map is not None: + folded_hit = True + candidates = folded_map.get(target_token.lower()) + if not candidates: + candidates = folded_map.get(bare_component.lower()) + if not candidates: return None @@ -86,9 +133,17 @@ def _resolve_target(self, target_token: str, resolution_map: dict[str, list[str] # Stage 2: multiple files share this name/stem — disambiguate using # any path context already present in the token, comparing against - # each candidate's path with its extension stripped. + # each candidate's path with its extension stripped. A case-folded + # hit compares case-folded here too, for consistency with Stage 1c. + cmp_token = token_as_path.lower() if folded_hit else token_as_path path_matches = [ - c for c in candidates if str(Path(c).with_suffix("")).replace("\\", "/").endswith(token_as_path) + c + for c in candidates + if ( + str(Path(c).with_suffix("")).replace("\\", "/").lower() + if folded_hit + else str(Path(c).with_suffix("")).replace("\\", "/") + ).endswith(cmp_token) ] if len(path_matches) == 1: return path_matches[0] @@ -100,6 +155,11 @@ def _resolve_target(self, target_token: str, resolution_map: dict[str, list[str] ) return None + @staticmethod + def _folds_case(f: dict[str, Any]) -> bool: + """#2540: does this file's language resolve import targets case-insensitively?""" + return str(f.get("lang_id", "")).lower() in CASE_INSENSITIVE_IMPORT_LANGS + def extract_test_coverage_mapping(self, files: list[dict[str, Any]]) -> dict[str, dict[str, list[dict[str, Any]]]]: """ Maps function calls from test files to their imported production targets. @@ -111,6 +171,7 @@ def extract_test_coverage_mapping(self, files: list[dict[str, Any]]) -> dict[str """ coverage_map: dict[str, dict[str, list[dict[str, Any]]]] = {} resolution_map = self._build_resolution_map(files) + folded_map = self._build_folded_resolution_map(resolution_map) # 2. Identify Test Files and extract their outgoing invocations for f in files: @@ -126,7 +187,9 @@ def extract_test_coverage_mapping(self, files: list[dict[str, Any]]) -> dict[str target_paths = set() for imp in f.get("raw_imports", []): target_token = imp[0] if isinstance(imp, tuple) and len(imp) == 2 else imp - target_path = self._resolve_target(target_token, resolution_map, path) + target_path = self._resolve_target( + target_token, resolution_map, path, folded_map=folded_map, fold=self._folds_case(f) + ) if target_path and target_path != path: target_paths.add(target_path) @@ -174,6 +237,7 @@ def build_dependency_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[li # 1. Build the Resolution Map (Fast Path Lookup) resolution_map = self._build_resolution_map(parsed_files) + folded_map = self._build_folded_resolution_map(resolution_map) for f in parsed_files: path = f.get("path", "") @@ -196,7 +260,9 @@ def build_dependency_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[li target_token = imp entity = None - target_path = self._resolve_target(target_token, resolution_map, curr_path) + target_path = self._resolve_target( + target_token, resolution_map, curr_path, folded_map=folded_map, fold=self._folds_case(f) + ) if target_path and target_path != curr_path: # Edge weight can be increased if specific entities are highly coupled weight = 1.5 if entity else 1.0 @@ -382,6 +448,7 @@ def _fallback_build_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[lis ) resolution_map = self._build_resolution_map(parsed_files) + folded_map = self._build_folded_resolution_map(resolution_map) in_degrees = {f.get("path", ""): 0 for f in parsed_files} out_degrees = {f.get("path", ""): 0 for f in parsed_files} @@ -390,7 +457,9 @@ def _fallback_build_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[lis curr_path = f.get("path", "") for imp in f.get("raw_imports", []): target_token = imp[0] if isinstance(imp, tuple) and len(imp) == 2 else imp - target_path = self._resolve_target(target_token, resolution_map, curr_path) + target_path = self._resolve_target( + target_token, resolution_map, curr_path, folded_map=folded_map, fold=self._folds_case(f) + ) if target_path and target_path != curr_path: out_degrees[curr_path] = out_degrees.get(curr_path, 0) + 1 in_degrees[target_path] = in_degrees.get(target_path, 0) + 1 diff --git a/gitgalaxy/standards/language_standards/languages/cobol.py b/gitgalaxy/standards/language_standards/languages/cobol.py index 1059a15b0b..6bc56d112c 100644 --- a/gitgalaxy/standards/language_standards/languages/cobol.py +++ b/gitgalaxy/standards/language_standards/languages/cobol.py @@ -32,6 +32,10 @@ # Rationale: Strictly fixed-format. The engine must monitor Column 7 for an asterisk '*' # or slash '/' to identify line-level Commented / Non-Executable Text. "lexical_family": "positional_anchored", + # #2540: COBOL copybook names are case-insensitive (`COPY A.` binds the + # same copybook as `copy a.`), so the dependency DAG's import-token -> + # file lookup (network_risk_sensor.py) case-folds for this language. + "case_insensitive_imports": True, "rules": { # --- PHASE 1: LOGIC TOPOLOGY & STRUCTURE --- # 1. branch: Entscheidungslogik. Control flow that splits execution paths. diff --git a/gitgalaxy/standards/language_standards/languages/fortran.py b/gitgalaxy/standards/language_standards/languages/fortran.py index 4f6fbadbd6..055a055363 100644 --- a/gitgalaxy/standards/language_standards/languages/fortran.py +++ b/gitgalaxy/standards/language_standards/languages/fortran.py @@ -50,6 +50,12 @@ # UPGRADED: Maps to Family 7 (The Positional Ancients) # Rationale: Fixed-format requires Column 1 monitoring ('C' or '*'); Free-format uses '!'. "lexical_family": "positional_anchored", + # #2540: Fortran resolves module names case-insensitively (`USE A` and + # `use a` both bind module a). The dependency DAG's import-token -> + # file lookup (network_risk_sensor.py) must case-fold for this + # language or uppercase legacy style (`USE A`) never resolves to + # `a.f90` and the whole import chain goes invisible. + "case_insensitive_imports": True, "rules": { # --- PHASE 1: LOGIC TOPOLOGY & STRUCTURE --- # 1. branch (Control Flow / Branching) diff --git a/gitgalaxy/standards/language_standards/languages/haskell.py b/gitgalaxy/standards/language_standards/languages/haskell.py index ed41ae0c6e..b3011471f5 100644 --- a/gitgalaxy/standards/language_standards/languages/haskell.py +++ b/gitgalaxy/standards/language_standards/languages/haskell.py @@ -38,6 +38,13 @@ # (standard_block never used the `--`/`{-`/`-}` tokens). # Rationale: Uses '--' for lines and '{- -}' for blocks, which strictly supports recursive nesting. "lexical_family": "recursive_block_haskell", + # #2540: Haskell module names are necessarily capitalized (`import A`), + # while on-disk file names may not match that casing exactly -- exact-case + # lookup makes `import A` miss `a.hs` and the whole DAG for the repo goes + # invisible. The dependency DAG's import-token -> file lookup + # (network_risk_sensor.py) case-folds for this language; exact-case + # matches still win first. + "case_insensitive_imports": True, "rules": { # --- PHASE 1: LOGIC TOPOLOGY & STRUCTURE --- # branch: decisions that split flow. Includes guards (|) and modern \cases. diff --git a/tests/security_auditing/test_network_risk_sensor.py b/tests/security_auditing/test_network_risk_sensor.py index 9e96f004c7..7e0e880aed 100644 --- a/tests/security_auditing/test_network_risk_sensor.py +++ b/tests/security_auditing/test_network_risk_sensor.py @@ -522,3 +522,191 @@ def test_resolve_target_returns_none_for_external_package_import(sensor): resolution_map = sensor._build_resolution_map([{"path": "/src/real.py", "raw_imports": []}]) assert sensor._resolve_target("numpy", resolution_map, "/src/real.py") is None assert sensor._resolve_target("some.deeply.nested.external.pkg", resolution_map, "/src/real.py") is None + + +# ============================================================================== +# MOCK: CASE-INSENSITIVE IMPORT RESOLUTION (Regression tests for #2540) +# ============================================================================== +# Fortran, COBOL, and Haskell resolve import/module references +# case-insensitively (or with mandatory casing that need not match the file +# name on disk). With dominant legacy style (`USE A`, `COPY A.`, `import A`) +# an exact-case lookup misses `a.f90`/`a.cpy`/`a.hs` entirely: popularity +# stays 0 and the orphan->api conversion never fires. The resolver must +# case-fold the lookup for these languages ONLY -- case-sensitive languages +# (e.g. python) must never gain cross-case resolution. + +CASE_FOLD_FILES = [ + { + "path": "/src/orbit_math.f90", + "lang_id": "fortran", + "raw_imports": [], + }, + { + "path": "/src/main.f90", + "lang_id": "fortran", + # `USE ORBIT_MATH` -- _dependency_capture yields the module name + # verbatim, uppercase, while the module lives in lowercase + # orbit_math.f90. + "raw_imports": ["ORBIT_MATH"], + }, + { + "path": "/hs/parser.hs", + "lang_id": "haskell", + "raw_imports": [], + }, + { + "path": "/hs/Main.hs", + "lang_id": "haskell", + # Haskell module names are necessarily capitalized: `import Parser`. + "raw_imports": ["Parser"], + }, + { + "path": "/cbl/payroll.cpy", + "lang_id": "cobol", + "raw_imports": [], + }, + { + "path": "/cbl/prog.cbl", + "lang_id": "cobol", + # `COPY PAYROLL.` -- _dependency_capture yields "PAYROLL". + "raw_imports": ["PAYROLL"], + }, +] + + +@pytest.fixture +def case_fold_universe(): + """Returns a fresh copy of the case-insensitive-language mock universe.""" + return copy.deepcopy(CASE_FOLD_FILES) + + +# ============================================================================== +# TEST 15: CASE-FOLDED RESOLUTION FOR CASE-INSENSITIVE LANGUAGES (#2540) +# ============================================================================== +@pytest.mark.skipif(not HAS_NETWORKX, reason="Requires NetworkX") +def test_network_fortran_uppercase_use_resolves(sensor, case_fold_universe): + """ + Regression test for #2540: fortran `USE A` must resolve to a.f90 even + though the captured token's case doesn't match the file stem -- fortran + is case-insensitive and uppercase USE is the dominant legacy style. + """ + mapped_files, _ = sensor.build_dependency_graph(case_fold_universe) + + a_f90 = next(f for f in mapped_files if f["path"] == "/src/orbit_math.f90") + telemetry = a_f90["telemetry"]["network_metrics"] + + assert telemetry["in_degree"] == 1, "Uppercase `USE A` failed to resolve to a.f90 -- import chain invisible!" + assert telemetry["ecosystem_role"] != "Isolated/Orphan", ( + "a.f90 is imported by main.f90 and must not be classified an orphan." + ) + assert a_f90["telemetry"]["popularity"] == 1 + + +@pytest.mark.skipif(not HAS_NETWORKX, reason="Requires NetworkX") +def test_network_haskell_capitalized_import_resolves(sensor, case_fold_universe): + """ + Regression test for #2540 (issue comment): haskell module names are + necessarily capitalized (`import A`), so a lowercase a.hs on disk must + still receive the edge. + """ + mapped_files, _ = sensor.build_dependency_graph(case_fold_universe) + + a_hs = next(f for f in mapped_files if f["path"] == "/hs/parser.hs") + assert a_hs["telemetry"]["network_metrics"]["in_degree"] == 1, ( + "`import A` failed to resolve to a.hs -- haskell DAG invisible!" + ) + + +@pytest.mark.skipif(not HAS_NETWORKX, reason="Requires NetworkX") +def test_network_cobol_copy_statement_resolves(sensor, case_fold_universe): + """ + Regression test for #2540 (issue comment): cobol `COPY A.` captures "A" + and must resolve to the lowercase copybook a.cpy. + """ + mapped_files, _ = sensor.build_dependency_graph(case_fold_universe) + + a_cpy = next(f for f in mapped_files if f["path"] == "/cbl/payroll.cpy") + assert a_cpy["telemetry"]["network_metrics"]["in_degree"] == 1, ( + "`COPY A.` failed to resolve to a.cpy -- cobol copybook edge lost!" + ) + + +# ============================================================================== +# TEST 16: CASE-SENSITIVE LANGUAGES MUST NOT CROSS-CASE RESOLVE (#2540) +# ============================================================================== +@pytest.mark.skipif(not HAS_NETWORKX, reason="Requires NetworkX") +def test_network_python_does_not_cross_case_resolve(sensor): + """ + Guard for #2540's chosen design (per-language flag, not an unconditional + fold): python is case-sensitive, so `import Foo` must NOT suddenly + resolve to foo.py just because the fold exists for fortran/cobol/haskell. + """ + files = [ + {"path": "/src/foo.py", "lang_id": "python", "raw_imports": []}, + {"path": "/src/app.py", "lang_id": "python", "raw_imports": ["Foo"]}, + ] + + mapped_files, _ = sensor.build_dependency_graph(files) + + foo = next(f for f in mapped_files if f["path"] == "/src/foo.py") + assert foo["telemetry"]["network_metrics"]["in_degree"] == 0, ( + "Case-sensitive python `import Foo` must not cross-case resolve to foo.py!" + ) + + +@pytest.mark.skipif(not HAS_NETWORKX, reason="Requires NetworkX") +def test_network_unknown_language_stays_case_sensitive(sensor): + """A file with no lang_id at all (mock/legacy dicts) keeps exact-case resolution.""" + files = [ + {"path": "/src/foo.js", "raw_imports": []}, + {"path": "/src/app.js", "raw_imports": ["FOO"]}, + ] + + mapped_files, _ = sensor.build_dependency_graph(files) + + foo = next(f for f in mapped_files if f["path"] == "/src/foo.js") + assert foo["telemetry"]["network_metrics"]["in_degree"] == 0 + + +# ============================================================================== +# TEST 17: EXACT-CASE MATCH WINS BEFORE THE FOLD (#2540) +# ============================================================================== +@pytest.mark.skipif(not HAS_NETWORKX, reason="Requires NetworkX") +def test_network_exact_case_match_wins_over_folded(sensor): + """ + When both A.hs and a.hs exist, `import A` from a folding language must + take the exact-case match (A.hs) -- the fold is a fallback for when the + exact lookup misses, never a replacement for it. + """ + files = [ + {"path": "/hs/A.hs", "lang_id": "haskell", "raw_imports": []}, + {"path": "/hs/a.hs", "lang_id": "haskell", "raw_imports": []}, + {"path": "/hs/Main.hs", "lang_id": "haskell", "raw_imports": ["A"]}, + ] + + mapped_files, _ = sensor.build_dependency_graph(files) + + exact = next(f for f in mapped_files if f["path"] == "/hs/A.hs") + folded = next(f for f in mapped_files if f["path"] == "/hs/a.hs") + assert exact["telemetry"]["network_metrics"]["in_degree"] == 1, "Exact-case A.hs must win the lookup." + assert folded["telemetry"]["network_metrics"]["in_degree"] == 0, ( + "The folded candidate must not steal an edge that resolved exactly." + ) + + +# ============================================================================== +# TEST 18: CASE-FOLDED RESOLUTION — FALLBACK (ZERO-DEPENDENCY) MODE (#2540) +# ============================================================================== +def test_network_case_fold_fallback_mode(sensor, case_fold_universe): + """ + Regression test for #2540 in the pure-Python fallback path + (_fallback_build_graph): the same case-folded resolution must apply + even when NetworkX isn't installed. + """ + with patch("gitgalaxy.core.network_risk_sensor.HAS_NETWORKX", False): + mapped_files, _ = sensor.build_dependency_graph(case_fold_universe) + + a_f90 = next(f for f in mapped_files if f["path"] == "/src/orbit_math.f90") + assert a_f90["telemetry"]["network_metrics"]["in_degree"] == 1 + a_cpy = next(f for f in mapped_files if f["path"] == "/cbl/payroll.cpy") + assert a_cpy["telemetry"]["network_metrics"]["in_degree"] == 1 From 11254e2150f73cb091f5b35533eb2d6c9281e306 Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 1 Sep 2026 20:50:01 -0400 Subject: [PATCH 6/7] feat(recorder): persist raw pre-adjustment hit_vector (#2536) The Contextual Baseline Fix in galaxyscope.py rewrites api += orphaned_logic / orphaned_logic = 0 in place for any imported file (popularity > 0) before recording, so the raw extraction counts were unrecoverable from the recorder DB -- which the #1096 cross-language extraction-equivalence control corpus needs. - galaxyscope.py: snapshot the two affected keys unconditionally into meta["raw_pre_adjustment"] BEFORE the adjustment runs, so files the adjustment never touches carry raw == adjusted. Scoring still consumes the adjusted equations -- no behavior change. - record_keeper.py: two additive file_data columns, raw_arch_api and raw_state_slop_orphans (raw_ prefix on the existing SHORT_KEY_MAP names so they sit beside arch_api / state_slop_orphans in queries), with the doc_loc-precedent ALTER TABLE auto-heal for pre-#2536 databases. Producers without the snapshot (synthetic leak/model nodes) fall back to the adjusted hit_vector slots, never a fake 0. - tests: recorder round-trip (adjusted api == raw_api + raw_orphaned_logic invariant, untouched raw == adjusted, no-snapshot fallback, legacy-DB migration) + a galaxyscope-level test of the snapshot around the Contextual Baseline Fix itself. - tests/ruff_audit_baseline.json: pure line-shift regeneration via audit_check.py --regenerate (record_keeper.py edits shifted the pre-existing W291/RUF005 backlog findings). Co-Authored-By: Claude Fable 5 --- gitgalaxy/galaxyscope.py | 17 +++ gitgalaxy/recorders/record_keeper.py | 45 +++++++ tests/core_engine/test_galaxyscope.py | 64 ++++++++++ tests/ruff_audit_baseline.json | 18 +-- tests/tools_recorders/test_record_keeper.py | 124 ++++++++++++++++++++ 5 files changed, 259 insertions(+), 9 deletions(-) diff --git a/gitgalaxy/galaxyscope.py b/gitgalaxy/galaxyscope.py index 835d07ae80..8b9a710972 100644 --- a/gitgalaxy/galaxyscope.py +++ b/gitgalaxy/galaxyscope.py @@ -2145,6 +2145,23 @@ def _calculate_risk_exposures(self): meta["metadata"]["folder_dominant_lang"] = folder_dominant_langs.get(folder, meta.get("lang_id", "unknown")) # ----------------------------------------------------------------- + # ================================================================= + # ---> #2536: RAW PRE-ADJUSTMENT SNAPSHOT <--- + # The Contextual Baseline Fix below rewrites api/orphaned_logic + # IN PLACE for any imported file, which made the raw extraction + # counts unrecoverable from the recorder DB (the #1096 + # cross-language control corpus needs them). Snapshot the affected + # keys unconditionally BEFORE the adjustment runs so files the + # adjustment never touches record raw == adjusted. Purely + # additive: scoring still consumes the adjusted equations. + # ================================================================= + pre_adjust_eq = meta.get("equations", {}) + meta["raw_pre_adjustment"] = { + "api": pre_adjust_eq.get("api", 0), + "orphaned_logic": pre_adjust_eq.get("orphaned_logic", 0), + } + # ================================================================= + # ================================================================= # ---> THE CONTEXTUAL BASELINE FIX <--- # If the file is imported by the ecosystem, its "orphans" are actually its API. diff --git a/gitgalaxy/recorders/record_keeper.py b/gitgalaxy/recorders/record_keeper.py index 588a43fb49..c1bed80a46 100644 --- a/gitgalaxy/recorders/record_keeper.py +++ b/gitgalaxy/recorders/record_keeper.py @@ -307,6 +307,8 @@ def record_mission( appsec_god_mode BOOLEAN DEFAULT 0, hallucination_zone BOOLEAN DEFAULT 0, silent_mutation_risk BOOLEAN DEFAULT 0, + raw_arch_api INTEGER DEFAULT 0, + raw_state_slop_orphans INTEGER DEFAULT 0, {", ".join(risk_cols)}, {", ".join(hit_cols)} ) @@ -368,6 +370,29 @@ def record_mission( else: raise + # #2536: galaxyscope.py's Contextual Baseline Fix folds orphaned_logic + # into api for any imported file BEFORE the hit_vector is built, so + # arch_api / state_slop_orphans only ever carry the ADJUSTED values. + # These two columns persist the raw pre-adjustment extraction counts + # alongside them (needed by the #1096 cross-language control corpus); + # for files the adjustment never touches, raw == adjusted. Same + # auto-heal precedent as doc_loc above for pre-#2536 databases. + try: + cursor.execute("ALTER TABLE file_data ADD COLUMN raw_arch_api INTEGER DEFAULT 0") + except sqlite3.OperationalError as exc: + if "duplicate column name" in str(exc).lower(): + self.logger.debug("Schema migration skipped: 'raw_arch_api' already exists.") + else: + raise + + try: + cursor.execute("ALTER TABLE file_data ADD COLUMN raw_state_slop_orphans INTEGER DEFAULT 0") + except sqlite3.OperationalError as exc: + if "duplicate column name" in str(exc).lower(): + self.logger.debug("Schema migration skipped: 'raw_state_slop_orphans' already exists.") + else: + raise + cursor.execute(""" CREATE TABLE IF NOT EXISTS excluded_artifacts ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -406,6 +431,13 @@ def record_mission( # PERFORMANCE OPTIMIZATION: Global array for batched executemany inserts all_func_rows = [] + # #2536: hit_vector indexes for the two keys the Contextual Baseline + # Fix rewrites -- used to fall back to the adjusted values whenever a + # producer doesn't ship the raw snapshot (synthetic leak/model nodes), + # so raw == adjusted there rather than a fake zero. + api_sig_idx = self.SIGNAL_SCHEMA.index("api") if "api" in self.SIGNAL_SCHEMA else -1 + orphan_sig_idx = self.SIGNAL_SCHEMA.index("orphaned_logic") if "orphaned_logic" in self.SIGNAL_SCHEMA else -1 + for file_data in parsed_files: tel = file_data.get("telemetry", {}) functions = file_data.get("functions", []) @@ -465,6 +497,16 @@ def record_mission( rv = file_data.get("risk_vector", [0.0] * len(self.RISK_SCHEMA)) hv = file_data.get("hit_vector", [0] * len(self.SIGNAL_SCHEMA)) + # #2536: raw pre-adjustment extraction counts, snapshotted by + # galaxyscope.py BEFORE the Contextual Baseline Fix rewrites + # api/orphaned_logic. Absent snapshot -> fall back to the adjusted + # hit_vector slots (raw == adjusted). + raw_pre = file_data.get("raw_pre_adjustment", {}) + adjusted_api = hv[api_sig_idx] if 0 <= api_sig_idx < len(hv) else 0 + adjusted_orphans = hv[orphan_sig_idx] if 0 <= orphan_sig_idx < len(hv) else 0 + raw_api = int(raw_pre.get("api", adjusted_api)) + raw_orphans = int(raw_pre.get("orphaned_logic", adjusted_orphans)) + file_archetype = tel.get("archetype", "Unknown") file_fingerprint_str = json.dumps(tel.get("archetype_fingerprint", {})) @@ -696,6 +738,8 @@ def record_mission( god_mode, hallucination_zone, silent_mutation, + raw_api, + raw_orphans, ] row_data.extend(rv) @@ -723,6 +767,7 @@ def record_mission( ecosystem_baseline, repo_z_score, ai_threat_score, is_malware, has_credentials, binary_anomaly, obfuscation_flag, token_mass, financial_read_cost, agentic_isolation_risk, requires_hitl, appsec_god_mode, hallucination_zone, silent_mutation_risk, + raw_arch_api, raw_state_slop_orphans, {", ".join([f"risk_{r.replace('-', '_')}" for r in self.RISK_SCHEMA])}, {", ".join([self.SHORT_KEY_MAP.get(h, h) for h in self.SIGNAL_SCHEMA])} ) VALUES ({placeholders}) diff --git a/tests/core_engine/test_galaxyscope.py b/tests/core_engine/test_galaxyscope.py index 3940f84dd0..d31704ad0a 100644 --- a/tests/core_engine/test_galaxyscope.py +++ b/tests/core_engine/test_galaxyscope.py @@ -1386,6 +1386,70 @@ def test_synthetic_node_generation(self, mock_audit_model): self.assertIsNotNone(model_node, "Tensor Scanner failed to force model onto the map.") self.assertEqual(model_node["telemetry"]["domain_context"]["architecture"], "Llama") + # ============================================================================== + # TEST 17b: #2536 -- RAW PRE-ADJUSTMENT SNAPSHOT (Contextual Baseline Fix) + # ============================================================================== + def test_contextual_baseline_fix_snapshots_raw_signals(self): + """ + COVERAGE TARGET: The Contextual Baseline Fix block in _calculate_risk_exposures. + #2536: the fix rewrites api += orphaned_logic / orphaned_logic = 0 for any + imported file (popularity > 0) BEFORE recording, making the raw extraction + counts unrecoverable. meta["raw_pre_adjustment"] must snapshot the raw + values first -- unconditionally, so untouched files carry raw == adjusted. + """ + from gitgalaxy.standards.analysis_lens import RECORDING_SCHEMAS + + scope = Orchestrator(".", self.mock_config) + + scope.ram_cache = { + # Imported by the ecosystem: 3 orphans get converted into API exposure. + "src/imported_lib.py": { + "path": "src/imported_lib.py", + "coding_loc": 100, + "lang_id": "python", + "equations": {"api": 2, "orphaned_logic": 3}, + "functions": [{"name": "helper", "usage_status": 1}], + }, + # Never imported: the adjustment must not touch it. + "src/island.py": { + "path": "src/island.py", + "coding_loc": 50, + "lang_id": "python", + "equations": {"api": 1, "orphaned_logic": 4}, + }, + } + scope.popularity_scores = {"src/imported_lib.py": 2, "src/island.py": 0} + + scope._calculate_risk_exposures() + + by_path = {f.get("path"): f for f in scope.parsed_files} + lib = by_path["src/imported_lib.py"] + island = by_path["src/island.py"] + + # 1. Adjusted behavior is byte-identical to before: orphans folded into api. + self.assertEqual(lib["equations"]["api"], 5, "Contextual Baseline Fix no longer folds orphans into api!") + self.assertEqual(lib["equations"]["orphaned_logic"], 0, "Contextual Baseline Fix no longer wipes orphans!") + + # 2. The raw pre-adjustment values survive on the snapshot, and the + # invariant adjusted api == raw_api + raw_orphaned_logic holds. + self.assertEqual(lib["raw_pre_adjustment"], {"api": 2, "orphaned_logic": 3}) + self.assertEqual( + lib["equations"]["api"], + lib["raw_pre_adjustment"]["api"] + lib["raw_pre_adjustment"]["orphaned_logic"], + "adjusted api must equal raw api + raw orphaned_logic", + ) + + # 3. The adjusted values are what flow into the recorder's hit_vector. + signal_schema = RECORDING_SCHEMAS.get("SIGNAL_SCHEMA", []) + if "api" in signal_schema and "orphaned_logic" in signal_schema: + self.assertEqual(lib["hit_vector"][signal_schema.index("api")], 5) + self.assertEqual(lib["hit_vector"][signal_schema.index("orphaned_logic")], 0) + + # 4. Untouched file: snapshot still present, raw == adjusted. + self.assertEqual(island["raw_pre_adjustment"], {"api": 1, "orphaned_logic": 4}) + self.assertEqual(island["equations"]["api"], 1) + self.assertEqual(island["equations"]["orphaned_logic"], 4) + # ============================================================================== # TEST 18: WORKER I/O ERRORS & BINARY THREAT ESCALATION # ============================================================================== diff --git a/tests/ruff_audit_baseline.json b/tests/ruff_audit_baseline.json index 2178c7e2d8..6c2e719bfa 100644 --- a/tests/ruff_audit_baseline.json +++ b/tests/ruff_audit_baseline.json @@ -33,15 +33,15 @@ "gitgalaxy/recorders/record_keeper.py:292: W291": "Trailing whitespace", "gitgalaxy/recorders/record_keeper.py:293: W291": "Trailing whitespace", "gitgalaxy/recorders/record_keeper.py:294: W291": "Trailing whitespace", - "gitgalaxy/recorders/record_keeper.py:714: W291": "Trailing whitespace", - "gitgalaxy/recorders/record_keeper.py:718: W291": "Trailing whitespace", - "gitgalaxy/recorders/record_keeper.py:720: W291": "Trailing whitespace", - "gitgalaxy/recorders/record_keeper.py:721: W291": "Trailing whitespace", - "gitgalaxy/recorders/record_keeper.py:766: RUF005": "Consider iterable unpacking instead of concatenation", - "gitgalaxy/recorders/record_keeper.py:835: RUF005": "Consider iterable unpacking instead of concatenation", - "gitgalaxy/recorders/record_keeper.py:872: W291": "Trailing whitespace", - "gitgalaxy/recorders/record_keeper.py:873: W291": "Trailing whitespace", - "gitgalaxy/recorders/record_keeper.py:904: W291": "Trailing whitespace", + "gitgalaxy/recorders/record_keeper.py:758: W291": "Trailing whitespace", + "gitgalaxy/recorders/record_keeper.py:762: W291": "Trailing whitespace", + "gitgalaxy/recorders/record_keeper.py:764: W291": "Trailing whitespace", + "gitgalaxy/recorders/record_keeper.py:765: W291": "Trailing whitespace", + "gitgalaxy/recorders/record_keeper.py:811: RUF005": "Consider iterable unpacking instead of concatenation", + "gitgalaxy/recorders/record_keeper.py:880: RUF005": "Consider iterable unpacking instead of concatenation", + "gitgalaxy/recorders/record_keeper.py:917: W291": "Trailing whitespace", + "gitgalaxy/recorders/record_keeper.py:918: W291": "Trailing whitespace", + "gitgalaxy/recorders/record_keeper.py:949: W291": "Trailing whitespace", "gitgalaxy/recorders/sbom_recorder.py:221: PERF401": "Use `list.extend` to create a transformed list", "gitgalaxy/security/security_auditor.py:359: RUF046": "Value being cast to `int` is already an integer", "gitgalaxy/security/security_auditor.py:424: PERF203": "`try`-`except` within a loop incurs performance overhead", diff --git a/tests/tools_recorders/test_record_keeper.py b/tests/tools_recorders/test_record_keeper.py index 1589cf5a98..fcf76bfd79 100644 --- a/tests/tools_recorders/test_record_keeper.py +++ b/tests/tools_recorders/test_record_keeper.py @@ -359,6 +359,130 @@ def test_record_keeper_persists_doc_loc(keeper, mock_pipeline_state, tmp_path): assert row["total_loc"] - row["coding_loc"] == 50 +# ============================================================================== +# #2536: RAW PRE-ADJUSTMENT HIT_VECTOR PERSISTENCE +# galaxyscope.py's Contextual Baseline Fix folds orphaned_logic into api for +# any imported file BEFORE the hit_vector is built, so arch_api / +# state_slop_orphans only ever carry the adjusted values. The raw +# pre-adjustment counts must round-trip via file_data["raw_pre_adjustment"] +# into the additive raw_arch_api / raw_state_slop_orphans columns. +# ============================================================================== +@pytest.fixture +def baseline_keeper(): + """RecordKeeper whose signal schema contains the two keys the Contextual + Baseline Fix rewrites, so both the adjusted columns and the raw columns + are observable side by side.""" + mock_schemas = { + "RISK_SCHEMA": ["tech_debt"], + "SIGNAL_SCHEMA": ["api", "orphaned_logic"], + } + with patch("gitgalaxy.recorders.record_keeper.RECORDING_SCHEMAS", mock_schemas): + return RecordKeeper() + + +def _baseline_state(hit_vector, raw_pre_adjustment): + """Minimal pipeline state for the baseline_keeper's 2-signal schema.""" + file_entry = { + "path": "src/lib.py", + "lang_id": "python", + "risk_vector": [0.0], + "hit_vector": hit_vector, + } + if raw_pre_adjustment is not None: + file_entry["raw_pre_adjustment"] = raw_pre_adjustment + session = { + "target": "TestProject", + "git_audit": {"commit_hash": "a1b2c3d4", "latest_commit_date": "2026-06-18T10:00:00Z"}, + } + return [file_entry], [], {}, session + + +def _fetch_raw_row(db_path): + conn = sqlite3.connect(db_path) + conn.row_factory = sqlite3.Row + row = conn.execute( + "SELECT arch_api, state_slop_orphans, raw_arch_api, raw_state_slop_orphans FROM file_data" + ).fetchone() + conn.close() + return row + + +def test_raw_columns_persist_pre_adjustment_values(baseline_keeper, tmp_path): + """An imported file with uncalled defs: the Contextual Baseline Fix folded + raw orphaned_logic=3 into api (2 -> 5), so the adjusted hit_vector is + [5, 0] -- but the raw snapshot must survive verbatim, with the invariant + adjusted api == raw_api + raw_orphaned_logic.""" + db_path = tmp_path / "test_raw_adjusted.sqlite" + parsed, unparsable, summary, session = _baseline_state( + hit_vector=[5, 0], raw_pre_adjustment={"api": 2, "orphaned_logic": 3} + ) + + baseline_keeper.record_mission(parsed, unparsable, summary, session, str(db_path)) + + row = _fetch_raw_row(db_path) + assert row["arch_api"] == 5, "Adjusted api must persist unchanged (no behavior change to scoring)" + assert row["state_slop_orphans"] == 0, "Adjusted orphaned_logic must persist unchanged" + assert row["raw_arch_api"] == 2, "Raw pre-adjustment api was not preserved" + assert row["raw_state_slop_orphans"] == 3, "Raw pre-adjustment orphaned_logic was not preserved" + assert row["arch_api"] == row["raw_arch_api"] + row["raw_state_slop_orphans"], ( + "Contextual Baseline Fix invariant broken: adjusted api must equal raw api + raw orphans" + ) + + +def test_raw_columns_equal_adjusted_for_untouched_file(baseline_keeper, tmp_path): + """An un-imported file (popularity == 0) never gets adjusted -- galaxyscope + still snapshots unconditionally, so raw == adjusted.""" + db_path = tmp_path / "test_raw_untouched.sqlite" + parsed, unparsable, summary, session = _baseline_state( + hit_vector=[1, 4], raw_pre_adjustment={"api": 1, "orphaned_logic": 4} + ) + + baseline_keeper.record_mission(parsed, unparsable, summary, session, str(db_path)) + + row = _fetch_raw_row(db_path) + assert row["raw_arch_api"] == row["arch_api"] == 1 + assert row["raw_state_slop_orphans"] == row["state_slop_orphans"] == 4 + + +def test_raw_columns_fall_back_to_adjusted_without_snapshot(baseline_keeper, tmp_path): + """A producer that ships no raw_pre_adjustment (synthetic leak/model nodes) + must land raw == adjusted, never a fake zero.""" + db_path = tmp_path / "test_raw_fallback.sqlite" + parsed, unparsable, summary, session = _baseline_state(hit_vector=[7, 2], raw_pre_adjustment=None) + + baseline_keeper.record_mission(parsed, unparsable, summary, session, str(db_path)) + + row = _fetch_raw_row(db_path) + assert row["raw_arch_api"] == 7, "Fallback must mirror the adjusted arch_api slot" + assert row["raw_state_slop_orphans"] == 2, "Fallback must mirror the adjusted state_slop_orphans slot" + + +def test_raw_columns_migration_on_legacy_db(baseline_keeper, tmp_path): + """#2536: recording into a pre-raw-columns database must auto-heal the + schema (same doc_loc / is_zero_dependency_mode ALTER TABLE precedent) + instead of failing the INSERT with a column-count mismatch.""" + db_path = tmp_path / "legacy_raw.sqlite" + parsed, unparsable, summary, session = _baseline_state( + hit_vector=[5, 0], raw_pre_adjustment={"api": 2, "orphaned_logic": 3} + ) + + # First mission builds the modern schema; drop both raw columns to + # simulate a legacy (pre-#2536) database. + baseline_keeper.record_mission(parsed, unparsable, summary, session, str(db_path)) + conn = sqlite3.connect(db_path) + conn.execute("ALTER TABLE file_data DROP COLUMN raw_arch_api") + conn.execute("ALTER TABLE file_data DROP COLUMN raw_state_slop_orphans") + conn.commit() + conn.close() + + # Second mission against the legacy-shaped DB must migrate and insert. + baseline_keeper.record_mission(parsed, unparsable, summary, session, str(db_path)) + + row = _fetch_raw_row(db_path) + assert row["raw_arch_api"] == 2 + assert row["raw_state_slop_orphans"] == 3 + + def test_record_keeper_doc_loc_migration_on_legacy_db(keeper, mock_pipeline_state, tmp_path): """#2625: recording into a pre-doc_loc database must auto-heal the schema (same is_zero_dependency_mode ALTER TABLE precedent) instead of failing From a837c3a30b8827d37f19fdb7c3539c4c233e9b99 Mon Sep 17 00:00:00 2001 From: Joe Esquibel Date: Tue, 1 Sep 2026 21:12:35 -0400 Subject: [PATCH 7/7] fix(dag): scope #2540's case-fold to the importing language's own files + re-bless golden masters The crucible re-bless surfaced a false edge the fold could invent: haskell's `import Text.Pandoc.Generic` case-folded onto go's generic.go purely on a stem collision. Folding is a property of the importing language's resolution rules, so the folded fallback now sees only that language's files (per-language folded maps); the exact-case stages keep their long-standing language-agnostic behavior. Adds a cross-language guard regression test. Golden masters re-blessed for the intended #2539-#2543 drift: php branch counts drop by one per open/close tag (and derived cognitive-load ratios), cobol copybooks and fortran/haskell modules gain their previously-lost popularity/blast-radius edges, go loses the per-import safety_bypasses inflation. Verified zero-diff via crucible_check.py on both modes. Co-Authored-By: Claude Fable 5 --- gitgalaxy/core/network_risk_sensor.py | 83 +- tests/golden_master_audit.json | 770 +++++++++--------- tests/golden_master_zero_dep_audit.json | 742 ++++++++--------- .../test_network_risk_sensor.py | 31 + 4 files changed, 841 insertions(+), 785 deletions(-) diff --git a/gitgalaxy/core/network_risk_sensor.py b/gitgalaxy/core/network_risk_sensor.py index 2c39852d65..52bacad086 100644 --- a/gitgalaxy/core/network_risk_sensor.py +++ b/gitgalaxy/core/network_risk_sensor.py @@ -67,36 +67,57 @@ def _build_resolution_map(self, files: list[dict[str, Any]]) -> dict[str, list[s return resolution_map - def _build_folded_resolution_map(self, resolution_map: dict[str, list[str]]) -> dict[str, list[str]]: + def _build_folded_resolution_map(self, files: list[dict[str, Any]]) -> dict[str, dict[str, list[str]]]: """ - #2540: derives a lowercase-keyed view of the resolution map so - imports from case-insensitive-resolution languages (fortran, cobol, - haskell — see CASE_INSENSITIVE_IMPORT_LANGS) can fall back to a + #2540: derives per-language lowercase-keyed views of the resolution + keys so imports from case-insensitive-resolution languages (fortran, + cobol, haskell — see CASE_INSENSITIVE_IMPORT_LANGS) can fall back to a case-folded lookup. Kept separate from the exact-case map so case-sensitive languages never gain cross-case resolution, and so exact-case matches always win first even for the folding languages. + + Folding is a property of the *importing* language's resolution rules, + so each language's folded view holds only that language's own files — + haskell's `import Text.Pandoc.Generic` must not fold onto a go file + named generic.go just because the stems collide case-insensitively. + (The exact-case stages keep their long-standing language-agnostic + stem matching; only the folded fallback is scoped.) """ - folded_map: dict[str, list[str]] = defaultdict(list) - for key, paths in resolution_map.items(): - folded_map[key.lower()].extend(paths) - return folded_map + folded_maps: dict[str, dict[str, list[str]]] = {} + for f in files: + lang = str(f.get("lang_id", "")).lower() + if lang not in CASE_INSENSITIVE_IMPORT_LANGS: + continue + path = f.get("path", "") + if not path: + continue + lang_map = folded_maps.setdefault(lang, defaultdict(list)) + name = f.get("name", Path(path).name) + stem = Path(path).stem + lang_map[path.lower()].append(path) + if name: + lang_map[name.lower()].append(path) + if stem: + lang_map[stem.lower()].append(path) + return folded_maps def _resolve_target( self, target_token: str, resolution_map: dict[str, list[str]], curr_path: str, - folded_map: Optional[dict[str, list[str]]] = None, - fold: bool = False, + folded_maps: Optional[dict[str, dict[str, list[str]]]] = None, + fold_lang: Optional[str] = None, ) -> Optional[str]: """ Resolves an import token to a single file path, refusing to guess when genuinely ambiguous rather than silently misattributing an edge. - When `fold` is True (the importing file's language resolves imports - case-insensitively, #2540) and no exact-case key matches, the lookup - retries against `folded_map` with a lowercased token. Exact matches - always win first, so mixed-case repos keep their precise edges. + When `fold_lang` is set (the importing file's language resolves + imports case-insensitively, #2540) and no exact-case key matches, the + lookup retries against that language's own folded map with a + lowercased token. Exact matches always win first, so mixed-case repos + keep their precise edges. """ token_as_path = target_token.replace(".", "/").replace("\\", "/") bare_component = token_as_path.rsplit("/", 1)[-1] @@ -117,12 +138,15 @@ def _resolve_target( # Stage 1c (#2540): case-insensitive-resolution languages retry the # same two lookups case-folded, only after both exact-case stages # miss — fortran `USE A` -> a.f90, cobol `COPY A.` -> a.cpy, - # haskell `import A` -> a.hs. - if not candidates and fold and folded_map is not None: - folded_hit = True - candidates = folded_map.get(target_token.lower()) - if not candidates: - candidates = folded_map.get(bare_component.lower()) + # haskell `import A` -> a.hs. Scoped to the importing language's own + # files so folding never invents a cross-language edge. + if not candidates and fold_lang and folded_maps is not None: + lang_map = folded_maps.get(fold_lang) + if lang_map: + folded_hit = True + candidates = lang_map.get(target_token.lower()) + if not candidates: + candidates = lang_map.get(bare_component.lower()) if not candidates: return None @@ -156,9 +180,10 @@ def _resolve_target( return None @staticmethod - def _folds_case(f: dict[str, Any]) -> bool: - """#2540: does this file's language resolve import targets case-insensitively?""" - return str(f.get("lang_id", "")).lower() in CASE_INSENSITIVE_IMPORT_LANGS + def _fold_lang(f: dict[str, Any]) -> Optional[str]: + """#2540: the file's language id if it resolves import targets case-insensitively, else None.""" + lang = str(f.get("lang_id", "")).lower() + return lang if lang in CASE_INSENSITIVE_IMPORT_LANGS else None def extract_test_coverage_mapping(self, files: list[dict[str, Any]]) -> dict[str, dict[str, list[dict[str, Any]]]]: """ @@ -171,7 +196,7 @@ def extract_test_coverage_mapping(self, files: list[dict[str, Any]]) -> dict[str """ coverage_map: dict[str, dict[str, list[dict[str, Any]]]] = {} resolution_map = self._build_resolution_map(files) - folded_map = self._build_folded_resolution_map(resolution_map) + folded_maps = self._build_folded_resolution_map(files) # 2. Identify Test Files and extract their outgoing invocations for f in files: @@ -188,7 +213,7 @@ def extract_test_coverage_mapping(self, files: list[dict[str, Any]]) -> dict[str for imp in f.get("raw_imports", []): target_token = imp[0] if isinstance(imp, tuple) and len(imp) == 2 else imp target_path = self._resolve_target( - target_token, resolution_map, path, folded_map=folded_map, fold=self._folds_case(f) + target_token, resolution_map, path, folded_maps=folded_maps, fold_lang=self._fold_lang(f) ) if target_path and target_path != path: @@ -237,7 +262,7 @@ def build_dependency_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[li # 1. Build the Resolution Map (Fast Path Lookup) resolution_map = self._build_resolution_map(parsed_files) - folded_map = self._build_folded_resolution_map(resolution_map) + folded_maps = self._build_folded_resolution_map(parsed_files) for f in parsed_files: path = f.get("path", "") @@ -261,7 +286,7 @@ def build_dependency_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[li entity = None target_path = self._resolve_target( - target_token, resolution_map, curr_path, folded_map=folded_map, fold=self._folds_case(f) + target_token, resolution_map, curr_path, folded_maps=folded_maps, fold_lang=self._fold_lang(f) ) if target_path and target_path != curr_path: # Edge weight can be increased if specific entities are highly coupled @@ -448,7 +473,7 @@ def _fallback_build_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[lis ) resolution_map = self._build_resolution_map(parsed_files) - folded_map = self._build_folded_resolution_map(resolution_map) + folded_maps = self._build_folded_resolution_map(parsed_files) in_degrees = {f.get("path", ""): 0 for f in parsed_files} out_degrees = {f.get("path", ""): 0 for f in parsed_files} @@ -458,7 +483,7 @@ def _fallback_build_graph(self, parsed_files: list[dict[str, Any]]) -> tuple[lis for imp in f.get("raw_imports", []): target_token = imp[0] if isinstance(imp, tuple) and len(imp) == 2 else imp target_path = self._resolve_target( - target_token, resolution_map, curr_path, folded_map=folded_map, fold=self._folds_case(f) + target_token, resolution_map, curr_path, folded_maps=folded_maps, fold_lang=self._fold_lang(f) ) if target_path and target_path != curr_path: out_degrees[curr_path] = out_degrees.get(curr_path, 0) + 1 diff --git a/tests/golden_master_audit.json b/tests/golden_master_audit.json index 51450cabba..b82928bb7d 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-01T23:55:41.125049+00:00", - "Total Scan Duration": "50.2 seconds" + "Analysis ISO Timestamp": "2026-09-02T01:08:48.947294+00:00", + "Total Scan Duration": "54.29 seconds" }, "Source Control Footprint (Immutable Anchor)": { "Active Branch": "HEAD", @@ -236,8 +236,8 @@ } }, "health": { - "avg_cognitive_load": 29.724, - "avg_safety_score": 47.798, + "avg_cognitive_load": 29.715, + "avg_safety_score": 47.797, "avg_tech_debt": 32.218, "avg_documentation": 28.8 }, @@ -455,7 +455,7 @@ "php": { "files": 36, "loc": 27825, - "impact": 32351.800000000003 + "impact": 32159.900000000005 }, "proto": { "files": 4, @@ -1475,9 +1475,9 @@ }, "php/laravel_core": { "file_count": 8, - "total_mass": 5097.3, + "total_mass": 5050.5, "avg_exposures": { - "cognitive_load": 32.12, + "cognitive_load": 30.67, "safety_score": 59.31, "tech_debt": 81.27, "verification": 60.3, @@ -3301,7 +3301,7 @@ "file_count": 8, "total_mass": 4617.2, "avg_exposures": { - "cognitive_load": 32.11, + "cognitive_load": 31.64, "safety_score": 69.35, "tech_debt": 55.9, "verification": 31.23, @@ -3318,15 +3318,15 @@ }, "php/wordpress": { "file_count": 8, - "total_mass": 14369.06, + "total_mass": 14227.96, "avg_exposures": { - "cognitive_load": 27.9, - "safety_score": 69.57, + "cognitive_load": 26.98, + "safety_score": 69.4, "tech_debt": 13.26, - "verification": 50.57, + "verification": 40.86, "api_exposure": 3.47, "concurrency": 4.55, - "state_flux": 79.52, + "state_flux": 79.18, "dead_code": 2.49, "spec_match": 87.5, "stability": 43.75, @@ -5315,7 +5315,7 @@ "file_count": 7, "total_mass": 1830.62, "avg_exposures": { - "cognitive_load": 37.84, + "cognitive_load": 37.63, "safety_score": 76.97, "tech_debt": 69.42, "verification": 35.36, @@ -5334,7 +5334,7 @@ "file_count": 7, "total_mass": 5617.52, "avg_exposures": { - "cognitive_load": 46.97, + "cognitive_load": 46.86, "safety_score": 79.87, "tech_debt": 41.35, "verification": 80.0, @@ -5351,10 +5351,10 @@ }, "sql/baseline": { "file_count": 1, - "total_mass": 829.8, + "total_mass": 825.8, "avg_exposures": { - "cognitive_load": 45.66, - "safety_score": 80.36, + "cognitive_load": 45.46, + "safety_score": 80.07, "tech_debt": 11.45, "verification": 80.0, "api_exposure": 1.91, @@ -5997,11 +5997,11 @@ } }, "network_macro": { - "modularity": 0.7976, - "assortativity": -0.3283, + "modularity": 0.8035, + "assortativity": -0.3233, "cyclic_density": 0.005, - "avg_path_length": 6.527, - "articulation_points": 118 + "avg_path_length": 7.0513, + "articulation_points": 121 }, "ecosystem_audits": { "api_mapper": { @@ -6694,32 +6694,32 @@ "undocumented_critical_path": [ { "path": "lua/freebsd-src/hook.lua", - "score": 205.67, - "pr": 2.077, + "score": 204.184, + "pr": 2.062, "doc": 99.0224 }, { "path": "groovy/gradle/DefaultTask.java", - "score": 202.505, - "pr": 2.03, + "score": 201.109, + "pr": 2.016, "doc": 99.7564 }, { "path": "python/fastapi/fastapi/responses.py", - "score": 191.591, - "pr": 4.901, + "score": 190.38, + "pr": 4.87, "doc": 39.0923 }, { "path": "shell/serenity/builtin.sh", - "score": 174.613, - "pr": 3.524, + "score": 173.374, + "pr": 3.499, "doc": 49.5496 }, { "path": "jcl/cics-banking-sample-application-cbsa/DEFAULT.jcl", - "score": 168.877, - "pr": 11.67, + "score": 167.675, + "pr": 11.587, "doc": 14.471 } ] @@ -257906,20 +257906,20 @@ } }, "php/wordpress": { - "Directory Group Magnitude": 14369.06, + "Directory Group Magnitude": 14227.96, "File Count": 8, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "87.5%", "Static: Literature & Documentation": "12.5%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "27.9%", - "Error & Exception Exposure": "69.57%", + "Cognitive Load Exposure": "26.98%", + "Error & Exception Exposure": "69.4%", "Tech Debt Exposure": "13.26%", - "Testing Exposure": "50.57%", + "Testing Exposure": "40.86%", "API Exposure": "3.47%", "Concurrency Exposure": "4.55%", - "State Flux Exposure": "79.52%", + "State Flux Exposure": "79.18%", "Commented Logic Exposure": "2.49%", "Specification Exposure": "87.5%", "Instability Exposure": "43.75%", @@ -257941,9 +257941,9 @@ "Identity Proof": "Prose Extension (.txt)" }, "2. Topological Coordinates": { - "X": -891.7, - "Y": -107.16, - "Z": -8287.02 + "X": -891.63, + "Y": -107.19, + "Z": -8286.76 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -258098,9 +258098,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -767.68, - "Y": -297.2, - "Z": -7142.14 + "X": -767.63, + "Y": -297.18, + "Z": -7142.13 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -258113,15 +258113,15 @@ "Coding LOC": 147, "Documentation LOC": 41, "Structural Magnitude": 26.94, - "Control Flow Ratio": "80.0%", + "Control Flow Ratio": "78.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.218 + "Raw Cognitive Density": 0.211 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "5.31%", + "Cognitive Load Exposure": "5.19%", "Error & Exception Exposure": "52.04%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.3%", @@ -258138,7 +258138,7 @@ "5. Function Analysis": [], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 12, + "Control Flow Branches": 11, "Sequential Logic Declarations": 3, "Function Parameters": 0, "Function/Method Declarations": 0, @@ -258262,8 +258262,8 @@ }, "2. Topological Coordinates": { "X": -598.55, - "Y": -160.14, - "Z": -7921.85 + "Y": -160.16, + "Z": -7921.57 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -258275,7 +258275,7 @@ "Total LOC": 5114, "Coding LOC": 2653, "Documentation LOC": 1856, - "Structural Magnitude": 3603.06, + "Structural Magnitude": 3601.06, "Control Flow Ratio": "78.3%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -258285,7 +258285,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "48.01%", - "Error & Exception Exposure": "94.11%", + "Error & Exception Exposure": "94.09%", "Tech Debt Exposure": "14.62%", "Testing Exposure": "80.0%", "API Exposure": "9.32%", @@ -258982,7 +258982,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 848, + "Control Flow Branches": 847, "Sequential Logic Declarations": 235, "Function Parameters": 71, "Function/Method Declarations": 68, @@ -258992,7 +258992,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 1, "Exposed API / Public Exports": 112, - "State Mutations / Variable Reassignments": 2143, + "State Mutations / Variable Reassignments": 2141, "Commented-out Code (Dead Logic)": 1, "Structured Documentation Blocks": 444, "Unit Test Assertions": 1, @@ -259136,9 +259136,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -956.52, + "X": -956.37, "Y": -177.82, - "Z": -7355.56 + "Z": -7355.55 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -259150,16 +259150,16 @@ "Total LOC": 6297, "Coding LOC": 3048, "Documentation LOC": 2655, - "Structural Magnitude": 4193.06, - "Control Flow Ratio": "68.9%", + "Structural Magnitude": 4183.36, + "Control Flow Ratio": "68.7%", "Popularity Rank": 1, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.362 + "Raw Cognitive Density": 1.358 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "46.02%", + "Cognitive Load Exposure": "45.96%", "Error & Exception Exposure": "96.39%", "Tech Debt Exposure": "9.5%", "Testing Exposure": "80.0%", @@ -259196,11 +259196,11 @@ }, { "Function Name": "wpautop", - "Structural Impact": 66.9, + "Structural Impact": 61.7, "Lines of Code (LOC)": 160, - "Control Flow Branches": 33, + "Control Flow Branches": 30, "Input Parameters": 2, - "Control Flow Ratio": "86.8%", + "Control Flow Ratio": "85.7%", "Start Line": 445, "End Line": 604 }, @@ -259236,11 +259236,11 @@ }, { "Function Name": "make_clickable", - "Structural Impact": 50.4, + "Structural Impact": 47.6, "Lines of Code (LOC)": 75, - "Control Flow Branches": 32, + "Control Flow Branches": 30, "Input Parameters": 1, - "Control Flow Ratio": "88.9%", + "Control Flow Ratio": "88.2%", "Start Line": 3075, "End Line": 3149 }, @@ -259494,16 +259494,6 @@ "Start Line": 3315, "End Line": 3342 }, - { - "Function Name": "wp_strip_all_tags", - "Structural Impact": 12.2, - "Lines of Code (LOC)": 37, - "Control Flow Branches": 5, - "Input Parameters": 2, - "Control Flow Ratio": "55.6%", - "Start Line": 5514, - "End Line": 5550 - }, { "Function Name": "_split_str_by_whitespace", "Structural Impact": 11.7, @@ -259554,6 +259544,16 @@ "Start Line": 3957, "End Line": 4032 }, + { + "Function Name": "wp_strip_all_tags", + "Structural Impact": 10.5, + "Lines of Code (LOC)": 37, + "Control Flow Branches": 4, + "Input Parameters": 2, + "Control Flow Ratio": "50.0%", + "Start Line": 5514, + "End Line": 5550 + }, { "Function Name": "antispambot", "Structural Impact": 9.5, @@ -260377,7 +260377,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 755, + "Control Flow Branches": 748, "Sequential Logic Declarations": 341, "Function Parameters": 128, "Function/Method Declarations": 120, @@ -260588,9 +260588,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -661.46, + "X": -661.45, "Y": -224.26, - "Z": -7722.54 + "Z": -7722.4 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -260602,16 +260602,16 @@ "Total LOC": 9285, "Coding LOC": 4278, "Documentation LOC": 4024, - "Structural Magnitude": 5464.16, - "Control Flow Ratio": "63.2%", + "Structural Magnitude": 5423.76, + "Control Flow Ratio": "62.5%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.048 + "Raw Cognitive Density": 1.039 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "38.34%", + "Cognitive Load Exposure": "38.03%", "Error & Exception Exposure": "92.21%", "Tech Debt Exposure": "81.98%", "Testing Exposure": "80.0%", @@ -260686,16 +260686,6 @@ "Start Line": 4298, "End Line": 4371 }, - { - "Function Name": "_default_wp_die_handler", - "Structural Impact": 55.5, - "Lines of Code (LOC)": 69, - "Control Flow Branches": 25, - "Input Parameters": 3, - "Control Flow Ratio": "92.6%", - "Start Line": 3867, - "End Line": 3935 - }, { "Function Name": "do_enclose", "Structural Impact": 51.3, @@ -260766,6 +260756,16 @@ "Start Line": 337, "End Line": 410 }, + { + "Function Name": "_default_wp_die_handler", + "Structural Impact": 37.5, + "Lines of Code (LOC)": 69, + "Control Flow Branches": 16, + "Input Parameters": 3, + "Control Flow Ratio": "88.9%", + "Start Line": 3867, + "End Line": 3935 + }, { "Function Name": "_wp_json_sanity_check", "Structural Impact": 37.1, @@ -260886,16 +260886,6 @@ "Start Line": 6604, "End Line": 6649 }, - { - "Function Name": "wp_auth_check_html", - "Structural Impact": 26.5, - "Lines of Code (LOC)": 50, - "Control Flow Branches": 23, - "Input Parameters": 0, - "Control Flow Ratio": "71.9%", - "Start Line": 7495, - "End Line": 7544 - }, { "Function Name": "get_file_data", "Structural Impact": 25.9, @@ -261616,6 +261606,16 @@ "Start Line": 7354, "End Line": 7369 }, + { + "Function Name": "wp_auth_check_html", + "Structural Impact": 6.5, + "Lines of Code (LOC)": 50, + "Control Flow Branches": 3, + "Input Parameters": 0, + "Control Flow Ratio": "25.0%", + "Start Line": 7495, + "End Line": 7544 + }, { "Function Name": "wp_generate_uuid4", "Structural Impact": 6.3, @@ -261886,16 +261886,6 @@ "Start Line": 1691, "End Line": 1697 }, - { - "Function Name": "wp_post_preview_js", - "Structural Impact": 4.6, - "Lines of Code (LOC)": 12, - "Control Flow Branches": 3, - "Input Parameters": 0, - "Control Flow Ratio": "60.0%", - "Start Line": 7811, - "End Line": 7822 - }, { "Function Name": "xmlrpc_removepostdata", "Structural Impact": 4.5, @@ -261946,16 +261936,6 @@ "Start Line": 7580, "End Line": 7585 }, - { - "Function Name": "_cleanup_header_comment", - "Structural Impact": 4.4, - "Lines of Code (LOC)": 3, - "Control Flow Branches": 2, - "Input Parameters": 1, - "Control Flow Ratio": "50.0%", - "Start Line": 6862, - "End Line": 6864 - }, { "Function Name": "wp_unique_id_from_values", "Structural Impact": 4.4, @@ -262076,6 +262056,16 @@ "Start Line": 7752, "End Line": 7767 }, + { + "Function Name": "wp_post_preview_js", + "Structural Impact": 3.6, + "Lines of Code (LOC)": 12, + "Control Flow Branches": 2, + "Input Parameters": 0, + "Control Flow Ratio": "50.0%", + "Start Line": 7811, + "End Line": 7822 + }, { "Function Name": "is_new_day", "Structural Impact": 3.5, @@ -262276,6 +262266,16 @@ "Start Line": 3447, "End Line": 3574 }, + { + "Function Name": "_cleanup_header_comment", + "Structural Impact": 3.0, + "Lines of Code (LOC)": 3, + "Control Flow Branches": 1, + "Input Parameters": 1, + "Control Flow Ratio": "33.3%", + "Start Line": 6862, + "End Line": 6864 + }, { "Function Name": "wp_auth_check", "Structural Impact": 3.0, @@ -262769,7 +262769,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 1156, + "Control Flow Branches": 1119, "Sequential Logic Declarations": 672, "Function Parameters": 256, "Function/Method Declarations": 214, @@ -263008,9 +263008,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -1183.25, - "Y": -105.25, - "Z": -7729.55 + "X": -1183.1, + "Y": -105.27, + "Z": -7729.38 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -263023,15 +263023,15 @@ "Coding LOC": 295, "Documentation LOC": 614, "Structural Magnitude": 407.0, - "Control Flow Ratio": "45.9%", + "Control Flow Ratio": "45.5%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.964 + "Raw Cognitive Density": 0.96 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "35.07%", + "Cognitive Load Exposure": "34.93%", "Error & Exception Exposure": "84.65%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", @@ -263339,7 +263339,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 61, + "Control Flow Branches": 60, "Sequential Logic Declarations": 72, "Function Parameters": 29, "Function/Method Declarations": 29, @@ -263468,9 +263468,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -330.03, - "Y": -352.58, - "Z": -7361.9 + "X": -331.28, + "Y": -352.1, + "Z": -7363.42 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -263482,19 +263482,19 @@ "Total LOC": 1659, "Coding LOC": 983, "Documentation LOC": 404, - "Structural Magnitude": 598.86, - "Control Flow Ratio": "84.4%", + "Structural Magnitude": 511.86, + "Control Flow Ratio": "74.2%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.255 + "Raw Cognitive Density": 1.028 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "44.15%", - "Error & Exception Exposure": "78.34%", + "Cognitive Load Exposure": "37.61%", + "Error & Exception Exposure": "77.41%", "Tech Debt Exposure": "0.0%", - "Testing Exposure": "80.0%", + "Testing Exposure": "2.32%", "API Exposure": "0.0%", "Concurrency Exposure": "14.67%", "State Flux Exposure": "100.0%", @@ -263508,31 +263508,31 @@ "5. Function Analysis": [ { "Function Name": "login_footer", - "Structural Impact": 73.4, + "Structural Impact": 22.5, "Lines of Code (LOC)": 110, - "Control Flow Branches": 47, + "Control Flow Branches": 11, "Input Parameters": 1, - "Control Flow Ratio": "88.7%", + "Control Flow Ratio": "64.7%", "Start Line": 324, "End Line": 433 }, { "Function Name": "login_header", - "Structural Impact": 41.5, + "Structural Impact": 19.4, "Lines of Code (LOC)": 69, - "Control Flow Branches": 18, + "Control Flow Branches": 7, "Input Parameters": 3, - "Control Flow Ratio": "90.0%", + "Control Flow Ratio": "77.8%", "Start Line": 40, "End Line": 108 }, { "Function Name": "wp_login_viewport_meta", - "Structural Impact": 3.2, + "Structural Impact": 1.2, "Lines of Code (LOC)": 5, - "Control Flow Branches": 2, + "Control Flow Branches": 0, "Input Parameters": 0, - "Control Flow Ratio": "66.7%", + "Control Flow Ratio": "0.0%", "Start Line": 469, "End Line": 473 }, @@ -263549,7 +263549,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 504, + "Control Flow Branches": 268, "Sequential Logic Declarations": 93, "Function Parameters": 8, "Function/Method Declarations": 5, @@ -263559,7 +263559,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 111, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 459, + "State Mutations / Variable Reassignments": 447, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 95, "Unit Test Assertions": 0, @@ -263680,9 +263680,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -192.16, - "Y": -226.17, - "Z": -7754.28 + "X": -192.52, + "Y": -226.15, + "Z": -7753.9 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -263694,22 +263694,22 @@ "Total LOC": 798, "Coding LOC": 464, "Documentation LOC": 251, - "Structural Magnitude": 68.28, - "Control Flow Ratio": "5.9%", + "Structural Magnitude": 66.28, + "Control Flow Ratio": "5.7%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.267 + "Raw Cognitive Density": 0.256 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "6.33%", - "Error & Exception Exposure": "58.85%", + "Cognitive Load Exposure": "6.1%", + "Error & Exception Exposure": "58.4%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.3%", "API Exposure": "0.0%", "Concurrency Exposure": "0.0%", - "State Flux Exposure": "81.95%", + "State Flux Exposure": "79.26%", "Commented Logic Exposure": "0.0%", "Specification Exposure": "100.0%", "Instability Exposure": "50.0%", @@ -263720,7 +263720,7 @@ "5. Function Analysis": [], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 34, + "Control Flow Branches": 33, "Sequential Logic Declarations": 541, "Function Parameters": 1, "Function/Method Declarations": 0, @@ -263730,7 +263730,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 44, + "State Mutations / Variable Reassignments": 42, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 32, "Unit Test Assertions": 0, @@ -441407,7 +441407,7 @@ "Unclassified": "100.0%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "46.97%", + "Cognitive Load Exposure": "46.86%", "Error & Exception Exposure": "79.87%", "Tech Debt Exposure": "41.35%", "Testing Exposure": "80.0%", @@ -441455,10 +441455,10 @@ "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.466 + "Raw Cognitive Density": 1.464 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "47.3%", + "Cognitive Load Exposure": "47.28%", "Error & Exception Exposure": "90.38%", "Tech Debt Exposure": "35.38%", "Testing Exposure": "80.0%", @@ -442046,7 +442046,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 307, + "Control Flow Branches": 306, "Sequential Logic Declarations": 258, "Function Parameters": 69, "Function/Method Declarations": 57, @@ -442253,15 +442253,15 @@ "Coding LOC": 1126, "Documentation LOC": 446, "Structural Magnitude": 1533.52, - "Control Flow Ratio": "52.7%", + "Control Flow Ratio": "52.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.575 + "Raw Cognitive Density": 1.573 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "48.22%", + "Cognitive Load Exposure": "48.21%", "Error & Exception Exposure": "74.26%", "Tech Debt Exposure": "65.76%", "Testing Exposure": "80.0%", @@ -443049,7 +443049,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 379, + "Control Flow Branches": 378, "Sequential Logic Declarations": 340, "Function Parameters": 84, "Function/Method Declarations": 77, @@ -443223,15 +443223,15 @@ "Coding LOC": 182, "Documentation LOC": 39, "Structural Magnitude": 290.14, - "Control Flow Ratio": "65.9%", + "Control Flow Ratio": "65.7%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.415 + "Raw Cognitive Density": 1.409 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "62.9%", + "Cognitive Load Exposure": "62.81%", "Error & Exception Exposure": "67.14%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", @@ -443369,7 +443369,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 89, + "Control Flow Branches": 88, "Sequential Logic Declarations": 46, "Function Parameters": 13, "Function/Method Declarations": 12, @@ -443504,15 +443504,15 @@ "Coding LOC": 219, "Documentation LOC": 53, "Structural Magnitude": 268.08, - "Control Flow Ratio": "45.0%", + "Control Flow Ratio": "44.5%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.024 + "Raw Cognitive Density": 1.019 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "45.86%", + "Cognitive Load Exposure": "45.65%", "Error & Exception Exposure": "72.07%", "Tech Debt Exposure": "28.87%", "Testing Exposure": "80.0%", @@ -443620,7 +443620,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 58, + "Control Flow Branches": 57, "Sequential Logic Declarations": 71, "Function Parameters": 10, "Function/Method Declarations": 9, @@ -443776,15 +443776,15 @@ "Coding LOC": 301, "Documentation LOC": 74, "Structural Magnitude": 318.02, - "Control Flow Ratio": "55.2%", + "Control Flow Ratio": "54.9%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.019 + "Raw Cognitive Density": 1.016 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "51.41%", + "Cognitive Load Exposure": "51.24%", "Error & Exception Exposure": "88.76%", "Tech Debt Exposure": "20.8%", "Testing Exposure": "80.0%", @@ -443922,7 +443922,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 79, + "Control Flow Branches": 78, "Sequential Logic Declarations": 64, "Function Parameters": 13, "Function/Method Declarations": 12, @@ -444054,15 +444054,15 @@ "Coding LOC": 1244, "Documentation LOC": 720, "Structural Magnitude": 1696.78, - "Control Flow Ratio": "55.9%", + "Control Flow Ratio": "55.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.065 + "Raw Cognitive Density": 1.064 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "38.96%", + "Cognitive Load Exposure": "38.93%", "Error & Exception Exposure": "90.85%", "Tech Debt Exposure": "83.75%", "Testing Exposure": "80.0%", @@ -445020,7 +445020,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 380, + "Control Flow Branches": 379, "Sequential Logic Declarations": 300, "Function Parameters": 95, "Function/Method Declarations": 94, @@ -445164,15 +445164,15 @@ "Coding LOC": 204, "Documentation LOC": 59, "Structural Magnitude": 179.38, - "Control Flow Ratio": "33.0%", + "Control Flow Ratio": "32.4%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.941 + "Raw Cognitive Density": 0.936 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "34.12%", + "Cognitive Load Exposure": "33.91%", "Error & Exception Exposure": "75.63%", "Tech Debt Exposure": "54.89%", "Testing Exposure": "80.0%", @@ -445370,7 +445370,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 37, + "Control Flow Branches": 36, "Sequential Logic Declarations": 75, "Function Parameters": 21, "Function/Method Declarations": 18, @@ -445505,14 +445505,14 @@ } }, "php/laravel_core": { - "Directory Group Magnitude": 5097.3, + "Directory Group Magnitude": 5050.5, "File Count": 8, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "87.5%", "Static: Literature & Documentation": "12.5%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "32.12%", + "Cognitive Load Exposure": "30.67%", "Error & Exception Exposure": "59.31%", "Tech Debt Exposure": "81.27%", "Testing Exposure": "60.3%", @@ -445697,9 +445697,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": 4533.52, - "Y": -109.1, - "Z": -9551.54 + "X": 3527.22, + "Y": -76.36, + "Z": -9338.09 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -445712,15 +445712,15 @@ "Coding LOC": 763, "Documentation LOC": 748, "Structural Magnitude": 566.76, - "Control Flow Ratio": "21.1%", + "Control Flow Ratio": "20.9%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.801 + "Raw Cognitive Density": 0.799 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "27.55%", + "Cognitive Load Exposure": "27.46%", "Error & Exception Exposure": "61.26%", "Tech Debt Exposure": "98.18%", "Testing Exposure": "80.0%", @@ -446778,7 +446778,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 72, + "Control Flow Branches": 71, "Sequential Logic Declarations": 269, "Function Parameters": 114, "Function/Method Declarations": 104, @@ -446929,9 +446929,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": 3541.07, - "Y": -122.2, - "Z": -9220.3 + "X": 4546.52, + "Y": -154.94, + "Z": -9433.18 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -446943,16 +446943,16 @@ "Total LOC": 1097, "Coding LOC": 531, "Documentation LOC": 418, - "Structural Magnitude": 568.52, - "Control Flow Ratio": "45.1%", + "Structural Magnitude": 521.72, + "Control Flow Ratio": "38.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.389 + "Raw Cognitive Density": 0.968 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "46.39%", + "Cognitive Load Exposure": "35.28%", "Error & Exception Exposure": "78.84%", "Tech Debt Exposure": "79.59%", "Testing Exposure": "80.0%", @@ -446967,16 +446967,6 @@ "Hardcoded Payload Artifacts": "0.0%" }, "5. Function Analysis": [ - { - "Function Name": "if", - "Structural Impact": 46.3, - "Lines of Code (LOC)": 26, - "Control Flow Branches": 25, - "Input Parameters": 2, - "Control Flow Ratio": "67.6%", - "Start Line": 738, - "End Line": 763 - }, { "Function Name": "compileStatements", "Structural Impact": 25.0, @@ -446988,14 +446978,14 @@ "End Line": 593 }, { - "Function Name": "aliasComponent", - "Structural Impact": 16.3, - "Lines of Code (LOC)": 14, - "Control Flow Branches": 8, + "Function Name": "if", + "Structural Impact": 22.1, + "Lines of Code (LOC)": 26, + "Control Flow Branches": 11, "Input Parameters": 2, - "Control Flow Ratio": "57.1%", - "Start Line": 922, - "End Line": 935 + "Control Flow Ratio": "47.8%", + "Start Line": 738, + "End Line": 763 }, { "Function Name": "compileString", @@ -447017,16 +447007,6 @@ "Start Line": 785, "End Line": 804 }, - { - "Function Name": "hasEvenNumberOfParentheses", - "Structural Impact": 12.6, - "Lines of Code (LOC)": 25, - "Control Flow Branches": 7, - "Input Parameters": 1, - "Control Flow Ratio": "58.3%", - "Start Line": 630, - "End Line": 654 - }, { "Function Name": "compile", "Structural Impact": 11.8, @@ -447037,6 +447017,16 @@ "Start Line": 181, "End Line": 218 }, + { + "Function Name": "hasEvenNumberOfParentheses", + "Structural Impact": 11.1, + "Lines of Code (LOC)": 25, + "Control Flow Branches": 6, + "Input Parameters": 1, + "Control Flow Ratio": "54.5%", + "Start Line": 630, + "End Line": 654 + }, { "Function Name": "compileStatement", "Structural Impact": 10.6, @@ -447057,26 +447047,6 @@ "Start Line": 991, "End Line": 998 }, - { - "Function Name": "aliasInclude", - "Structural Impact": 9.2, - "Lines of Code (LOC)": 10, - "Control Flow Branches": 4, - "Input Parameters": 2, - "Control Flow Ratio": "50.0%", - "Start Line": 956, - "End Line": 965 - }, - { - "Function Name": "appendFilePath", - "Structural Impact": 9.0, - "Lines of Code (LOC)": 10, - "Control Flow Branches": 5, - "Input Parameters": 1, - "Control Flow Ratio": "71.4%", - "Start Line": 226, - "End Line": 235 - }, { "Function Name": "getOpenAndClosingPhpTokens", "Structural Impact": 7.7, @@ -447097,16 +447067,6 @@ "Start Line": 604, "End Line": 622 }, - { - "Function Name": "storePhpBlocks", - "Structural Impact": 7.4, - "Lines of Code (LOC)": 6, - "Control Flow Branches": 4, - "Input Parameters": 1, - "Control Flow Ratio": "50.0%", - "Start Line": 430, - "End Line": 435 - }, { "Function Name": "callCustomDirective", "Structural Impact": 7.4, @@ -447147,6 +447107,16 @@ "Start Line": 841, "End Line": 854 }, + { + "Function Name": "aliasComponent", + "Structural Impact": 5.9, + "Lines of Code (LOC)": 14, + "Control Flow Branches": 2, + "Input Parameters": 2, + "Control Flow Ratio": "25.0%", + "Start Line": 922, + "End Line": 935 + }, { "Function Name": "usingEchoFormat", "Structural Impact": 5.9, @@ -447157,6 +447127,16 @@ "Start Line": 1041, "End Line": 1054 }, + { + "Function Name": "aliasInclude", + "Structural Impact": 5.7, + "Lines of Code (LOC)": 10, + "Control Flow Branches": 2, + "Input Parameters": 2, + "Control Flow Ratio": "33.3%", + "Start Line": 956, + "End Line": 965 + }, { "Function Name": "anonymousComponentNamespace", "Structural Impact": 5.6, @@ -447197,6 +447177,16 @@ "Start Line": 513, "End Line": 524 }, + { + "Function Name": "appendFilePath", + "Structural Impact": 4.7, + "Lines of Code (LOC)": 10, + "Control Flow Branches": 2, + "Input Parameters": 1, + "Control Flow Ratio": "50.0%", + "Start Line": 226, + "End Line": 235 + }, { "Function Name": "storeVerbatimBlocks", "Structural Impact": 4.5, @@ -447207,6 +447197,16 @@ "Start Line": 417, "End Line": 422 }, + { + "Function Name": "storePhpBlocks", + "Structural Impact": 4.5, + "Lines of Code (LOC)": 6, + "Control Flow Branches": 2, + "Input Parameters": 1, + "Control Flow Ratio": "33.3%", + "Start Line": 430, + "End Line": 435 + }, { "Function Name": "compileComponentTags", "Structural Impact": 3.3, @@ -447490,7 +447490,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 128, + "Control Flow Branches": 99, "Sequential Logic Declarations": 156, "Function Parameters": 64, "Function/Method Declarations": 52, @@ -447664,15 +447664,15 @@ "Coding LOC": 899, "Documentation LOC": 813, "Structural Magnitude": 1175.18, - "Control Flow Ratio": "31.4%", + "Control Flow Ratio": "31.3%", "Popularity Rank": 8, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.243 + "Raw Cognitive Density": 1.242 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "43.9%", + "Cognitive Load Exposure": "43.87%", "Error & Exception Exposure": "89.42%", "Tech Debt Exposure": "97.52%", "Testing Exposure": "80.0%", @@ -448840,7 +448840,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 147, + "Control Flow Branches": 146, "Sequential Logic Declarations": 321, "Function Parameters": 128, "Function/Method Declarations": 115, @@ -448986,15 +448986,15 @@ "Coding LOC": 835, "Documentation LOC": 770, "Structural Magnitude": 911.7, - "Control Flow Ratio": "42.8%", + "Control Flow Ratio": "42.7%", "Popularity Rank": 3, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.036 + "Raw Cognitive Density": 1.035 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "37.93%", + "Cognitive Load Exposure": "37.89%", "Error & Exception Exposure": "67.81%", "Tech Debt Exposure": "83.64%", "Testing Exposure": "80.0%", @@ -449882,7 +449882,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 179, + "Control Flow Branches": 178, "Sequential Logic Declarations": 239, "Function Parameters": 94, "Function/Method Declarations": 87, @@ -450035,15 +450035,15 @@ "Coding LOC": 196, "Documentation LOC": 126, "Structural Magnitude": 116.12, - "Control Flow Ratio": "22.7%", + "Control Flow Ratio": "21.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.602 + "Raw Cognitive Density": 0.597 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "17.81%", + "Cognitive Load Exposure": "17.58%", "Error & Exception Exposure": "51.18%", "Tech Debt Exposure": "98.77%", "Testing Exposure": "2.4%", @@ -450261,7 +450261,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 17, + "Control Flow Branches": 16, "Sequential Logic Declarations": 58, "Function Parameters": 23, "Function/Method Declarations": 20, @@ -450407,15 +450407,15 @@ "Coding LOC": 1262, "Documentation LOC": 1237, "Structural Magnitude": 1126.54, - "Control Flow Ratio": "30.9%", + "Control Flow Ratio": "30.7%", "Popularity Rank": 3, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.177 + "Raw Cognitive Density": 1.176 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "42.33%", + "Cognitive Load Exposure": "42.3%", "Error & Exception Exposure": "63.13%", "Tech Debt Exposure": "96.78%", "Testing Exposure": "80.0%", @@ -452053,7 +452053,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 191, + "Control Flow Branches": 190, "Sequential Logic Declarations": 428, "Function Parameters": 182, "Function/Method Declarations": 162, @@ -452235,15 +452235,15 @@ "Coding LOC": 669, "Documentation LOC": 679, "Structural Magnitude": 631.48, - "Control Flow Ratio": "26.1%", + "Control Flow Ratio": "25.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.131 + "Raw Cognitive Density": 1.129 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "41.05%", + "Cognitive Load Exposure": "41.0%", "Error & Exception Exposure": "62.82%", "Tech Debt Exposure": "95.71%", "Testing Exposure": "80.0%", @@ -453161,7 +453161,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 93, + "Control Flow Branches": 92, "Sequential Logic Declarations": 264, "Function Parameters": 99, "Function/Method Declarations": 90, @@ -470237,7 +470237,7 @@ "Static: Literature & Documentation": "12.5%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "32.11%", + "Cognitive Load Exposure": "31.64%", "Error & Exception Exposure": "69.35%", "Tech Debt Exposure": "55.9%", "Testing Exposure": "31.23%", @@ -470437,15 +470437,15 @@ "Coding LOC": 567, "Documentation LOC": 556, "Structural Magnitude": 610.14, - "Control Flow Ratio": "30.4%", + "Control Flow Ratio": "30.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.955 + "Raw Cognitive Density": 0.953 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "34.69%", + "Cognitive Load Exposure": "34.62%", "Error & Exception Exposure": "85.65%", "Tech Debt Exposure": "75.32%", "Testing Exposure": "80.0%", @@ -471033,7 +471033,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 70, + "Control Flow Branches": 69, "Sequential Logic Declarations": 160, "Function Parameters": 60, "Function/Method Declarations": 57, @@ -471172,15 +471172,15 @@ "Coding LOC": 484, "Documentation LOC": 487, "Structural Magnitude": 426.18, - "Control Flow Ratio": "30.4%", + "Control Flow Ratio": "30.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.224 + "Raw Cognitive Density": 1.221 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "43.47%", + "Cognitive Load Exposure": "43.4%", "Error & Exception Exposure": "75.21%", "Tech Debt Exposure": "99.95%", "Testing Exposure": "80.0%", @@ -471768,7 +471768,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 63, + "Control Flow Branches": 62, "Sequential Logic Declarations": 144, "Function Parameters": 57, "Function/Method Declarations": 57, @@ -471919,15 +471919,15 @@ "Coding LOC": 30, "Documentation LOC": 35, "Structural Magnitude": 27.5, - "Control Flow Ratio": "31.2%", + "Control Flow Ratio": "26.7%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.983 + "Raw Cognitive Density": 0.95 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "35.89%", + "Cognitive Load Exposure": "34.5%", "Error & Exception Exposure": "65.76%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.5%", @@ -471975,7 +471975,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 5, + "Control Flow Branches": 4, "Sequential Logic Declarations": 11, "Function Parameters": 3, "Function/Method Declarations": 3, @@ -472112,15 +472112,15 @@ "Coding LOC": 76, "Documentation LOC": 68, "Structural Magnitude": 62.62, - "Control Flow Ratio": "26.7%", + "Control Flow Ratio": "24.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.882 + "Raw Cognitive Density": 0.868 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "31.43%", + "Cognitive Load Exposure": "30.81%", "Error & Exception Exposure": "74.9%", "Tech Debt Exposure": "23.43%", "Testing Exposure": "2.44%", @@ -472178,7 +472178,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 8, + "Control Flow Branches": 7, "Sequential Logic Declarations": 22, "Function Parameters": 4, "Function/Method Declarations": 4, @@ -472320,15 +472320,15 @@ "Coding LOC": 85, "Documentation LOC": 57, "Structural Magnitude": 95.9, - "Control Flow Ratio": "42.9%", + "Control Flow Ratio": "40.7%", "Popularity Rank": 1, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.915 + "Raw Cognitive Density": 0.903 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "32.95%", + "Cognitive Load Exposure": "32.42%", "Error & Exception Exposure": "90.81%", "Tech Debt Exposure": "73.68%", "Testing Exposure": "2.48%", @@ -472396,7 +472396,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 12, + "Control Flow Branches": 11, "Sequential Logic Declarations": 16, "Function Parameters": 6, "Function/Method Declarations": 5, @@ -472539,7 +472539,7 @@ "Raw Cognitive Density": 0.996 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "36.4%", + "Cognitive Load Exposure": "36.38%", "Error & Exception Exposure": "94.65%", "Tech Debt Exposure": "74.86%", "Testing Exposure": "80.0%", @@ -473967,7 +473967,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 615, + "Control Flow Branches": 614, "Sequential Logic Declarations": 479, "Function Parameters": 143, "Function/Method Declarations": 141, @@ -474141,15 +474141,15 @@ "Coding LOC": 36, "Documentation LOC": 57, "Structural Magnitude": 29.12, - "Control Flow Ratio": "15.4%", + "Control Flow Ratio": "8.3%", "Popularity Rank": 4, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.167 + "Raw Cognitive Density": 1.128 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "42.06%", + "Cognitive Load Exposure": "40.96%", "Error & Exception Exposure": "67.85%", "Tech Debt Exposure": "99.93%", "Testing Exposure": "2.45%", @@ -474217,7 +474217,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 2, + "Control Flow Branches": 1, "Sequential Logic Declarations": 11, "Function Parameters": 5, "Function/Method Declarations": 5, @@ -495854,7 +495854,7 @@ "Documentation LOC": 18, "Structural Magnitude": 0.83, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 25, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -495976,7 +495976,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 25, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -497854,7 +497854,7 @@ "Documentation LOC": 15, "Structural Magnitude": 0.83, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 10, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -497976,7 +497976,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 10, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -590193,9 +590193,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": 463.33, + "X": 463.32, "Y": -200.51, - "Z": -9534.35 + "Z": -9534.05 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -590353,9 +590353,9 @@ "Identity Proof": "Single Indicator (Ext: .tcl)" }, "2. Topological Coordinates": { - "X": 110.41, + "X": 110.4, "Y": -101.16, - "Z": -8990.29 + "Z": -8989.99 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -590881,9 +590881,9 @@ "Identity Proof": "Single Indicator (Ext: .tcl)" }, "2. Topological Coordinates": { - "X": 356.12, + "X": 356.11, "Y": -98.31, - "Z": -9205.27 + "Z": -9204.97 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -605871,7 +605871,7 @@ "Unclassified": "100.0%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "37.84%", + "Cognitive Load Exposure": "37.63%", "Error & Exception Exposure": "76.97%", "Tech Debt Exposure": "69.42%", "Testing Exposure": "35.36%", @@ -605914,15 +605914,15 @@ "Coding LOC": 274, "Documentation LOC": 154, "Structural Magnitude": 279.18, - "Control Flow Ratio": "53.5%", + "Control Flow Ratio": "53.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.027 + "Raw Cognitive Density": 1.024 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "37.6%", + "Cognitive Load Exposure": "37.47%", "Error & Exception Exposure": "64.89%", "Tech Debt Exposure": "62.5%", "Testing Exposure": "0.0%", @@ -606080,7 +606080,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 69, + "Control Flow Branches": 68, "Sequential Logic Declarations": 60, "Function Parameters": 14, "Function/Method Declarations": 14, @@ -606231,15 +606231,15 @@ "Coding LOC": 557, "Documentation LOC": 87, "Structural Magnitude": 564.94, - "Control Flow Ratio": "61.2%", + "Control Flow Ratio": "61.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.032 + "Raw Cognitive Density": 1.03 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "51.33%", + "Cognitive Load Exposure": "51.24%", "Error & Exception Exposure": "76.82%", "Tech Debt Exposure": "29.23%", "Testing Exposure": "80.0%", @@ -606467,7 +606467,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 150, + "Control Flow Branches": 149, "Sequential Logic Declarations": 95, "Function Parameters": 25, "Function/Method Declarations": 21, @@ -606611,15 +606611,15 @@ "Coding LOC": 165, "Documentation LOC": 78, "Structural Magnitude": 143.4, - "Control Flow Ratio": "47.8%", + "Control Flow Ratio": "47.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.053 + "Raw Cognitive Density": 1.047 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "38.53%", + "Cognitive Load Exposure": "38.32%", "Error & Exception Exposure": "80.78%", "Tech Debt Exposure": "95.05%", "Testing Exposure": "80.0%", @@ -606747,7 +606747,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 33, + "Control Flow Branches": 32, "Sequential Logic Declarations": 36, "Function Parameters": 12, "Function/Method Declarations": 11, @@ -606886,15 +606886,15 @@ "Coding LOC": 154, "Documentation LOC": 92, "Structural Magnitude": 96.68, - "Control Flow Ratio": "13.3%", + "Control Flow Ratio": "12.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.61 + "Raw Cognitive Density": 0.604 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "18.2%", + "Cognitive Load Exposure": "17.9%", "Error & Exception Exposure": "60.86%", "Tech Debt Exposure": "84.82%", "Testing Exposure": "2.45%", @@ -607012,7 +607012,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 16, + "Control Flow Branches": 15, "Sequential Logic Declarations": 104, "Function Parameters": 33, "Function/Method Declarations": 10, @@ -607152,15 +607152,15 @@ "Coding LOC": 64, "Documentation LOC": 50, "Structural Magnitude": 87.08, - "Control Flow Ratio": "27.0%", + "Control Flow Ratio": "25.0%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.5 + "Raw Cognitive Density": 1.484 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "47.63%", + "Cognitive Load Exposure": "47.48%", "Error & Exception Exposure": "86.41%", "Tech Debt Exposure": "80.32%", "Testing Exposure": "2.52%", @@ -607218,7 +607218,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 10, + "Control Flow Branches": 9, "Sequential Logic Declarations": 27, "Function Parameters": 7, "Function/Method Declarations": 4, @@ -607356,15 +607356,15 @@ "Coding LOC": 88, "Documentation LOC": 44, "Structural Magnitude": 123.76, - "Control Flow Ratio": "35.7%", + "Control Flow Ratio": "34.1%", "Popularity Rank": 3, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.943 + "Raw Cognitive Density": 0.932 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "34.21%", + "Cognitive Load Exposure": "33.71%", "Error & Exception Exposure": "90.58%", "Tech Debt Exposure": "99.25%", "Testing Exposure": "2.59%", @@ -607452,7 +607452,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 15, + "Control Flow Branches": 14, "Sequential Logic Declarations": 27, "Function Parameters": 7, "Function/Method Declarations": 7, @@ -607590,15 +607590,15 @@ "Coding LOC": 454, "Documentation LOC": 90, "Structural Magnitude": 535.58, - "Control Flow Ratio": "53.2%", + "Control Flow Ratio": "53.0%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.021 + "Raw Cognitive Density": 1.019 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "37.36%", + "Cognitive Load Exposure": "37.28%", "Error & Exception Exposure": "78.48%", "Tech Debt Exposure": "34.8%", "Testing Exposure": "80.0%", @@ -607816,7 +607816,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 116, + "Control Flow Branches": 115, "Sequential Logic Declarations": 102, "Function Parameters": 27, "Function/Method Declarations": 20, @@ -684821,14 +684821,14 @@ } }, "sql/baseline": { - "Directory Group Magnitude": 829.8, + "Directory Group Magnitude": 825.8, "File Count": 1, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "100.0%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "45.66%", - "Error & Exception Exposure": "80.36%", + "Cognitive Load Exposure": "45.46%", + "Error & Exception Exposure": "80.07%", "Tech Debt Exposure": "11.45%", "Testing Exposure": "80.0%", "API Exposure": "1.91%", @@ -684855,9 +684855,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": 11161.48, + "X": 11161.42, "Y": 4.24, - "Z": 5673.96 + "Z": 5673.93 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -684869,17 +684869,17 @@ "Total LOC": 1427, "Coding LOC": 990, "Documentation LOC": 285, - "Structural Magnitude": 829.8, + "Structural Magnitude": 825.8, "Control Flow Ratio": "85.4%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.339 + "Raw Cognitive Density": 1.326 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "45.66%", - "Error & Exception Exposure": "80.36%", + "Cognitive Load Exposure": "45.46%", + "Error & Exception Exposure": "80.07%", "Tech Debt Exposure": "11.45%", "Testing Exposure": "80.0%", "API Exposure": "1.91%", @@ -685046,7 +685046,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 211, + "Control Flow Branches": 210, "Sequential Logic Declarations": 36, "Function Parameters": 17, "Function/Method Declarations": 15, @@ -685056,7 +685056,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 1, - "State Mutations / Variable Reassignments": 371, + "State Mutations / Variable Reassignments": 367, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 61, "Unit Test Assertions": 1, @@ -709054,7 +709054,7 @@ "Documentation LOC": 0, "Structural Magnitude": 0.77, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 20, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -709176,7 +709176,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 20, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -739385,7 +739385,7 @@ "Documentation LOC": 17, "Structural Magnitude": 0.58, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 2, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -739507,7 +739507,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 2, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -879511,9 +879511,9 @@ "Identity Proof": "Prose Extension (.txt)" }, "2. Topological Coordinates": { - "X": 177.74, + "X": 177.75, "Y": -187.35, - "Z": -8875.03 + "Z": -8874.67 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -879668,9 +879668,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -364.42, + "X": -364.41, "Y": -41.9, - "Z": -8195.73 + "Z": -8195.36 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -879825,9 +879825,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -421.14, + "X": -421.13, "Y": -163.63, - "Z": -9130.52 + "Z": -9130.16 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -879993,9 +879993,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -203.32, + "X": -203.31, "Y": -73.53, - "Z": -8494.17 + "Z": -8493.8 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880152,7 +880152,7 @@ "2. Topological Coordinates": { "X": -302.61, "Y": -26.18, - "Z": -8179.88 + "Z": -8179.52 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880318,9 +880318,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -165.39, + "X": -165.38, "Y": -160.27, - "Z": -8884.71 + "Z": -8884.34 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880477,7 +880477,7 @@ "2. Topological Coordinates": { "X": 43.37, "Y": -67.39, - "Z": -8208.84 + "Z": -8208.47 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880632,9 +880632,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -615.79, + "X": -615.78, "Y": -50.31, - "Z": -8621.84 + "Z": -8621.47 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -890932,9 +890932,9 @@ "Identity Proof": "Single Indicator (Ext: .yml)" }, "2. Topological Coordinates": { - "X": -773.4, + "X": -773.38, "Y": 92.28, - "Z": -9094.62 + "Z": -9094.27 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -891089,9 +891089,9 @@ "Identity Proof": "Single Indicator (Ext: .yml)" }, "2. Topological Coordinates": { - "X": -554.23, + "X": -554.21, "Y": 141.88, - "Z": -9443.11 + "Z": -9442.76 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -906905,7 +906905,7 @@ "2. Topological Coordinates": { "X": -21.85, "Y": -201.21, - "Z": -9698.63 + "Z": -9698.34 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -917745,9 +917745,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": 614.43, + "X": 614.41, "Y": -52.05, - "Z": -9641.03 + "Z": -9640.73 }, "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 87582d9950..95424f1dc2 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-01T23:56:36.489315+00:00", - "Total Scan Duration": "45.14 seconds" + "Analysis ISO Timestamp": "2026-09-02T01:09:43.470855+00:00", + "Total Scan Duration": "44.0 seconds" }, "Source Control Footprint (Immutable Anchor)": { "Active Branch": "HEAD", @@ -236,8 +236,8 @@ } }, "health": { - "avg_cognitive_load": 29.724, - "avg_safety_score": 47.798, + "avg_cognitive_load": 29.715, + "avg_safety_score": 47.797, "avg_tech_debt": 32.218, "avg_documentation": 28.8 }, @@ -455,7 +455,7 @@ "php": { "files": 36, "loc": 27825, - "impact": 32351.800000000003 + "impact": 32159.900000000005 }, "proto": { "files": 4, @@ -1475,9 +1475,9 @@ }, "php/laravel_core": { "file_count": 8, - "total_mass": 5097.3, + "total_mass": 5050.5, "avg_exposures": { - "cognitive_load": 32.12, + "cognitive_load": 30.67, "safety_score": 59.31, "tech_debt": 81.27, "verification": 60.3, @@ -3301,7 +3301,7 @@ "file_count": 8, "total_mass": 4617.2, "avg_exposures": { - "cognitive_load": 32.11, + "cognitive_load": 31.64, "safety_score": 69.35, "tech_debt": 55.9, "verification": 31.23, @@ -3318,15 +3318,15 @@ }, "php/wordpress": { "file_count": 8, - "total_mass": 14369.06, + "total_mass": 14227.96, "avg_exposures": { - "cognitive_load": 27.9, - "safety_score": 69.57, + "cognitive_load": 26.98, + "safety_score": 69.4, "tech_debt": 13.26, - "verification": 50.57, + "verification": 40.86, "api_exposure": 3.47, "concurrency": 4.55, - "state_flux": 79.52, + "state_flux": 79.18, "dead_code": 2.49, "spec_match": 87.5, "stability": 43.75, @@ -5315,7 +5315,7 @@ "file_count": 7, "total_mass": 1830.62, "avg_exposures": { - "cognitive_load": 37.84, + "cognitive_load": 37.63, "safety_score": 76.97, "tech_debt": 69.42, "verification": 35.36, @@ -5334,7 +5334,7 @@ "file_count": 7, "total_mass": 5617.52, "avg_exposures": { - "cognitive_load": 46.97, + "cognitive_load": 46.86, "safety_score": 79.87, "tech_debt": 41.35, "verification": 80.0, @@ -5351,10 +5351,10 @@ }, "sql/baseline": { "file_count": 1, - "total_mass": 829.8, + "total_mass": 825.8, "avg_exposures": { - "cognitive_load": 45.66, - "safety_score": 80.36, + "cognitive_load": 45.46, + "safety_score": 80.07, "tech_debt": 11.45, "verification": 80.0, "api_exposure": 1.91, @@ -257906,20 +257906,20 @@ } }, "php/wordpress": { - "Directory Group Magnitude": 14369.06, + "Directory Group Magnitude": 14227.96, "File Count": 8, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "87.5%", "Static: Literature & Documentation": "12.5%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "27.9%", - "Error & Exception Exposure": "69.57%", + "Cognitive Load Exposure": "26.98%", + "Error & Exception Exposure": "69.4%", "Tech Debt Exposure": "13.26%", - "Testing Exposure": "50.57%", + "Testing Exposure": "40.86%", "API Exposure": "3.47%", "Concurrency Exposure": "4.55%", - "State Flux Exposure": "79.52%", + "State Flux Exposure": "79.18%", "Commented Logic Exposure": "2.49%", "Specification Exposure": "87.5%", "Instability Exposure": "43.75%", @@ -257941,9 +257941,9 @@ "Identity Proof": "Prose Extension (.txt)" }, "2. Topological Coordinates": { - "X": -891.7, - "Y": -107.16, - "Z": -8287.02 + "X": -891.63, + "Y": -107.19, + "Z": -8286.76 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -258098,9 +258098,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -767.68, - "Y": -297.2, - "Z": -7142.14 + "X": -767.63, + "Y": -297.18, + "Z": -7142.13 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -258113,15 +258113,15 @@ "Coding LOC": 147, "Documentation LOC": 41, "Structural Magnitude": 26.94, - "Control Flow Ratio": "80.0%", + "Control Flow Ratio": "78.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.218 + "Raw Cognitive Density": 0.211 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "5.31%", + "Cognitive Load Exposure": "5.19%", "Error & Exception Exposure": "52.04%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.3%", @@ -258138,7 +258138,7 @@ "5. Function Analysis": [], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 12, + "Control Flow Branches": 11, "Sequential Logic Declarations": 3, "Function Parameters": 0, "Function/Method Declarations": 0, @@ -258262,8 +258262,8 @@ }, "2. Topological Coordinates": { "X": -598.55, - "Y": -160.14, - "Z": -7921.85 + "Y": -160.16, + "Z": -7921.57 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -258275,7 +258275,7 @@ "Total LOC": 5114, "Coding LOC": 2653, "Documentation LOC": 1856, - "Structural Magnitude": 3603.06, + "Structural Magnitude": 3601.06, "Control Flow Ratio": "78.3%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, @@ -258285,7 +258285,7 @@ }, "4. Vulnerability & Risk Exposures": { "Cognitive Load Exposure": "48.01%", - "Error & Exception Exposure": "94.11%", + "Error & Exception Exposure": "94.09%", "Tech Debt Exposure": "14.62%", "Testing Exposure": "80.0%", "API Exposure": "9.32%", @@ -258982,7 +258982,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 848, + "Control Flow Branches": 847, "Sequential Logic Declarations": 235, "Function Parameters": 71, "Function/Method Declarations": 68, @@ -258992,7 +258992,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 1, "Exposed API / Public Exports": 112, - "State Mutations / Variable Reassignments": 2143, + "State Mutations / Variable Reassignments": 2141, "Commented-out Code (Dead Logic)": 1, "Structured Documentation Blocks": 444, "Unit Test Assertions": 1, @@ -259136,9 +259136,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -956.52, + "X": -956.37, "Y": -177.82, - "Z": -7355.56 + "Z": -7355.55 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -259150,16 +259150,16 @@ "Total LOC": 6297, "Coding LOC": 3048, "Documentation LOC": 2655, - "Structural Magnitude": 4193.06, - "Control Flow Ratio": "68.9%", + "Structural Magnitude": 4183.36, + "Control Flow Ratio": "68.7%", "Popularity Rank": 1, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.362 + "Raw Cognitive Density": 1.358 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "46.02%", + "Cognitive Load Exposure": "45.96%", "Error & Exception Exposure": "96.39%", "Tech Debt Exposure": "9.5%", "Testing Exposure": "80.0%", @@ -259196,11 +259196,11 @@ }, { "Function Name": "wpautop", - "Structural Impact": 66.9, + "Structural Impact": 61.7, "Lines of Code (LOC)": 160, - "Control Flow Branches": 33, + "Control Flow Branches": 30, "Input Parameters": 2, - "Control Flow Ratio": "86.8%", + "Control Flow Ratio": "85.7%", "Start Line": 445, "End Line": 604 }, @@ -259236,11 +259236,11 @@ }, { "Function Name": "make_clickable", - "Structural Impact": 50.4, + "Structural Impact": 47.6, "Lines of Code (LOC)": 75, - "Control Flow Branches": 32, + "Control Flow Branches": 30, "Input Parameters": 1, - "Control Flow Ratio": "88.9%", + "Control Flow Ratio": "88.2%", "Start Line": 3075, "End Line": 3149 }, @@ -259494,16 +259494,6 @@ "Start Line": 3315, "End Line": 3342 }, - { - "Function Name": "wp_strip_all_tags", - "Structural Impact": 12.2, - "Lines of Code (LOC)": 37, - "Control Flow Branches": 5, - "Input Parameters": 2, - "Control Flow Ratio": "55.6%", - "Start Line": 5514, - "End Line": 5550 - }, { "Function Name": "_split_str_by_whitespace", "Structural Impact": 11.7, @@ -259554,6 +259544,16 @@ "Start Line": 3957, "End Line": 4032 }, + { + "Function Name": "wp_strip_all_tags", + "Structural Impact": 10.5, + "Lines of Code (LOC)": 37, + "Control Flow Branches": 4, + "Input Parameters": 2, + "Control Flow Ratio": "50.0%", + "Start Line": 5514, + "End Line": 5550 + }, { "Function Name": "antispambot", "Structural Impact": 9.5, @@ -260377,7 +260377,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 755, + "Control Flow Branches": 748, "Sequential Logic Declarations": 341, "Function Parameters": 128, "Function/Method Declarations": 120, @@ -260588,9 +260588,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -661.46, + "X": -661.45, "Y": -224.26, - "Z": -7722.54 + "Z": -7722.4 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -260602,16 +260602,16 @@ "Total LOC": 9285, "Coding LOC": 4278, "Documentation LOC": 4024, - "Structural Magnitude": 5464.16, - "Control Flow Ratio": "63.2%", + "Structural Magnitude": 5423.76, + "Control Flow Ratio": "62.5%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.048 + "Raw Cognitive Density": 1.039 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "38.34%", + "Cognitive Load Exposure": "38.03%", "Error & Exception Exposure": "92.21%", "Tech Debt Exposure": "81.98%", "Testing Exposure": "80.0%", @@ -260686,16 +260686,6 @@ "Start Line": 4298, "End Line": 4371 }, - { - "Function Name": "_default_wp_die_handler", - "Structural Impact": 55.5, - "Lines of Code (LOC)": 69, - "Control Flow Branches": 25, - "Input Parameters": 3, - "Control Flow Ratio": "92.6%", - "Start Line": 3867, - "End Line": 3935 - }, { "Function Name": "do_enclose", "Structural Impact": 51.3, @@ -260766,6 +260756,16 @@ "Start Line": 337, "End Line": 410 }, + { + "Function Name": "_default_wp_die_handler", + "Structural Impact": 37.5, + "Lines of Code (LOC)": 69, + "Control Flow Branches": 16, + "Input Parameters": 3, + "Control Flow Ratio": "88.9%", + "Start Line": 3867, + "End Line": 3935 + }, { "Function Name": "_wp_json_sanity_check", "Structural Impact": 37.1, @@ -260886,16 +260886,6 @@ "Start Line": 6604, "End Line": 6649 }, - { - "Function Name": "wp_auth_check_html", - "Structural Impact": 26.5, - "Lines of Code (LOC)": 50, - "Control Flow Branches": 23, - "Input Parameters": 0, - "Control Flow Ratio": "71.9%", - "Start Line": 7495, - "End Line": 7544 - }, { "Function Name": "get_file_data", "Structural Impact": 25.9, @@ -261616,6 +261606,16 @@ "Start Line": 7354, "End Line": 7369 }, + { + "Function Name": "wp_auth_check_html", + "Structural Impact": 6.5, + "Lines of Code (LOC)": 50, + "Control Flow Branches": 3, + "Input Parameters": 0, + "Control Flow Ratio": "25.0%", + "Start Line": 7495, + "End Line": 7544 + }, { "Function Name": "wp_generate_uuid4", "Structural Impact": 6.3, @@ -261886,16 +261886,6 @@ "Start Line": 1691, "End Line": 1697 }, - { - "Function Name": "wp_post_preview_js", - "Structural Impact": 4.6, - "Lines of Code (LOC)": 12, - "Control Flow Branches": 3, - "Input Parameters": 0, - "Control Flow Ratio": "60.0%", - "Start Line": 7811, - "End Line": 7822 - }, { "Function Name": "xmlrpc_removepostdata", "Structural Impact": 4.5, @@ -261946,16 +261936,6 @@ "Start Line": 7580, "End Line": 7585 }, - { - "Function Name": "_cleanup_header_comment", - "Structural Impact": 4.4, - "Lines of Code (LOC)": 3, - "Control Flow Branches": 2, - "Input Parameters": 1, - "Control Flow Ratio": "50.0%", - "Start Line": 6862, - "End Line": 6864 - }, { "Function Name": "wp_unique_id_from_values", "Structural Impact": 4.4, @@ -262076,6 +262056,16 @@ "Start Line": 7752, "End Line": 7767 }, + { + "Function Name": "wp_post_preview_js", + "Structural Impact": 3.6, + "Lines of Code (LOC)": 12, + "Control Flow Branches": 2, + "Input Parameters": 0, + "Control Flow Ratio": "50.0%", + "Start Line": 7811, + "End Line": 7822 + }, { "Function Name": "is_new_day", "Structural Impact": 3.5, @@ -262276,6 +262266,16 @@ "Start Line": 3447, "End Line": 3574 }, + { + "Function Name": "_cleanup_header_comment", + "Structural Impact": 3.0, + "Lines of Code (LOC)": 3, + "Control Flow Branches": 1, + "Input Parameters": 1, + "Control Flow Ratio": "33.3%", + "Start Line": 6862, + "End Line": 6864 + }, { "Function Name": "wp_auth_check", "Structural Impact": 3.0, @@ -262769,7 +262769,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 1156, + "Control Flow Branches": 1119, "Sequential Logic Declarations": 672, "Function Parameters": 256, "Function/Method Declarations": 214, @@ -263008,9 +263008,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -1183.25, - "Y": -105.25, - "Z": -7729.55 + "X": -1183.1, + "Y": -105.27, + "Z": -7729.38 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -263023,15 +263023,15 @@ "Coding LOC": 295, "Documentation LOC": 614, "Structural Magnitude": 407.0, - "Control Flow Ratio": "45.9%", + "Control Flow Ratio": "45.5%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.964 + "Raw Cognitive Density": 0.96 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "35.07%", + "Cognitive Load Exposure": "34.93%", "Error & Exception Exposure": "84.65%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", @@ -263339,7 +263339,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 61, + "Control Flow Branches": 60, "Sequential Logic Declarations": 72, "Function Parameters": 29, "Function/Method Declarations": 29, @@ -263468,9 +263468,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -330.03, - "Y": -352.58, - "Z": -7361.9 + "X": -331.28, + "Y": -352.1, + "Z": -7363.42 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -263482,19 +263482,19 @@ "Total LOC": 1659, "Coding LOC": 983, "Documentation LOC": 404, - "Structural Magnitude": 598.86, - "Control Flow Ratio": "84.4%", + "Structural Magnitude": 511.86, + "Control Flow Ratio": "74.2%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.255 + "Raw Cognitive Density": 1.028 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "44.15%", - "Error & Exception Exposure": "78.34%", + "Cognitive Load Exposure": "37.61%", + "Error & Exception Exposure": "77.41%", "Tech Debt Exposure": "0.0%", - "Testing Exposure": "80.0%", + "Testing Exposure": "2.32%", "API Exposure": "0.0%", "Concurrency Exposure": "14.67%", "State Flux Exposure": "100.0%", @@ -263508,31 +263508,31 @@ "5. Function Analysis": [ { "Function Name": "login_footer", - "Structural Impact": 73.4, + "Structural Impact": 22.5, "Lines of Code (LOC)": 110, - "Control Flow Branches": 47, + "Control Flow Branches": 11, "Input Parameters": 1, - "Control Flow Ratio": "88.7%", + "Control Flow Ratio": "64.7%", "Start Line": 324, "End Line": 433 }, { "Function Name": "login_header", - "Structural Impact": 41.5, + "Structural Impact": 19.4, "Lines of Code (LOC)": 69, - "Control Flow Branches": 18, + "Control Flow Branches": 7, "Input Parameters": 3, - "Control Flow Ratio": "90.0%", + "Control Flow Ratio": "77.8%", "Start Line": 40, "End Line": 108 }, { "Function Name": "wp_login_viewport_meta", - "Structural Impact": 3.2, + "Structural Impact": 1.2, "Lines of Code (LOC)": 5, - "Control Flow Branches": 2, + "Control Flow Branches": 0, "Input Parameters": 0, - "Control Flow Ratio": "66.7%", + "Control Flow Ratio": "0.0%", "Start Line": 469, "End Line": 473 }, @@ -263549,7 +263549,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 504, + "Control Flow Branches": 268, "Sequential Logic Declarations": 93, "Function Parameters": 8, "Function/Method Declarations": 5, @@ -263559,7 +263559,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 111, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 459, + "State Mutations / Variable Reassignments": 447, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 95, "Unit Test Assertions": 0, @@ -263680,9 +263680,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": -192.16, - "Y": -226.17, - "Z": -7754.28 + "X": -192.52, + "Y": -226.15, + "Z": -7753.9 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -263694,22 +263694,22 @@ "Total LOC": 798, "Coding LOC": 464, "Documentation LOC": 251, - "Structural Magnitude": 68.28, - "Control Flow Ratio": "5.9%", + "Structural Magnitude": 66.28, + "Control Flow Ratio": "5.7%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.267 + "Raw Cognitive Density": 0.256 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "6.33%", - "Error & Exception Exposure": "58.85%", + "Cognitive Load Exposure": "6.1%", + "Error & Exception Exposure": "58.4%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.3%", "API Exposure": "0.0%", "Concurrency Exposure": "0.0%", - "State Flux Exposure": "81.95%", + "State Flux Exposure": "79.26%", "Commented Logic Exposure": "0.0%", "Specification Exposure": "100.0%", "Instability Exposure": "50.0%", @@ -263720,7 +263720,7 @@ "5. Function Analysis": [], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 34, + "Control Flow Branches": 33, "Sequential Logic Declarations": 541, "Function Parameters": 1, "Function/Method Declarations": 0, @@ -263730,7 +263730,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 0, - "State Mutations / Variable Reassignments": 44, + "State Mutations / Variable Reassignments": 42, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 32, "Unit Test Assertions": 0, @@ -441407,7 +441407,7 @@ "Unclassified": "100.0%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "46.97%", + "Cognitive Load Exposure": "46.86%", "Error & Exception Exposure": "79.87%", "Tech Debt Exposure": "41.35%", "Testing Exposure": "80.0%", @@ -441455,10 +441455,10 @@ "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.466 + "Raw Cognitive Density": 1.464 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "47.3%", + "Cognitive Load Exposure": "47.28%", "Error & Exception Exposure": "90.38%", "Tech Debt Exposure": "35.38%", "Testing Exposure": "80.0%", @@ -442046,7 +442046,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 307, + "Control Flow Branches": 306, "Sequential Logic Declarations": 258, "Function Parameters": 69, "Function/Method Declarations": 57, @@ -442253,15 +442253,15 @@ "Coding LOC": 1126, "Documentation LOC": 446, "Structural Magnitude": 1533.52, - "Control Flow Ratio": "52.7%", + "Control Flow Ratio": "52.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.575 + "Raw Cognitive Density": 1.573 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "48.22%", + "Cognitive Load Exposure": "48.21%", "Error & Exception Exposure": "74.26%", "Tech Debt Exposure": "65.76%", "Testing Exposure": "80.0%", @@ -443049,7 +443049,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 379, + "Control Flow Branches": 378, "Sequential Logic Declarations": 340, "Function Parameters": 84, "Function/Method Declarations": 77, @@ -443223,15 +443223,15 @@ "Coding LOC": 182, "Documentation LOC": 39, "Structural Magnitude": 290.14, - "Control Flow Ratio": "65.9%", + "Control Flow Ratio": "65.7%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.415 + "Raw Cognitive Density": 1.409 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "62.9%", + "Cognitive Load Exposure": "62.81%", "Error & Exception Exposure": "67.14%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "80.0%", @@ -443369,7 +443369,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 89, + "Control Flow Branches": 88, "Sequential Logic Declarations": 46, "Function Parameters": 13, "Function/Method Declarations": 12, @@ -443504,15 +443504,15 @@ "Coding LOC": 219, "Documentation LOC": 53, "Structural Magnitude": 268.08, - "Control Flow Ratio": "45.0%", + "Control Flow Ratio": "44.5%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.024 + "Raw Cognitive Density": 1.019 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "45.86%", + "Cognitive Load Exposure": "45.65%", "Error & Exception Exposure": "72.07%", "Tech Debt Exposure": "28.87%", "Testing Exposure": "80.0%", @@ -443620,7 +443620,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 58, + "Control Flow Branches": 57, "Sequential Logic Declarations": 71, "Function Parameters": 10, "Function/Method Declarations": 9, @@ -443776,15 +443776,15 @@ "Coding LOC": 301, "Documentation LOC": 74, "Structural Magnitude": 318.02, - "Control Flow Ratio": "55.2%", + "Control Flow Ratio": "54.9%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.019 + "Raw Cognitive Density": 1.016 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "51.41%", + "Cognitive Load Exposure": "51.24%", "Error & Exception Exposure": "88.76%", "Tech Debt Exposure": "20.8%", "Testing Exposure": "80.0%", @@ -443922,7 +443922,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 79, + "Control Flow Branches": 78, "Sequential Logic Declarations": 64, "Function Parameters": 13, "Function/Method Declarations": 12, @@ -444054,15 +444054,15 @@ "Coding LOC": 1244, "Documentation LOC": 720, "Structural Magnitude": 1696.78, - "Control Flow Ratio": "55.9%", + "Control Flow Ratio": "55.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.065 + "Raw Cognitive Density": 1.064 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "38.96%", + "Cognitive Load Exposure": "38.93%", "Error & Exception Exposure": "90.85%", "Tech Debt Exposure": "83.75%", "Testing Exposure": "80.0%", @@ -445020,7 +445020,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 380, + "Control Flow Branches": 379, "Sequential Logic Declarations": 300, "Function Parameters": 95, "Function/Method Declarations": 94, @@ -445164,15 +445164,15 @@ "Coding LOC": 204, "Documentation LOC": 59, "Structural Magnitude": 179.38, - "Control Flow Ratio": "33.0%", + "Control Flow Ratio": "32.4%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.941 + "Raw Cognitive Density": 0.936 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "34.12%", + "Cognitive Load Exposure": "33.91%", "Error & Exception Exposure": "75.63%", "Tech Debt Exposure": "54.89%", "Testing Exposure": "80.0%", @@ -445370,7 +445370,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 37, + "Control Flow Branches": 36, "Sequential Logic Declarations": 75, "Function Parameters": 21, "Function/Method Declarations": 18, @@ -445505,14 +445505,14 @@ } }, "php/laravel_core": { - "Directory Group Magnitude": 5097.3, + "Directory Group Magnitude": 5050.5, "File Count": 8, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "87.5%", "Static: Literature & Documentation": "12.5%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "32.12%", + "Cognitive Load Exposure": "30.67%", "Error & Exception Exposure": "59.31%", "Tech Debt Exposure": "81.27%", "Testing Exposure": "60.3%", @@ -445697,9 +445697,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": 4533.52, - "Y": -109.1, - "Z": -9551.54 + "X": 3527.22, + "Y": -76.36, + "Z": -9338.09 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -445712,15 +445712,15 @@ "Coding LOC": 763, "Documentation LOC": 748, "Structural Magnitude": 566.76, - "Control Flow Ratio": "21.1%", + "Control Flow Ratio": "20.9%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.801 + "Raw Cognitive Density": 0.799 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "27.55%", + "Cognitive Load Exposure": "27.46%", "Error & Exception Exposure": "61.26%", "Tech Debt Exposure": "98.18%", "Testing Exposure": "80.0%", @@ -446778,7 +446778,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 72, + "Control Flow Branches": 71, "Sequential Logic Declarations": 269, "Function Parameters": 114, "Function/Method Declarations": 104, @@ -446929,9 +446929,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": 3541.07, - "Y": -122.2, - "Z": -9220.3 + "X": 4546.52, + "Y": -154.94, + "Z": -9433.18 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -446943,16 +446943,16 @@ "Total LOC": 1097, "Coding LOC": 531, "Documentation LOC": 418, - "Structural Magnitude": 568.52, - "Control Flow Ratio": "45.1%", + "Structural Magnitude": 521.72, + "Control Flow Ratio": "38.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.389 + "Raw Cognitive Density": 0.968 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "46.39%", + "Cognitive Load Exposure": "35.28%", "Error & Exception Exposure": "78.84%", "Tech Debt Exposure": "79.59%", "Testing Exposure": "80.0%", @@ -446967,16 +446967,6 @@ "Hardcoded Payload Artifacts": "0.0%" }, "5. Function Analysis": [ - { - "Function Name": "if", - "Structural Impact": 46.3, - "Lines of Code (LOC)": 26, - "Control Flow Branches": 25, - "Input Parameters": 2, - "Control Flow Ratio": "67.6%", - "Start Line": 738, - "End Line": 763 - }, { "Function Name": "compileStatements", "Structural Impact": 25.0, @@ -446988,14 +446978,14 @@ "End Line": 593 }, { - "Function Name": "aliasComponent", - "Structural Impact": 16.3, - "Lines of Code (LOC)": 14, - "Control Flow Branches": 8, + "Function Name": "if", + "Structural Impact": 22.1, + "Lines of Code (LOC)": 26, + "Control Flow Branches": 11, "Input Parameters": 2, - "Control Flow Ratio": "57.1%", - "Start Line": 922, - "End Line": 935 + "Control Flow Ratio": "47.8%", + "Start Line": 738, + "End Line": 763 }, { "Function Name": "compileString", @@ -447017,16 +447007,6 @@ "Start Line": 785, "End Line": 804 }, - { - "Function Name": "hasEvenNumberOfParentheses", - "Structural Impact": 12.6, - "Lines of Code (LOC)": 25, - "Control Flow Branches": 7, - "Input Parameters": 1, - "Control Flow Ratio": "58.3%", - "Start Line": 630, - "End Line": 654 - }, { "Function Name": "compile", "Structural Impact": 11.8, @@ -447037,6 +447017,16 @@ "Start Line": 181, "End Line": 218 }, + { + "Function Name": "hasEvenNumberOfParentheses", + "Structural Impact": 11.1, + "Lines of Code (LOC)": 25, + "Control Flow Branches": 6, + "Input Parameters": 1, + "Control Flow Ratio": "54.5%", + "Start Line": 630, + "End Line": 654 + }, { "Function Name": "compileStatement", "Structural Impact": 10.6, @@ -447057,26 +447047,6 @@ "Start Line": 991, "End Line": 998 }, - { - "Function Name": "aliasInclude", - "Structural Impact": 9.2, - "Lines of Code (LOC)": 10, - "Control Flow Branches": 4, - "Input Parameters": 2, - "Control Flow Ratio": "50.0%", - "Start Line": 956, - "End Line": 965 - }, - { - "Function Name": "appendFilePath", - "Structural Impact": 9.0, - "Lines of Code (LOC)": 10, - "Control Flow Branches": 5, - "Input Parameters": 1, - "Control Flow Ratio": "71.4%", - "Start Line": 226, - "End Line": 235 - }, { "Function Name": "getOpenAndClosingPhpTokens", "Structural Impact": 7.7, @@ -447097,16 +447067,6 @@ "Start Line": 604, "End Line": 622 }, - { - "Function Name": "storePhpBlocks", - "Structural Impact": 7.4, - "Lines of Code (LOC)": 6, - "Control Flow Branches": 4, - "Input Parameters": 1, - "Control Flow Ratio": "50.0%", - "Start Line": 430, - "End Line": 435 - }, { "Function Name": "callCustomDirective", "Structural Impact": 7.4, @@ -447147,6 +447107,16 @@ "Start Line": 841, "End Line": 854 }, + { + "Function Name": "aliasComponent", + "Structural Impact": 5.9, + "Lines of Code (LOC)": 14, + "Control Flow Branches": 2, + "Input Parameters": 2, + "Control Flow Ratio": "25.0%", + "Start Line": 922, + "End Line": 935 + }, { "Function Name": "usingEchoFormat", "Structural Impact": 5.9, @@ -447157,6 +447127,16 @@ "Start Line": 1041, "End Line": 1054 }, + { + "Function Name": "aliasInclude", + "Structural Impact": 5.7, + "Lines of Code (LOC)": 10, + "Control Flow Branches": 2, + "Input Parameters": 2, + "Control Flow Ratio": "33.3%", + "Start Line": 956, + "End Line": 965 + }, { "Function Name": "anonymousComponentNamespace", "Structural Impact": 5.6, @@ -447197,6 +447177,16 @@ "Start Line": 513, "End Line": 524 }, + { + "Function Name": "appendFilePath", + "Structural Impact": 4.7, + "Lines of Code (LOC)": 10, + "Control Flow Branches": 2, + "Input Parameters": 1, + "Control Flow Ratio": "50.0%", + "Start Line": 226, + "End Line": 235 + }, { "Function Name": "storeVerbatimBlocks", "Structural Impact": 4.5, @@ -447207,6 +447197,16 @@ "Start Line": 417, "End Line": 422 }, + { + "Function Name": "storePhpBlocks", + "Structural Impact": 4.5, + "Lines of Code (LOC)": 6, + "Control Flow Branches": 2, + "Input Parameters": 1, + "Control Flow Ratio": "33.3%", + "Start Line": 430, + "End Line": 435 + }, { "Function Name": "compileComponentTags", "Structural Impact": 3.3, @@ -447490,7 +447490,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 128, + "Control Flow Branches": 99, "Sequential Logic Declarations": 156, "Function Parameters": 64, "Function/Method Declarations": 52, @@ -447664,15 +447664,15 @@ "Coding LOC": 899, "Documentation LOC": 813, "Structural Magnitude": 1175.18, - "Control Flow Ratio": "31.4%", + "Control Flow Ratio": "31.3%", "Popularity Rank": 9, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.243 + "Raw Cognitive Density": 1.242 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "43.9%", + "Cognitive Load Exposure": "43.87%", "Error & Exception Exposure": "89.42%", "Tech Debt Exposure": "97.52%", "Testing Exposure": "80.0%", @@ -448840,7 +448840,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 147, + "Control Flow Branches": 146, "Sequential Logic Declarations": 321, "Function Parameters": 128, "Function/Method Declarations": 115, @@ -448986,15 +448986,15 @@ "Coding LOC": 835, "Documentation LOC": 770, "Structural Magnitude": 911.7, - "Control Flow Ratio": "42.8%", + "Control Flow Ratio": "42.7%", "Popularity Rank": 3, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.036 + "Raw Cognitive Density": 1.035 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "37.93%", + "Cognitive Load Exposure": "37.89%", "Error & Exception Exposure": "67.81%", "Tech Debt Exposure": "83.64%", "Testing Exposure": "80.0%", @@ -449882,7 +449882,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 179, + "Control Flow Branches": 178, "Sequential Logic Declarations": 239, "Function Parameters": 94, "Function/Method Declarations": 87, @@ -450035,15 +450035,15 @@ "Coding LOC": 196, "Documentation LOC": 126, "Structural Magnitude": 116.12, - "Control Flow Ratio": "22.7%", + "Control Flow Ratio": "21.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.602 + "Raw Cognitive Density": 0.597 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "17.81%", + "Cognitive Load Exposure": "17.58%", "Error & Exception Exposure": "51.18%", "Tech Debt Exposure": "98.77%", "Testing Exposure": "2.4%", @@ -450261,7 +450261,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 17, + "Control Flow Branches": 16, "Sequential Logic Declarations": 58, "Function Parameters": 23, "Function/Method Declarations": 20, @@ -450407,15 +450407,15 @@ "Coding LOC": 1262, "Documentation LOC": 1237, "Structural Magnitude": 1126.54, - "Control Flow Ratio": "30.9%", + "Control Flow Ratio": "30.7%", "Popularity Rank": 3, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.177 + "Raw Cognitive Density": 1.176 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "42.33%", + "Cognitive Load Exposure": "42.3%", "Error & Exception Exposure": "63.13%", "Tech Debt Exposure": "96.78%", "Testing Exposure": "80.0%", @@ -452053,7 +452053,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 191, + "Control Flow Branches": 190, "Sequential Logic Declarations": 428, "Function Parameters": 182, "Function/Method Declarations": 162, @@ -452235,15 +452235,15 @@ "Coding LOC": 669, "Documentation LOC": 679, "Structural Magnitude": 631.48, - "Control Flow Ratio": "26.1%", + "Control Flow Ratio": "25.8%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.131 + "Raw Cognitive Density": 1.129 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "41.05%", + "Cognitive Load Exposure": "41.0%", "Error & Exception Exposure": "62.82%", "Tech Debt Exposure": "95.71%", "Testing Exposure": "80.0%", @@ -453161,7 +453161,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 93, + "Control Flow Branches": 92, "Sequential Logic Declarations": 264, "Function Parameters": 99, "Function/Method Declarations": 90, @@ -470237,7 +470237,7 @@ "Static: Literature & Documentation": "12.5%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "32.11%", + "Cognitive Load Exposure": "31.64%", "Error & Exception Exposure": "69.35%", "Tech Debt Exposure": "55.9%", "Testing Exposure": "31.23%", @@ -470437,15 +470437,15 @@ "Coding LOC": 567, "Documentation LOC": 556, "Structural Magnitude": 610.14, - "Control Flow Ratio": "30.4%", + "Control Flow Ratio": "30.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.955 + "Raw Cognitive Density": 0.953 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "34.69%", + "Cognitive Load Exposure": "34.62%", "Error & Exception Exposure": "85.65%", "Tech Debt Exposure": "75.32%", "Testing Exposure": "80.0%", @@ -471033,7 +471033,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 70, + "Control Flow Branches": 69, "Sequential Logic Declarations": 160, "Function Parameters": 60, "Function/Method Declarations": 57, @@ -471172,15 +471172,15 @@ "Coding LOC": 484, "Documentation LOC": 487, "Structural Magnitude": 426.18, - "Control Flow Ratio": "30.4%", + "Control Flow Ratio": "30.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.224 + "Raw Cognitive Density": 1.221 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "43.47%", + "Cognitive Load Exposure": "43.4%", "Error & Exception Exposure": "75.21%", "Tech Debt Exposure": "99.95%", "Testing Exposure": "80.0%", @@ -471768,7 +471768,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 63, + "Control Flow Branches": 62, "Sequential Logic Declarations": 144, "Function Parameters": 57, "Function/Method Declarations": 57, @@ -471919,15 +471919,15 @@ "Coding LOC": 30, "Documentation LOC": 35, "Structural Magnitude": 27.5, - "Control Flow Ratio": "31.2%", + "Control Flow Ratio": "26.7%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.983 + "Raw Cognitive Density": 0.95 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "35.89%", + "Cognitive Load Exposure": "34.5%", "Error & Exception Exposure": "65.76%", "Tech Debt Exposure": "0.0%", "Testing Exposure": "2.5%", @@ -471975,7 +471975,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 5, + "Control Flow Branches": 4, "Sequential Logic Declarations": 11, "Function Parameters": 3, "Function/Method Declarations": 3, @@ -472112,15 +472112,15 @@ "Coding LOC": 76, "Documentation LOC": 68, "Structural Magnitude": 62.62, - "Control Flow Ratio": "26.7%", + "Control Flow Ratio": "24.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.882 + "Raw Cognitive Density": 0.868 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "31.43%", + "Cognitive Load Exposure": "30.81%", "Error & Exception Exposure": "74.9%", "Tech Debt Exposure": "23.43%", "Testing Exposure": "2.44%", @@ -472178,7 +472178,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 8, + "Control Flow Branches": 7, "Sequential Logic Declarations": 22, "Function Parameters": 4, "Function/Method Declarations": 4, @@ -472320,15 +472320,15 @@ "Coding LOC": 85, "Documentation LOC": 57, "Structural Magnitude": 95.9, - "Control Flow Ratio": "42.9%", + "Control Flow Ratio": "40.7%", "Popularity Rank": 1, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.915 + "Raw Cognitive Density": 0.903 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "32.95%", + "Cognitive Load Exposure": "32.42%", "Error & Exception Exposure": "90.81%", "Tech Debt Exposure": "73.68%", "Testing Exposure": "2.48%", @@ -472396,7 +472396,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 12, + "Control Flow Branches": 11, "Sequential Logic Declarations": 16, "Function Parameters": 6, "Function/Method Declarations": 5, @@ -472539,7 +472539,7 @@ "Raw Cognitive Density": 0.996 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "36.4%", + "Cognitive Load Exposure": "36.38%", "Error & Exception Exposure": "94.65%", "Tech Debt Exposure": "74.86%", "Testing Exposure": "80.0%", @@ -473967,7 +473967,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 615, + "Control Flow Branches": 614, "Sequential Logic Declarations": 479, "Function Parameters": 143, "Function/Method Declarations": 141, @@ -474141,15 +474141,15 @@ "Coding LOC": 36, "Documentation LOC": 57, "Structural Magnitude": 29.12, - "Control Flow Ratio": "15.4%", + "Control Flow Ratio": "8.3%", "Popularity Rank": 4, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.167 + "Raw Cognitive Density": 1.128 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "42.06%", + "Cognitive Load Exposure": "40.96%", "Error & Exception Exposure": "67.85%", "Tech Debt Exposure": "99.93%", "Testing Exposure": "2.45%", @@ -474217,7 +474217,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 2, + "Control Flow Branches": 1, "Sequential Logic Declarations": 11, "Function Parameters": 5, "Function/Method Declarations": 5, @@ -495854,7 +495854,7 @@ "Documentation LOC": 18, "Structural Magnitude": 0.83, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 25, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -495976,7 +495976,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 25, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -497854,7 +497854,7 @@ "Documentation LOC": 15, "Structural Magnitude": 0.83, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 10, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -497976,7 +497976,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 10, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -590193,9 +590193,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": 463.33, + "X": 463.32, "Y": -200.51, - "Z": -9534.35 + "Z": -9534.05 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -590353,9 +590353,9 @@ "Identity Proof": "Single Indicator (Ext: .tcl)" }, "2. Topological Coordinates": { - "X": 110.41, + "X": 110.4, "Y": -101.16, - "Z": -8990.29 + "Z": -8989.99 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -590881,9 +590881,9 @@ "Identity Proof": "Single Indicator (Ext: .tcl)" }, "2. Topological Coordinates": { - "X": 356.12, + "X": 356.11, "Y": -98.31, - "Z": -9205.27 + "Z": -9204.97 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -605871,7 +605871,7 @@ "Unclassified": "100.0%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "37.84%", + "Cognitive Load Exposure": "37.63%", "Error & Exception Exposure": "76.97%", "Tech Debt Exposure": "69.42%", "Testing Exposure": "35.36%", @@ -605914,15 +605914,15 @@ "Coding LOC": 274, "Documentation LOC": 154, "Structural Magnitude": 279.18, - "Control Flow Ratio": "53.5%", + "Control Flow Ratio": "53.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.027 + "Raw Cognitive Density": 1.024 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "37.6%", + "Cognitive Load Exposure": "37.47%", "Error & Exception Exposure": "64.89%", "Tech Debt Exposure": "62.5%", "Testing Exposure": "0.0%", @@ -606080,7 +606080,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 69, + "Control Flow Branches": 68, "Sequential Logic Declarations": 60, "Function Parameters": 14, "Function/Method Declarations": 14, @@ -606231,15 +606231,15 @@ "Coding LOC": 557, "Documentation LOC": 87, "Structural Magnitude": 564.94, - "Control Flow Ratio": "61.2%", + "Control Flow Ratio": "61.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.032 + "Raw Cognitive Density": 1.03 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "51.33%", + "Cognitive Load Exposure": "51.24%", "Error & Exception Exposure": "76.82%", "Tech Debt Exposure": "29.23%", "Testing Exposure": "80.0%", @@ -606467,7 +606467,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 150, + "Control Flow Branches": 149, "Sequential Logic Declarations": 95, "Function Parameters": 25, "Function/Method Declarations": 21, @@ -606611,15 +606611,15 @@ "Coding LOC": 165, "Documentation LOC": 78, "Structural Magnitude": 143.4, - "Control Flow Ratio": "47.8%", + "Control Flow Ratio": "47.1%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.053 + "Raw Cognitive Density": 1.047 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "38.53%", + "Cognitive Load Exposure": "38.32%", "Error & Exception Exposure": "80.78%", "Tech Debt Exposure": "95.05%", "Testing Exposure": "80.0%", @@ -606747,7 +606747,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 33, + "Control Flow Branches": 32, "Sequential Logic Declarations": 36, "Function Parameters": 12, "Function/Method Declarations": 11, @@ -606886,15 +606886,15 @@ "Coding LOC": 154, "Documentation LOC": 92, "Structural Magnitude": 96.68, - "Control Flow Ratio": "13.3%", + "Control Flow Ratio": "12.6%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.61 + "Raw Cognitive Density": 0.604 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "18.2%", + "Cognitive Load Exposure": "17.9%", "Error & Exception Exposure": "60.86%", "Tech Debt Exposure": "84.82%", "Testing Exposure": "2.45%", @@ -607012,7 +607012,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 16, + "Control Flow Branches": 15, "Sequential Logic Declarations": 104, "Function Parameters": 33, "Function/Method Declarations": 10, @@ -607152,15 +607152,15 @@ "Coding LOC": 64, "Documentation LOC": 50, "Structural Magnitude": 87.08, - "Control Flow Ratio": "27.0%", + "Control Flow Ratio": "25.0%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.5 + "Raw Cognitive Density": 1.484 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "47.63%", + "Cognitive Load Exposure": "47.48%", "Error & Exception Exposure": "86.41%", "Tech Debt Exposure": "80.32%", "Testing Exposure": "2.52%", @@ -607218,7 +607218,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 10, + "Control Flow Branches": 9, "Sequential Logic Declarations": 27, "Function Parameters": 7, "Function/Method Declarations": 4, @@ -607356,15 +607356,15 @@ "Coding LOC": 88, "Documentation LOC": 44, "Structural Magnitude": 123.76, - "Control Flow Ratio": "35.7%", + "Control Flow Ratio": "34.1%", "Popularity Rank": 3, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 0.943 + "Raw Cognitive Density": 0.932 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "34.21%", + "Cognitive Load Exposure": "33.71%", "Error & Exception Exposure": "90.58%", "Tech Debt Exposure": "99.25%", "Testing Exposure": "2.59%", @@ -607452,7 +607452,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 15, + "Control Flow Branches": 14, "Sequential Logic Declarations": 27, "Function Parameters": 7, "Function/Method Declarations": 7, @@ -607590,15 +607590,15 @@ "Coding LOC": 454, "Documentation LOC": 90, "Structural Magnitude": 535.58, - "Control Flow Ratio": "53.2%", + "Control Flow Ratio": "53.0%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.021 + "Raw Cognitive Density": 1.019 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "37.36%", + "Cognitive Load Exposure": "37.28%", "Error & Exception Exposure": "78.48%", "Tech Debt Exposure": "34.8%", "Testing Exposure": "80.0%", @@ -607816,7 +607816,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 116, + "Control Flow Branches": 115, "Sequential Logic Declarations": 102, "Function Parameters": 27, "Function/Method Declarations": 20, @@ -684821,14 +684821,14 @@ } }, "sql/baseline": { - "Directory Group Magnitude": 829.8, + "Directory Group Magnitude": 825.8, "File Count": 1, "Ecosystem Fingerprint (Archetypes)": { "Unclassified": "100.0%" }, "Average Risk Exposures": { - "Cognitive Load Exposure": "45.66%", - "Error & Exception Exposure": "80.36%", + "Cognitive Load Exposure": "45.46%", + "Error & Exception Exposure": "80.07%", "Tech Debt Exposure": "11.45%", "Testing Exposure": "80.0%", "API Exposure": "1.91%", @@ -684855,9 +684855,9 @@ "Identity Proof": "Single Indicator (Ext: .php)" }, "2. Topological Coordinates": { - "X": 11161.48, + "X": 11161.42, "Y": 4.24, - "Z": 5673.96 + "Z": 5673.93 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -684869,17 +684869,17 @@ "Total LOC": 1427, "Coding LOC": 990, "Documentation LOC": 285, - "Structural Magnitude": 829.8, + "Structural Magnitude": 825.8, "Control Flow Ratio": "85.4%", "Popularity Rank": 0, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, - "Raw Cognitive Density": 1.339 + "Raw Cognitive Density": 1.326 }, "4. Vulnerability & Risk Exposures": { - "Cognitive Load Exposure": "45.66%", - "Error & Exception Exposure": "80.36%", + "Cognitive Load Exposure": "45.46%", + "Error & Exception Exposure": "80.07%", "Tech Debt Exposure": "11.45%", "Testing Exposure": "80.0%", "API Exposure": "1.91%", @@ -685046,7 +685046,7 @@ ], "6. Contextual Mitigations & Amplifications": "None Detected", "7. Structural Signatures (Net Mitigated Signals)": { - "Control Flow Branches": 211, + "Control Flow Branches": 210, "Sequential Logic Declarations": 36, "Function Parameters": 17, "Function/Method Declarations": 15, @@ -685056,7 +685056,7 @@ "High-Risk Execution Commands": 0, "I/O and Network Boundaries": 0, "Exposed API / Public Exports": 1, - "State Mutations / Variable Reassignments": 371, + "State Mutations / Variable Reassignments": 367, "Commented-out Code (Dead Logic)": 0, "Structured Documentation Blocks": 61, "Unit Test Assertions": 1, @@ -709054,7 +709054,7 @@ "Documentation LOC": 0, "Structural Magnitude": 0.77, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 20, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -709176,7 +709176,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 20, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -739385,7 +739385,7 @@ "Documentation LOC": 17, "Structural Magnitude": 0.58, "Control Flow Ratio": "0.0%", - "Popularity Rank": 0, + "Popularity Rank": 2, "Raw Churn Frequency": 0.0, "Authorship Centralization": 0.0, "Ownership Entropy": 0.0, @@ -739507,7 +739507,7 @@ }, "8. Dependency Network": { "Direct Upstream (Fragility)": 0, - "Direct Downstream (Dependency Blast Radius)": 0, + "Direct Downstream (Dependency Blast Radius)": 2, "Total Upstream (Absolute Fragility)": 0, "Total Downstream (Absolute Dependency Blast Radius)": 0 }, @@ -879511,9 +879511,9 @@ "Identity Proof": "Prose Extension (.txt)" }, "2. Topological Coordinates": { - "X": 177.74, + "X": 177.75, "Y": -187.35, - "Z": -8875.03 + "Z": -8874.67 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -879668,9 +879668,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -364.42, + "X": -364.41, "Y": -41.9, - "Z": -8195.73 + "Z": -8195.36 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -879825,9 +879825,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -421.14, + "X": -421.13, "Y": -163.63, - "Z": -9130.52 + "Z": -9130.16 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -879993,9 +879993,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -203.32, + "X": -203.31, "Y": -73.53, - "Z": -8494.17 + "Z": -8493.8 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880152,7 +880152,7 @@ "2. Topological Coordinates": { "X": -302.61, "Y": -26.18, - "Z": -8179.88 + "Z": -8179.52 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880318,9 +880318,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -165.39, + "X": -165.38, "Y": -160.27, - "Z": -8884.71 + "Z": -8884.34 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880477,7 +880477,7 @@ "2. Topological Coordinates": { "X": 43.37, "Y": -67.39, - "Z": -8208.84 + "Z": -8208.47 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -880632,9 +880632,9 @@ "Identity Proof": "Single Indicator (Ext: .gradle)" }, "2. Topological Coordinates": { - "X": -615.79, + "X": -615.78, "Y": -50.31, - "Z": -8621.84 + "Z": -8621.47 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -890932,9 +890932,9 @@ "Identity Proof": "Single Indicator (Ext: .yml)" }, "2. Topological Coordinates": { - "X": -773.4, + "X": -773.38, "Y": 92.28, - "Z": -9094.62 + "Z": -9094.27 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -891089,9 +891089,9 @@ "Identity Proof": "Single Indicator (Ext: .yml)" }, "2. Topological Coordinates": { - "X": -554.23, + "X": -554.21, "Y": 141.88, - "Z": -9443.11 + "Z": -9442.76 }, "3. Architectural Profile": { "Repository Archetype": "Unclassified", @@ -906905,7 +906905,7 @@ "2. Topological Coordinates": { "X": -21.85, "Y": -201.21, - "Z": -9698.63 + "Z": -9698.34 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", @@ -917745,9 +917745,9 @@ "Identity Proof": "Prose Extension (.md)" }, "2. Topological Coordinates": { - "X": 614.43, + "X": 614.41, "Y": -52.05, - "Z": -9641.03 + "Z": -9640.73 }, "3. Architectural Profile": { "Repository Archetype": "Static: Literature & Documentation", diff --git a/tests/security_auditing/test_network_risk_sensor.py b/tests/security_auditing/test_network_risk_sensor.py index 7e0e880aed..7fbd40c7c9 100644 --- a/tests/security_auditing/test_network_risk_sensor.py +++ b/tests/security_auditing/test_network_risk_sensor.py @@ -710,3 +710,34 @@ def test_network_case_fold_fallback_mode(sensor, case_fold_universe): assert a_f90["telemetry"]["network_metrics"]["in_degree"] == 1 a_cpy = next(f for f in mapped_files if f["path"] == "/cbl/payroll.cpy") assert a_cpy["telemetry"]["network_metrics"]["in_degree"] == 1 + + +# ============================================================================== +# TEST 19: THE FOLD NEVER INVENTS A CROSS-LANGUAGE EDGE (#2540) +# ============================================================================== +@pytest.mark.skipif(not HAS_NETWORKX, reason="Requires NetworkX") +def test_network_fold_does_not_cross_language_resolve(sensor): + """ + Found by the crucible corpus during the #2540 re-bless: haskell's + `import Text.Pandoc.Generic` case-folded onto go's generic.go purely on + a stem collision. Folding is a property of the importing language's own + resolution rules, so the folded fallback only sees that language's files + -- while a same-language fold in the same universe still resolves. + """ + files = [ + {"path": "/go/generic.go", "lang_id": "go", "raw_imports": []}, + {"path": "/hs/pandoc.hs", "lang_id": "haskell", "raw_imports": ["Text.Pandoc.Generic"]}, + {"path": "/hs/writer.hs", "lang_id": "haskell", "raw_imports": []}, + {"path": "/hs/Main.hs", "lang_id": "haskell", "raw_imports": ["Writer"]}, + ] + + mapped_files, _ = sensor.build_dependency_graph(files) + + generic_go = next(f for f in mapped_files if f["path"] == "/go/generic.go") + assert generic_go["telemetry"]["network_metrics"]["in_degree"] == 0, ( + "haskell import must not fold onto a go file on a stem collision!" + ) + writer_hs = next(f for f in mapped_files if f["path"] == "/hs/writer.hs") + assert writer_hs["telemetry"]["network_metrics"]["in_degree"] == 1, ( + "Same-language folded resolution must still work alongside the guard." + )