Skip to content

func_complexity_gini: make's top-level conditionals sit outside every target slice (makefile 0.354 vs 0.1875 median; the last open-defect cell) #2918

Closed
squid-protocol/keyword-rosetta
#117

Description

@squid-protocol

The last open-defect cell on the keyword-rosetta scoreboard once #2907, #2827, #2871 and #2872's corpus half land: func_complexity_gini for makefile reads 0.354 against a 0.1875 median. Ledgered as makefile-gini-blind-to-toplevel-conditionals (upstream-question, 2026-09-06) with no issue number; this is that issue.

Symptom

The cell surfaced only when #2822 put makefile's branch total on the median — before that it was categorised as an echo of the branch defect and never examined. It predates #2822: the gini value is byte-identical before and after a ±1 change in top-level branch tokens (endif removed, corpus total 4 → 3).

Cause (per the ledger verdict)

make's top-level conditionals (ifeq / else / endif between rules) sit outside every target slice. The per-function complexity distribution therefore only ever sees the recipes' share of the decisions, and reads more unequal than languages whose probe decisions all live inside a function body. It is a slicing / probe-placement question in the #2727 census family, not a branch-count one.

Two possible answers, one decision

  1. Engine: the makefile slicer attributes a top-level conditional to the target it guards (the next rule header after it, or the rule whose recipe it wraps), so decision density is measured where make executes it. Golden-master effect on every crucible Makefile with top-level ifeq; needs a scoped bless.
  2. Contract-level inherency: make has file-scope control flow that belongs to no unit; the gini over units is defined only on the unit-scoped share and the cell is declared n/a-by-contract for languages with file-scope conditionals (the same treatment functions_found[markdown] −100%: func_start is n/a for markdown but functions_found scores it anyway — the structure-count rows have no n/a mechanism #2795/classes_found: five red cells on a 0 median are language morphology, not extraction — the row needs a declaration-requirement stratum #2796 gave structure counts). No engine change; a ledger disposition change from upstream-question to intended-morphology.

The func_complexity_gini formula is one of the five score-layer rows queued on #2812 Phase 4; whichever answer is taken should be recorded as that row's contract line. Filed from #2908's Phase 1 close-out so the scoreboard's last red cell has an owner.

Activity

  1. added
    metrics
    core-engine
    on Sep 9, 2026
  2. squid-protocol commented on Sep 10, 2026

    @squid-protocol
    OwnerAuthor

    Reopening: this was closed 2026-09-09 as option 2 (contract-level inherency), recorded only in the ledger entry makefile-gini-toplevel-conditionals-inherency with no comment here. That decision rested on a premise this issue states and both ledger entries repeat — that make's top-level conditionals sit outside every target slice — and the premise is false. Re-measured against engine main before any change:

    • main.mk's probe_branch reads branches=2, loc=6, start=14 — lines 14-19, the entire ifeq/else/endif. The slicer already attributes the conditional to the target whose recipe it wraps, which is what option 1 proposed building.
    • main.mk's gini was 0.75, byte-identical to python, go and rust. A file whose control flow escaped all its units cannot produce that.

    The actual cause is neither option. One branch was planted in the wrong probe: b.mk's probe_bypass wrote : || true, and the branch rule counts the shell OR while safety_bypasses counts || true — both correct per their stated contracts, no rule defect. makefile therefore read per-file ginis of 0 / 0.667 / 0 / 0.75 where every other language reads 0 / 0 / 0 / 0.75. The branch TOTAL was 3 either way, which is precisely why this survived #2822 and looked like a slicing question: only the per-unit distribution was wrong, and func_complexity_gini was the only metric that could see it.

    Fixed in the corpus (keyword-rosetta#123): probe_branch plants three constructs like every other language's if/elif/else (ifeq / else ifeq / else), probe_bypass uses make's own - prefix on both lines. Exactly two manifest cells move, branch total unchanged at 3, makefile gini 0.354 -> 0.1875 (the median exactly), and the scoreboard's open-defect share goes 1/2633 -> 0/2633.

    Both ledger entries are retired with the diagnosis withdrawn in full rather than silently dropped. The general principle from the inherency entry — a language placing primary control flow at file scope outside all callable units would make func_complexity_gini n/a by contract — is not retracted; no corpus language exhibits it, so it stands as a contract note awaiting a real instance.

    Closing again once #123 merges. Filing the method lesson separately: this cell was categorised as an echo of the branch defect, then as a slicing question, then as inherency, over three sessions, because a correct TOTAL hid a wrong DISTRIBUTION — worth a line in the score-contract skill.

  3. squid-protocol commented on Sep 10, 2026

    @squid-protocol
    OwnerAuthor

    Closing: the stated close condition — keyword-rosetta#123 merging — is met (merged 2026-09-10 20:26).

    Per the reopen diagnosis, this was not an engine defect and not contract-level inherency: the makefile slicer already attributes top-level ifeq/else/endif to the target whose recipe they wrap, and makefile's per-file gini already read 0.75 alongside python/go/rust. The real cause was a corpus probe error — b.mk's probe_bypass wrote : || true, which branch counts as a shell OR while safety_bypasses counts as || true (both correct per contract), producing a wrong per-unit distribution behind a correct branch total of 3.

    Fixed in the corpus (keyword-rosetta#123): probe_branch plants three constructs (ifeq / else ifeq / else) and probe_bypass uses make's - prefix on both lines. Result: makefile func_complexity_gini 0.354 → 0.1875 (the median), scoreboard open-defect share 1/2633 → 0/2633. Both ledger entries retired with the diagnosis withdrawn; the general contract note (a language placing primary control flow at file scope outside all callable units would be n/a-by-contract) stands, awaiting a real instance.

    No gitgalaxy engine change required. Follow-up (separate): a method-lesson line for the score-contract skill — a correct branch TOTAL hid a wrong per-unit DISTRIBUTION across three mis-diagnoses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-enginemetrics

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions