Skip to content

fix(gates): an empty ADR-020 diff scope is na, not structural (#268) - #270

Merged
rubenvdlinde merged 1 commit into
mainfrom
fix/gate-268-empty-diff-scope-is-na
Aug 8, 2026
Merged

fix(gates): an empty ADR-020 diff scope is na, not structural (#268)#270
rubenvdlinde merged 1 commit into
mainfrom
fix/gate-268-empty-diff-scope-is-na

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Fixes #268.

The regression

#258 correctly stopped gates 19/25/62/63 printing PASS over a scope they never opened — a real false green. But it filed the empty-diff-scope case as structural, and structural counts against --require-full-coverage. So the run exited 98 and the PR failed for a gate that had nothing to judge.

The category was the bug, not the skip. The runner's own definitions already distinguish them, and the summary header has always read "subject matter absent from this repo or this diff":

category meaning counts against coverage
na absent from this repo or this diff. No change the author could make would put a spec file into a diff that does not touch one. no
structural the subject matter EXISTS and nothing produced the gate's input — a gap the repo can close (the axe-report case it was written for). yes

Gates 4, 6, 7 and 28 already called the identical situation na ("0 lib/Controller PHP file(s) in this diff"). The four touched by #258 were the outliers. They now match.

I audited every remaining structural call site — 24, 28 (×2), 30, 33. Each is a genuine gap inside a non-empty scope, and all five keep their category. No other site makes this conflation.

#258's fix is intact, because it lives in the rendering and not the accounting: an unopened scope prints NOT APPLICABLE, which is not PASS.

Measured

Package-vs-package on unchanged trees. The emitted gate count is identical on both sides — nothing was widened away, only the denominator moved:

repo old package this branch gates green
doriath #191 98 0 57 → 57
doriath development tip 4bfeab7c8 98 0 53 → 53
larpingapp b0c60f734 98 0 53 → 53
softwarecatalog 31d87d1 98 0 57 → 57

Why gate-63 is na on a controller-only change, and not something to "reconcile"

It was proposed that gate-63 should treat a changed SettingsController.php as its subject. It should not, and the source settles it: every rule in check_settings() reads a manifest or src/menu-layout.json. ADR-079 is about where a settings surface is declared, not what a settings endpoint does. lib/Controller/ is not even lib/Settings/, which is the only PHP path the gate consults (as a boolean, in a WARN).

There is no single global scope that gates "agree" on — each gate declares its own inputs. On doriath#191 the controller is judged, by the ten gates whose subject it is: 5, 6, 7, 8, 9, 14, 16, 25, 47, 48, all PASS.

And this widening has already been tried and reverted. check_store() carries the record:

This scan used to walk the whole lib/ tree unconditionally while the manifest half above honoured ADR-020. […] One pre-existing violation in pipelinq therefore blocked EVERY manifest-touching PR in that repo, permanently, with a finding naming a file outside the diff.

Tests

test_gate_empty_scope_never_passes.sh grows from three arms to five, pinning both directions:

  • ARM 1 planted true positives still caught full-tree (anti-widening)
  • ARM 2 empty scope is NOT APPLICABLE, never PASS, and does not exit 98
  • ARM 3 a clean in-scope manifest still PASSes
  • ARM 4 a genuinely structural gap (--axe-enabled, no report) still exits 98
  • ARM 5 a real ADR-079 violation in an in-scope manifest still FAILs — na must not swallow a subject that is in the diff

Mutation-checked, each mutation asserting old in source before rewriting so a mutation that never applied cannot masquerade as a survivor:

mutant killed by
M1 revert gate-63 to structural ARM 2
M2 gate-33's real structural gap → na ARM 4
M3 gate-63 declares na unconditionally ARM 5 only

M3 is why ARM 5 exists: ARM 3 does not catch it, because a clean manifest still returns rc=0 and passes.

Also fixes _verdict(), which parsed "NOT APPLICABLE" as "NOT" under a single-token pattern — the assertions were failing on the string, not the behaviour.

Full package suite: 41 helper suites + 59 entry-point tests, 0 failures; the 2 pre-existing quarantines untouched.

The larger finding in #268 — partly addressed, rest left open

"The strict-subset rule is comparing a live measurement against a 30-second-old build of a different program."

Correct. This PR emits the gate package's own SHA into the run output. doriath's development tip was gated green 8 seconds before the classification change landed on main — the difference between "green" and "red" was the gates, not the code, and no log said so.

This does not fix the unsoundness; it makes it checkable, which is the prerequisite for any fix. Resolution order is HYDRA_GATES_PKG_SHA → the package's git checkout → VERSION → a loud UNKNOWN, never silence (a missing line is indistinguishable from an older package that never had one).

The policy question stays open in #268: pin consumers, re-run the baseline with the PR's package, or record the package in the baseline artifact. That is a fleet-wide CI decision, out of scope for this fix, and deliberately not silently dropped.

#258 correctly stopped gates 19/25/62/63 printing PASS over a scope they never
opened. But it filed the empty-diff-scope case as `structural`, and
`structural` counts against --require-full-coverage — so the run exited 98 and
the PR failed for a gate that had nothing to judge.

The category was the bug, not the skip. The runner's own definitions already
distinguish them, and the summary header has always read "subject matter absent
from this repo OR THIS DIFF":

  na          absent from this repo or this diff. Nothing is missing, and no
              change the author could make would put a spec file into a diff
              that does not touch one.
  structural  the subject matter EXISTS and nothing produced the gate's input —
              a gap the repo CAN close (the axe-report case it was written for).

Gates 4, 6, 7 and 28 already called the identical situation `na` ("0
lib/Controller PHP file(s) in this diff"). The four touched by #258 were the
outliers; they now match. Audited every remaining `structural` call site
(24, 28x2, 30, 33) — each is a genuine gap inside a NON-empty scope, and all
five keep their category.

What #258 bought is unchanged, because it lives in the rendering and not the
accounting: an unopened scope prints NOT APPLICABLE, which is not PASS.

Measured, package-vs-package on unchanged trees (exit 98 -> exit 0, with the
EMITTED gate count identical on both sides — nothing was widened away, only
the denominator moved):

  doriath #191             98 -> 0   (57 green both sides)
  doriath development tip  98 -> 0   (53 green both sides)
  larpingapp  b0c60f734    98 -> 0   (53 green both sides)
  softwarecatalog 31d87d1  98 -> 0   (57 green both sides)

On doriath#191 the changed controller is judged by the ten gates whose subject
it actually is (5, 6, 7, 8, 9, 14, 16, 25, 47, 48). gate-63 is correctly `na`:
ADR-079 is about WHERE A SETTINGS SURFACE IS DECLARED, and every rule in
check_settings() reads a manifest or src/menu-layout.json. Making it judge
controller bodies was considered and rejected — check_store() records that the
same widening (walking lib/ while the manifest half honoured ADR-020)
"blocked EVERY manifest-touching PR in that repo, permanently".

TESTS. test_gate_empty_scope_never_passes.sh grows from three arms to five and
pins both directions:

  ARM 1  planted true positives still caught full-tree (anti-widening)
  ARM 2  empty scope is NOT APPLICABLE, never PASS, and does not exit 98
  ARM 3  a clean in-scope manifest still PASSes
  ARM 4  a GENUINELY structural gap (--axe-enabled, no report) STILL exits 98
  ARM 5  a real ADR-079 violation in an in-scope manifest still FAILs — `na`
         must not swallow a subject that IS in the diff

Mutation-checked, each mutation asserting `old in source` before rewriting so a
mutation that never applied cannot masquerade as a survivor:

  M1  revert gate-63 to `structural`        -> killed by ARM 2
  M2  gate-33's real structural gap -> `na` -> killed by ARM 4
  M3  gate-63 declares `na` unconditionally -> killed by ARM 5 ONLY

M3 is why ARM 5 exists: ARM 3 does not catch it, because a clean manifest still
returns rc=0 and passes. Also fixes _verdict(), which parsed "NOT APPLICABLE"
as "NOT" under a single-token pattern.

Full package suite: 41 helper suites + 59 entry-point tests, 0 failures; the 2
pre-existing quarantines are untouched.

ALSO: emit the gate package's own SHA into the run output. The fleet consumes
this package at @main UNPINNED, so two runs minutes apart can be two different
programs — doriath's development tip was gated green 8 seconds before the
classification change landed. This does not fix the strict-subset merge rule's
unsoundness; it makes it CHECKABLE, which is the prerequisite for any fix. The
policy question stays open in #268. Resolution order is
HYDRA_GATES_PKG_SHA -> git checkout of the package -> VERSION file -> a loud
UNKNOWN, never silence: a missing line is indistinguishable from an older
package that never had one.

Refs #268, #258, #242, #240, #169
@rubenvdlinde
rubenvdlinde merged commit 32fa23e into main Aug 8, 2026
31 checks passed
rubenvdlinde added a commit that referenced this pull request Aug 9, 2026
…l class read as absent, and a lazy closure read as an eager one

Second pass over the 56-64 band, planting in a SECOND repo of a different
shape per gate. Four more defects, all measured against gate package
48c88ba.

A CRASHED CHECKER REPORTED PASS — gates 56 and 57
--------------------------------------------------
Both invoked their helper as `>> log 2>/dev/null || true` and then derived
the verdict from `wc -l` on the log. Stderr discarded, exit status
discarded, empty log — so a checker that never started reported PASS.
Measured on shillinq with a python3 shim that exits 1 for exactly these two
helpers:

    [gate-56] register-handler-resolution: PASS      <- 153 registers
    [gate-57] orphaned-write-capability:   PASS      <- 316 services

and gate-57 had reported 20 real findings over that same tree on the
previous run. That is gate-40's defect verbatim. Both helpers ALWAYS exit 0
when they run, by design (#209 — the count goes to stdout, never into the
exit byte), so a non-zero exit can only be a crash and never a finding
count. Both now emit SKIPPED (wiring) and keep the stderr on disk.

Every gate in this band was re-checked for the count-as-exit-status defect
found in gates 19, 26 and 52: none of the nine has it. 56 and 57 put the
count on stdout and the runner counts lines; 58/59/60/61/62/63/64 return
status codes only.

A REAL CLASS READ AS ABSENT — gate 56
--------------------------------------
The PSR-4 path guess handles the conventional layout; the fallback walk
over lib/ is what finds a type living where PSR-4 does NOT predict — a
DI-bound registration, a type not named after its file. That is the shape
gate-30 was caught mis-resolving (`AppHost\Controller\GenericHealth`
PSR-4-maps to lib/Controller/AppHost/Controller/… while openregister
DI-binds it to lib/AppHost/Controller/).

The walk matched `class` only, with at most ONE modifier. So every other
declaration form was a FALSE POSITIVE on a type that genuinely exists — and
the action `guard-class-not-found` invites is to write the class a second
time. Measured, each against a real declaration at a non-conventional path:

    enum ProbeState: string { … }        -> guard-class-not-found
    interface ProbeContract { … }        -> guard-class-not-found
    trait ProbeTrait { … }               -> guard-class-not-found
    final readonly class ReadonlyProbe   -> guard-class-not-found

`final readonly` is ordinary PHP 8.2. Only the DECLARATION FORMS widen; the
line anchor that keeps docblock prose out is unchanged and asserted in both
directions.

A LAZY CLOSURE READ AS AN EAGER REFERENCE — gate 64
----------------------------------------------------
This module's header has always said lazy service closures that merely
MENTION an AppHost class are deliberately NOT flagged, because their bodies
run at resolution time. Both rules ran over the whole file, so they did not.

Measured on launchpad — deliberately a DIFFERENT repo shape from
larpingapp. launchpad's whole composition root resolves OpenRegister
lazily inside closures (it already does this for
AppHost\Observability\ManifestLoader); that is the documented leaf pattern
and the reason launchpad is green. A closure body naming Bootstrap reported
byte-identically to an eager `Bootstrap::register($context, …)`. The gate
would have failed the one repo doing it correctly, for doing it correctly,
and the only remedy is to stop writing the lazy form.

Anonymous and arrow-function bodies are now blanked before both rules.
Named methods are untouched (`public function register(` has an identifier
between `function` and `(`), and an eager reference AFTER or BETWEEN
closures is still caught — both asserted.

GATE 63 ON A CONTROLLER-ONLY DIFF — the reason was an overclaim
---------------------------------------------------------------
Every BLOCKING rule in this gate reads src/manifest.json, src/manifest.d/
or src/menu-layout.json. The two rules that touch lib/Settings are WARNs
and never fail it. So a PR that changes a settings CONTROLLER, or adds or
deletes a lib/Settings/*Admin.php section, lands in the empty-scope branch —
and the line read "this PR introduces no settings placement (ADR-079) to
judge", which on such a diff is false. The author changed the settings
surface; this gate does not adjudicate that half of it.

NOT WIDENED, on purpose. Reading the controller was tried and reverted, and
check_store_and_settings_surface.py records why: a gate that only RUNS when
a manifest changed and then judges code the PR never touched "blocked EVERY
manifest-touching PR in that repo, permanently". The verdict stays `na` —
the correct category, since no change the author could make puts a manifest
into a diff that does not touch one.

What changes is that the line now names which half it looked at, and when
the diff contains lib/Settings or a settings controller it says so
explicitly, so `na` cannot be read as a clearance for the change the author
actually made.

VERIFIED, BOTH ARMS OF THE #270 CONTRACT
-----------------------------------------
  * empty ADR-020 scope   -> NOT APPLICABLE, exit 0 under
                             --require-full-coverage (measured on the
                             controller-only fixture above)
  * genuine structural gap -> SKIPPED (structural), exit 98
                             (test_gate_empty_scope_never_passes.sh ARM 4,
                             gate-33 with --axe-enabled and no report)

And gate-60's three states, all asserted:
real finding · SKIPPED (wiring) naming the missing dependency · clean pass.

FLEET SWEEPS — 21 apps-extra repos, old helper vs new
------------------------------------------------------
  gate-56  zero verdict changes
  gate-64  zero verdict changes; the three pre-existing FAILs (openbuild,
           procest, scholiq) survive, and the three NOTEs (larpingapp,
           hermiq, nldesign) are unchanged

TESTS
-----
  test_gate_crashed_checker_is_not_a_finding.sh  +2 gates, 5 assertions.
      Two arms: the plants must FAIL with a working interpreter, and the
      SAME tree must report SKIPPED (wiring) with a dead one — otherwise
      "always skip" would pass. Against 48c88ba it reports the two PASSes.
  test_check_register_handler_resolution.py      +8 cases incl. the mutant
      that restores the pre-fix pattern and requires all four forms to go
      back to not-found.
  test_check_apphost_autoload_prelude.py         +9 cases, closure and
      anti-widening arms.

REPOS PLANTED IN, by gate
--------------------------
  56  shillinq (register-owning, 153 register.d files) + a synthetic
      DI-bound/non-conventional-path fixture
  57  shillinq (316 services) + fixture
  58  shillinq (60 e2e files); fleet-wide check that no live networkidle
      call in any repo lives outside tests/e2e/ — 193 inside, 0 outside
  59  docudesk (the repo the gate was written against) + fixture
  60  shillinq (233 manifests, fake MDI package) + fixture
  61  shillinq (15 post-event registrations)
  62  shillinq
  63  shillinq + a controller-only fixture
  64  larpingapp (eager class_exists composition root, 3 live probes)
      AND launchpad (lazy-closure composition root, 0 eager references)

NOT MINE, REPORTED NOT FIXED
-----------------------------
test_gate_45_to_55_acceptance.sh fails 4 gate-53 assertions identically on
pristine main (48c88ba) and on this branch — the suite expects blocking
behaviour for pre-existing orphans that #250/#260/#280 deliberately made
advisory. Out of this band; flagged rather than touched.
rubenvdlinde added a commit that referenced this pull request Aug 9, 2026
…could not see the defect they exist to catch (#278)

* fix(gates 56-64): six gates passed over an unopened scope, and three could not see the defect they exist to catch

Acceptance test applied to all nine gates in the 56-64 band: plant one
textbook true positive in a real fleet repo, require the gate to FAIL and
NAME it, remove the plant, require the prior verdict back, and require a
clean fixture to still pass. Five gates passed unchanged (56, 58, 60, 62,
63). Four did not.

AN UNOPENED SCOPE IS NOT A PASS — gates 56, 57, 58, 59, 60, 61
--------------------------------------------------------------
#242/#240 established that a gate must not report PASS over a scope it
never opened, and #268 that an empty ADR-020 scope is `na` rather than
`structural`. Both were applied to gates 19, 25, 62 and 63 and to nothing
else. Measured on shillinq, one docs-only commit, --scope-to-diff:

  [gate-56] register-handler-resolution: PASS   <- 153 registers, 0 opened
  [gate-57] orphaned-write-capability:   PASS   <- 316 services,  0 opened
  [gate-58] e2e-networkidle:             PASS   <-  60 e2e files, 0 opened
  [gate-59] unclosable-gate:             PASS   <- lib/ untouched
  [gate-60] icon-vocabulary:             PASS   <- no manifest in the diff
  [gate-61] listener-work-placement:     PASS   <- all 15 out of scope
  [gate-62] store-plane:                 NOT APPLICABLE   (already fixed)
  [gate-63] settings-surface:            NOT APPLICABLE   (already fixed)

Six gates asserting a verdict about code the run had not looked at, beside
two that had already learned not to — and --require-full-coverage cannot
see a PASS, so nothing reported that six gates had gone quiet. All six now
emit `na` with a reason naming the rule and the count of subjects that
exist but were not inspected.

GATE 59 COULD NOT RUN A FULL-TREE AUDIT AT ALL
----------------------------------------------
CHANGED_FILES is populated only under --scope-to-diff. Gate 59's guard read
`grep -qE '^lib/.*\.php$'` against it unconditionally, so on every unscoped
run the guard was false and the gate printed PASS having walked no PHP.
That is #240's sentence — "a full-tree audit was the one mode this gate
could never reach" — in a gate #240 did not visit. The scoping now applies
only when the caller asked for it.

Gate 61's unconditional --base is DELIBERATE by contrast (it is about new
debt; the fleet's 149-registration backlog is a work-list). Switching it to
--all was tried and reverted: the builder runs unscoped, so it would have
surfaced the whole backlog as blocking findings on every build. Recorded in
the code so the next reader does not repeat it.

GATE 59 WAS WRONG IN BOTH DIRECTIONS AT ONCE (#184's shape)
-----------------------------------------------------------
It caught the textbook case and then failed on the next four mutations,
each reproduced against docudesk:

  false GREEN     a COMMENTED-OUT setter counted as a write. `// TODO:
                  setValueString('app','configuration_version',$v)` closed
                  the finding — and that is the single most likely comment
                  to sit beside a key nobody writes. The gate whose subject
                  is "this guard never closes" was itself closed by a
                  comment promising to close a guard.
  false GREEN     `"key"` in double quotes was invisible on both sides.
  false POSITIVE  read 'key' / write "key" — code that closes its gate
                  correctly reported as never closing it, with no remedy
                  available to the app but changing its quote style.
  false GREEN     a key held in a class constant was invisible on both
                  sides — and a constant is the idiomatic way to write a key
                  used twice, which is the shape a CLOSABLE gate has.

Fixed with the established remedies: source_scope.php_mask for the comment
regions (offsets preserved; string contents kept, because the key literal
is the evidence), both quote styles, and constant resolution that keeps
read and write symmetric. The suppression keeps reading raw text because it
is authored as a comment — and it now requires the key QUOTED ON THE
MARKER'S OWN LINE, because the old four-line window spanned the read and so
suppressed whatever was near it rather than what it named.

Fleet sweep: 21 repos, zero verdict changes.

GATE 57'S MCP SEAM DISSOLVED ON A LEADING BACKSLASH
---------------------------------------------------
Both halves of the attribute seam (#200/#215) matched a namespace prefix as
`(?:[A-Za-z_]\w*\s*\\+\s*)*` — every segment had to start with a letter. So
the fully-qualified spelling, which is how you write a name with no `use`
import for it, matched neither:

    registerServiceAlias('…::app', \OCA\App\Mcp\Impl::class)
    #[\OCA\OpenRegister\Mcp\Attribute\McpTool(name: 'createLead')]

Either miss alone empties the seam and puts every #[McpTool] write method
in the app back on the finding list — which is #200 verbatim, a finding
whose only remedy is deleting a live, curated MCP write tool. Reproduced on
shillinq with the two spellings side by side.

The regression test's mutant restores BOTH pre-fix patterns together,
because the seam needs both and reverting one alone reads as "the fix
changed nothing".

Fleet sweep: 21 repos, zero verdict changes — the trap is latent, not live.

GATE 64 SAW ONE OF PHP'S THREE WAYS TO NAME A CLASS
---------------------------------------------------
Rule 2 required a QUOTED literal, so of these four only the first was a
finding; the other three were injected into larpingapp's register() and the
gate reported OK for every one:

    class_exists('OCA\OpenRegister\AppHost\…\GenericHealthController')
    class_exists(\OCA\OpenRegister\AppHost\…\GenericHealthController::class)
    use …\GenericHealthController;  class_exists(GenericHealthController::class)
    const AH = 'OCA\OpenRegister\AppHost\…';  class_exists(self::AH)

That is #184's lesson in the file where it was learned. All four spellings
now resolve through one resolver, so a spelling that escapes it escapes
both rules rather than whichever was written second. A bare `use` import
stays clean on purpose — `use` is a compile-time alias and does not
autoload; flagging it would newly redden four repos for code that works.

AND A GREEN GATE-64 WAS NOT EVIDENCE ABOUT THE WIDER PROBE
----------------------------------------------------------
The hard rule is scoped to OCA\OpenRegister\AppHost\, but the autoloader
mechanism has nothing to do with AppHost: during register() the whole
OCA\OpenRegister\ prefix is absent for any app sorting earlier, so ANY
class_exists() on it answers FALSE and everything it guards silently never
happens. Measured across apps-extra, no prelude present:

    larpingapp  3  Event\{DeepLinkRegistration,ObjectCreating,ObjectUpdating}
                   — the last two carry larpingapp's server-authoritative
                     skill-requirement / XP-budget enforcement on character
                     writes, which therefore never registers
    hermiq      3  flow-node, leaf-provider and shareable-config registration
    nldesign    1  shareable-config registration

Reported as a non-blocking NOTE, printed by the runner, and deliberately
not a FAIL: this gate is not diff-scoped, so failing it would block every
PR in three repos on code the PR did not touch — the trap
check_store_and_settings_surface.py already records. A probe in boot() is
NOT noted, because boot() runs after every app has registered.

ALSO
----
Gate 64's log path was a hardcoded /tmp/hydra-gate-apphost-autoload-prelude
.log — the shared-path non-determinism HYDRA_GATE_LOG_DIR exists to remove,
left behind in one gate.

TESTS
-----
  test_check_unclosable_gate.py                    NEW — gate 59 shipped
                                                   with no helper suite at
                                                   all; 23 cases, every arm
                                                   of the matrix above plus
                                                   the mutant that proves
                                                   the comment mask is
                                                   load-bearing
  test_gate_5661_empty_scope_is_not_a_pass.sh      NEW — 28 assertions over
                                                   gates 56-61: clean
                                                   in-scope subject PASSes,
                                                   empty scope is `na` with
                                                   a reason and exit 0 under
                                                   --require-full-coverage,
                                                   and a planted true
                                                   positive per gate still
                                                   FAILs. Against the
                                                   pre-fix package it
                                                   reports 13 failures,
                                                   naming the six PASSes
  test_check_apphost_autoload_prelude.py           +14 cases
  test_check_orphaned_write_capability.py          +5 cases
  test_check_listener_placement.py                 EXIT_EMPTY_SCOPE

51 discovered helper suites green (2 quarantined, unchanged). Full-tree run
on shillinq before/after: verdicts byte-identical for all nine gates.

* fix(gates 56-64): six gates passed over an unopened scope, and three could not see the defect they exist to catch

Acceptance test applied to all nine gates in the 56-64 band: plant one
textbook true positive in a real fleet repo, require the gate to FAIL and
NAME it, remove the plant, require the prior verdict back, and require a
clean fixture to still pass. Five gates passed unchanged (56, 58, 60, 62,
63). Four did not.

AN UNOPENED SCOPE IS NOT A PASS — gates 56, 57, 58, 59, 60, 61
--------------------------------------------------------------
#242/#240 established that a gate must not report PASS over a scope it
never opened, and #268 that an empty ADR-020 scope is `na` rather than
`structural`. Both were applied to gates 19, 25, 62 and 63 and to nothing
else. Measured on shillinq, one docs-only commit, --scope-to-diff:

  [gate-56] register-handler-resolution: PASS   <- 153 registers, 0 opened
  [gate-57] orphaned-write-capability:   PASS   <- 316 services,  0 opened
  [gate-58] e2e-networkidle:             PASS   <-  60 e2e files, 0 opened
  [gate-59] unclosable-gate:             PASS   <- lib/ untouched
  [gate-60] icon-vocabulary:             PASS   <- no manifest in the diff
  [gate-61] listener-work-placement:     PASS   <- all 15 out of scope
  [gate-62] store-plane:                 NOT APPLICABLE   (already fixed)
  [gate-63] settings-surface:            NOT APPLICABLE   (already fixed)

Six gates asserting a verdict about code the run had not looked at, beside
two that had already learned not to — and --require-full-coverage cannot
see a PASS, so nothing reported that six gates had gone quiet. All six now
emit `na` with a reason naming the rule and the count of subjects that
exist but were not inspected.

GATE 59 COULD NOT RUN A FULL-TREE AUDIT AT ALL
----------------------------------------------
CHANGED_FILES is populated only under --scope-to-diff. Gate 59's guard read
`grep -qE '^lib/.*\.php$'` against it unconditionally, so on every unscoped
run the guard was false and the gate printed PASS having walked no PHP.
That is #240's sentence — "a full-tree audit was the one mode this gate
could never reach" — in a gate #240 did not visit. The scoping now applies
only when the caller asked for it.

Gate 61's unconditional --base is DELIBERATE by contrast (it is about new
debt; the fleet's 149-registration backlog is a work-list). Switching it to
--all was tried and reverted: the builder runs unscoped, so it would have
surfaced the whole backlog as blocking findings on every build. Recorded in
the code so the next reader does not repeat it.

GATE 59 WAS WRONG IN BOTH DIRECTIONS AT ONCE (#184's shape)
-----------------------------------------------------------
It caught the textbook case and then failed on the next four mutations,
each reproduced against docudesk:

  false GREEN     a COMMENTED-OUT setter counted as a write. `// TODO:
                  setValueString('app','configuration_version',$v)` closed
                  the finding — and that is the single most likely comment
                  to sit beside a key nobody writes. The gate whose subject
                  is "this guard never closes" was itself closed by a
                  comment promising to close a guard.
  false GREEN     `"key"` in double quotes was invisible on both sides.
  false POSITIVE  read 'key' / write "key" — code that closes its gate
                  correctly reported as never closing it, with no remedy
                  available to the app but changing its quote style.
  false GREEN     a key held in a class constant was invisible on both
                  sides — and a constant is the idiomatic way to write a key
                  used twice, which is the shape a CLOSABLE gate has.

Fixed with the established remedies: source_scope.php_mask for the comment
regions (offsets preserved; string contents kept, because the key literal
is the evidence), both quote styles, and constant resolution that keeps
read and write symmetric. The suppression keeps reading raw text because it
is authored as a comment — and it now requires the key QUOTED ON THE
MARKER'S OWN LINE, because the old four-line window spanned the read and so
suppressed whatever was near it rather than what it named.

Fleet sweep: 21 repos, zero verdict changes.

GATE 57'S MCP SEAM DISSOLVED ON A LEADING BACKSLASH
---------------------------------------------------
Both halves of the attribute seam (#200/#215) matched a namespace prefix as
`(?:[A-Za-z_]\w*\s*\\+\s*)*` — every segment had to start with a letter. So
the fully-qualified spelling, which is how you write a name with no `use`
import for it, matched neither:

    registerServiceAlias('…::app', \OCA\App\Mcp\Impl::class)
    #[\OCA\OpenRegister\Mcp\Attribute\McpTool(name: 'createLead')]

Either miss alone empties the seam and puts every #[McpTool] write method
in the app back on the finding list — which is #200 verbatim, a finding
whose only remedy is deleting a live, curated MCP write tool. Reproduced on
shillinq with the two spellings side by side.

The regression test's mutant restores BOTH pre-fix patterns together,
because the seam needs both and reverting one alone reads as "the fix
changed nothing".

Fleet sweep: 21 repos, zero verdict changes — the trap is latent, not live.

GATE 64 SAW ONE OF PHP'S THREE WAYS TO NAME A CLASS
---------------------------------------------------
Rule 2 required a QUOTED literal, so of these four only the first was a
finding; the other three were injected into larpingapp's register() and the
gate reported OK for every one:

    class_exists('OCA\OpenRegister\AppHost\…\GenericHealthController')
    class_exists(\OCA\OpenRegister\AppHost\…\GenericHealthController::class)
    use …\GenericHealthController;  class_exists(GenericHealthController::class)
    const AH = 'OCA\OpenRegister\AppHost\…';  class_exists(self::AH)

That is #184's lesson in the file where it was learned. All four spellings
now resolve through one resolver, so a spelling that escapes it escapes
both rules rather than whichever was written second. A bare `use` import
stays clean on purpose — `use` is a compile-time alias and does not
autoload; flagging it would newly redden four repos for code that works.

AND A GREEN GATE-64 WAS NOT EVIDENCE ABOUT THE WIDER PROBE
----------------------------------------------------------
The hard rule is scoped to OCA\OpenRegister\AppHost\, but the autoloader
mechanism has nothing to do with AppHost: during register() the whole
OCA\OpenRegister\ prefix is absent for any app sorting earlier, so ANY
class_exists() on it answers FALSE and everything it guards silently never
happens. Measured across apps-extra, no prelude present:

    larpingapp  3  Event\{DeepLinkRegistration,ObjectCreating,ObjectUpdating}
                   — the last two carry larpingapp's server-authoritative
                     skill-requirement / XP-budget enforcement on character
                     writes, which therefore never registers
    hermiq      3  flow-node, leaf-provider and shareable-config registration
    nldesign    1  shareable-config registration

Reported as a non-blocking NOTE, printed by the runner, and deliberately
not a FAIL: this gate is not diff-scoped, so failing it would block every
PR in three repos on code the PR did not touch — the trap
check_store_and_settings_surface.py already records. A probe in boot() is
NOT noted, because boot() runs after every app has registered.

ALSO
----
Gate 64's log path was a hardcoded /tmp/hydra-gate-apphost-autoload-prelude
.log — the shared-path non-determinism HYDRA_GATE_LOG_DIR exists to remove,
left behind in one gate.

TESTS
-----
  test_check_unclosable_gate.py                    NEW — gate 59 shipped
                                                   with no helper suite at
                                                   all; 23 cases, every arm
                                                   of the matrix above plus
                                                   the mutant that proves
                                                   the comment mask is
                                                   load-bearing
  test_gate_5661_empty_scope_is_not_a_pass.sh      NEW — 28 assertions over
                                                   gates 56-61: clean
                                                   in-scope subject PASSes,
                                                   empty scope is `na` with
                                                   a reason and exit 0 under
                                                   --require-full-coverage,
                                                   and a planted true
                                                   positive per gate still
                                                   FAILs. Against the
                                                   pre-fix package it
                                                   reports 13 failures,
                                                   naming the six PASSes
  test_check_apphost_autoload_prelude.py           +14 cases
  test_check_orphaned_write_capability.py          +5 cases
  test_check_listener_placement.py                 EXIT_EMPTY_SCOPE

51 discovered helper suites green (2 quarantined, unchanged). Full-tree run
on shillinq before/after: verdicts byte-identical for all nine gates.

* fix(gates 56,57,63,64): a crashed checker read as a clean tree, a real class read as absent, and a lazy closure read as an eager one

Second pass over the 56-64 band, planting in a SECOND repo of a different
shape per gate. Four more defects, all measured against gate package
48c88ba.

A CRASHED CHECKER REPORTED PASS — gates 56 and 57
--------------------------------------------------
Both invoked their helper as `>> log 2>/dev/null || true` and then derived
the verdict from `wc -l` on the log. Stderr discarded, exit status
discarded, empty log — so a checker that never started reported PASS.
Measured on shillinq with a python3 shim that exits 1 for exactly these two
helpers:

    [gate-56] register-handler-resolution: PASS      <- 153 registers
    [gate-57] orphaned-write-capability:   PASS      <- 316 services

and gate-57 had reported 20 real findings over that same tree on the
previous run. That is gate-40's defect verbatim. Both helpers ALWAYS exit 0
when they run, by design (#209 — the count goes to stdout, never into the
exit byte), so a non-zero exit can only be a crash and never a finding
count. Both now emit SKIPPED (wiring) and keep the stderr on disk.

Every gate in this band was re-checked for the count-as-exit-status defect
found in gates 19, 26 and 52: none of the nine has it. 56 and 57 put the
count on stdout and the runner counts lines; 58/59/60/61/62/63/64 return
status codes only.

A REAL CLASS READ AS ABSENT — gate 56
--------------------------------------
The PSR-4 path guess handles the conventional layout; the fallback walk
over lib/ is what finds a type living where PSR-4 does NOT predict — a
DI-bound registration, a type not named after its file. That is the shape
gate-30 was caught mis-resolving (`AppHost\Controller\GenericHealth`
PSR-4-maps to lib/Controller/AppHost/Controller/… while openregister
DI-binds it to lib/AppHost/Controller/).

The walk matched `class` only, with at most ONE modifier. So every other
declaration form was a FALSE POSITIVE on a type that genuinely exists — and
the action `guard-class-not-found` invites is to write the class a second
time. Measured, each against a real declaration at a non-conventional path:

    enum ProbeState: string { … }        -> guard-class-not-found
    interface ProbeContract { … }        -> guard-class-not-found
    trait ProbeTrait { … }               -> guard-class-not-found
    final readonly class ReadonlyProbe   -> guard-class-not-found

`final readonly` is ordinary PHP 8.2. Only the DECLARATION FORMS widen; the
line anchor that keeps docblock prose out is unchanged and asserted in both
directions.

A LAZY CLOSURE READ AS AN EAGER REFERENCE — gate 64
----------------------------------------------------
This module's header has always said lazy service closures that merely
MENTION an AppHost class are deliberately NOT flagged, because their bodies
run at resolution time. Both rules ran over the whole file, so they did not.

Measured on launchpad — deliberately a DIFFERENT repo shape from
larpingapp. launchpad's whole composition root resolves OpenRegister
lazily inside closures (it already does this for
AppHost\Observability\ManifestLoader); that is the documented leaf pattern
and the reason launchpad is green. A closure body naming Bootstrap reported
byte-identically to an eager `Bootstrap::register($context, …)`. The gate
would have failed the one repo doing it correctly, for doing it correctly,
and the only remedy is to stop writing the lazy form.

Anonymous and arrow-function bodies are now blanked before both rules.
Named methods are untouched (`public function register(` has an identifier
between `function` and `(`), and an eager reference AFTER or BETWEEN
closures is still caught — both asserted.

GATE 63 ON A CONTROLLER-ONLY DIFF — the reason was an overclaim
---------------------------------------------------------------
Every BLOCKING rule in this gate reads src/manifest.json, src/manifest.d/
or src/menu-layout.json. The two rules that touch lib/Settings are WARNs
and never fail it. So a PR that changes a settings CONTROLLER, or adds or
deletes a lib/Settings/*Admin.php section, lands in the empty-scope branch —
and the line read "this PR introduces no settings placement (ADR-079) to
judge", which on such a diff is false. The author changed the settings
surface; this gate does not adjudicate that half of it.

NOT WIDENED, on purpose. Reading the controller was tried and reverted, and
check_store_and_settings_surface.py records why: a gate that only RUNS when
a manifest changed and then judges code the PR never touched "blocked EVERY
manifest-touching PR in that repo, permanently". The verdict stays `na` —
the correct category, since no change the author could make puts a manifest
into a diff that does not touch one.

What changes is that the line now names which half it looked at, and when
the diff contains lib/Settings or a settings controller it says so
explicitly, so `na` cannot be read as a clearance for the change the author
actually made.

VERIFIED, BOTH ARMS OF THE #270 CONTRACT
-----------------------------------------
  * empty ADR-020 scope   -> NOT APPLICABLE, exit 0 under
                             --require-full-coverage (measured on the
                             controller-only fixture above)
  * genuine structural gap -> SKIPPED (structural), exit 98
                             (test_gate_empty_scope_never_passes.sh ARM 4,
                             gate-33 with --axe-enabled and no report)

And gate-60's three states, all asserted:
real finding · SKIPPED (wiring) naming the missing dependency · clean pass.

FLEET SWEEPS — 21 apps-extra repos, old helper vs new
------------------------------------------------------
  gate-56  zero verdict changes
  gate-64  zero verdict changes; the three pre-existing FAILs (openbuild,
           procest, scholiq) survive, and the three NOTEs (larpingapp,
           hermiq, nldesign) are unchanged

TESTS
-----
  test_gate_crashed_checker_is_not_a_finding.sh  +2 gates, 5 assertions.
      Two arms: the plants must FAIL with a working interpreter, and the
      SAME tree must report SKIPPED (wiring) with a dead one — otherwise
      "always skip" would pass. Against 48c88ba it reports the two PASSes.
  test_check_register_handler_resolution.py      +8 cases incl. the mutant
      that restores the pre-fix pattern and requires all four forms to go
      back to not-found.
  test_check_apphost_autoload_prelude.py         +9 cases, closure and
      anti-widening arms.

REPOS PLANTED IN, by gate
--------------------------
  56  shillinq (register-owning, 153 register.d files) + a synthetic
      DI-bound/non-conventional-path fixture
  57  shillinq (316 services) + fixture
  58  shillinq (60 e2e files); fleet-wide check that no live networkidle
      call in any repo lives outside tests/e2e/ — 193 inside, 0 outside
  59  docudesk (the repo the gate was written against) + fixture
  60  shillinq (233 manifests, fake MDI package) + fixture
  61  shillinq (15 post-event registrations)
  62  shillinq
  63  shillinq + a controller-only fixture
  64  larpingapp (eager class_exists composition root, 3 live probes)
      AND launchpad (lazy-closure composition root, 0 eager references)

NOT MINE, REPORTED NOT FIXED
-----------------------------
test_gate_45_to_55_acceptance.sh fails 4 gate-53 assertions identically on
pristine main (48c88ba) and on this branch — the suite expects blocking
behaviour for pre-existing orphans that #250/#260/#280 deliberately made
advisory. Out of this band; flagged rather than touched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant