Skip to content

m4 and makefile have no visibility-export rule, so their api plant cannot name the function it publishes #2872

Closed

Description

@squid-protocol

Paired engine/corpus work blocking keyword-rosetta's m4-makefile-api-scores-above-stratum
(keyword-rosetta#100). Measured at engine 7fa0e41, corpus f473bb1, full precision.

Symptom

m4 and makefile score risk_api_exposure +30.3% / +32.7% and risk_documentation +61.6% /
+70.6% against their irc3 stratum, with every governed input on the median. The cause is one
column the corpus report cannot band: it measures raw_arch_api (3, on the median) while both
formulas read the adjusted arch_api, which is 6.

data/{m4,makefile}/{a,b,c} record raw_arch_api 3 / arch_api 6 (c.mk 4 / 7) — the
doubled-surface shape #2731 was filed for and #2734 fixed, still reproducing in these two.

The engine is behaving correctly here

#2734's fix is detector.py's api_declared_orphans: tokenise each api-matched line with
\b\w+\b, suppress the conversion for orphans whose name is in that set. Instrumented on the
a-files:

language api line api_line_tokens orphan names declared
shell (control) export -f probe_globals export, f, probe_globals, … probe_globals, … 3
m4 AC_SUBST([PROBE_GLOBALS]) AC_SUBST, PROBE_GLOBALS, … probe_globals, … 0
makefile export PROBE_GLOBALS = 1 export, PROBE_GLOBALS, 1, … probe_globals, … 0

Reading 0 is right. AC_SUBST([PROBE_GLOBALS]) publishes an autoconf substitution variable
and export PROBE_GLOBALS = 1 a make variable — different program entities from the macro
probe_globals and the target probe_globals:, in make's case a different namespace outright.
A case-folding patch to api_declared_orphans would erase that distinction and be wrong in
general (a Java FOO constant beside a foo() method). Please do not "fix" it that way.

This is deliberately not the same defect as #2827 (\b\w+\b cannot hold a -, so scheme's
(export probe-globals) fails to match the function it genuinely does name). There the api hit
and the orphan are the same symbol and only the tokenizer hides it. Here they are different
symbols.

The actual gap

The corpus would rather plant an api idiom that does name the function — and both candidates
exist and are idiomatic:

  • m4: m4_provide([probe_x]) / AC_PROVIDE([probe_x])
  • makefile: .PHONY: probe_globals probe_test probe_safety

keyword-rosetta#53 tried both and recorded the rejection in the manifests: m4_provide took
api_orphan_credit 3/3/3 → 0/0/0 and .PHONY: took it 3/3/4 → 0/0/1, because to a
name-recurrence orphan census, naming a function is a use, and the flag cleared.

#2823 built the exemption for exactly that — _visibility_export_list, "a visibility
declaration is not a use" — but only for languages that declare it. Verified at 7fa0e41:

language _visibility_export _visibility_export_list
scheme, haskell yes yes
shell, ruby, tcl yes —
m4, makefile, cobol no no

So the re-plant is blocked on the engine.

Ask

Give m4 a visibility-export rule for m4_provide / AC_PROVIDE, and makefile one for the
.PHONY: prerequisite list (a list form, so _visibility_export_list). Then the corpus
re-plants api onto those forms in a follow-up PR: api_declared_orphans reads 3, the
conversion is suppressed, arch_api returns to 3, and both cells return to the stratum.

Paired work of the shape keyword-rosetta's docs/GATING.md n/a section describes — the rule and
the plant land in that order, and the corpus PR opens after this one merges. Current behaviour is
baked in meanwhile (the corpus measures what the engine does), ledgered as
m4-makefile-api-scores-above-stratum.

cobol is listed above for completeness only; its own doubling is #2827's tokenizer defect, not
this one.

🤖 Generated with Claude Code

Activity

  1. added a commit that references this issue on Sep 8, 2026
  2. added
    scope:frontier
    on Oct 16, 2026
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

    scope:frontier

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions