Skip to content

feat(hydra-gates): gate 123 holds listed files at the 5-star unit bounds - #913

Merged
rubenvdlinde merged 7 commits into
mainfrom
feat/sig-five-star-floor
Nov 7, 2026
Merged

rubenvdlinde merged 7 commits into
mainfrom
feat/sig-five-star-floor

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Stacks on #911 (feat/sig-rating-estimate). Review or merge #911 first; until then this diff also shows its commits.

What it adds

An app can list files in .sig/five-star-files.txt: repo-relative paths, one per line, # comments allowed. Gate 123 holds each listed file at the 5-star unit bounds.

  • A unit fails at NLOC above 15, McCabe above 5, or more than 2 parameters.
  • The file fails when it holds a duplicated block of 6 or more code lines, in itself or against same-language files.
  • Units come from gate 122's lizard reader. Clones come from gate 122's 6-line windows, now shared through dup_windows().
  • Clone windows skip use, namespace and import lines, plus comment-only end markers such as }//end name(). In .vue, .js and .ts files they also skip SFC block tags and the export default { line with its closing }. Every other line counts.
  • Three kinds of unit skip the parameter rule only, detected from the source:
    • constructors that only wire dependencies: promoted, assigned to a property, or forwarded to the parent constructor;
    • PHP methods that implement an interface method in the class's implements chain. The chain covers parents, abstract parents, repo interfaces and vendor interfaces found through composer's autoload maps.
    • public controller methods named as a route target in appinfo/routes.php, when every parameter is a path parameter of that one route.
  • Diff mode (with a base) judges the listed files the change touches or adds to the list. Full mode (nightly) judges them all.
  • A listed file that no longer exists fails in both modes. Removing a path from the list while its file exists also fails.
  • The summary reports the lizard version. Findings in .vue, .js and .ts files are warnings while the pinned lizard is 1.25.0 or older (JS/TS: a < comparison in an object property value is read as generic type parameters and merges the following functions terryyin/lizard#549). The runner then reports gate 123 as WARNING.
  • Gate 122 change: Vue duplication windows stay inside one SFC block, so none crosses template, script and style. This applies to the report and the file floor. It is our assumption until a real Sigrid scan confirms it, and the report and sig-scores.mdx say so. On openregister at a0c6f629e, Vue duplication goes from 11.61% (2 stars) to 9.40% (3 stars).
  • The gate applies when .github/sig-floor.json or the list exists. Without either it stays NOT APPLICABLE.

check_sig_floor.py write . re-records the app-level floor at current values. It adds checks the tree meets and never drops a floored one; a test now covers the raise direction too.

Verified locally

  • test_sig_file_floor.py: 49 tests. Pass and fail fixtures per rule, all three exemptions, the clone-line exclusions, missing and unlisted files, diff vs full mode, and the Vue warning with a newer lizard pin.
  • test_gate123_sig_floor_scope.sh: new arms 5 (FAIL on a listed PHP file) and 6 (WARNING on a listed Vue file).
  • Unchanged and green: test_check_sig_floor.py (35), test_check_sig_maintainability.py (67, 10 new for the Vue pieces), test_gate122_sig_maintainability_scope.sh.

🤖 Generated with Claude Code

…and its levers

The report now carries `rating`: a continuous 0.5 to 5.5 estimate per check
(Alves, Correia and Visser 2011, eq. 1), per property and language, per
property across languages (weighted by code), per sub-characteristic and
overall. SIG publishes no power-mean exponent for the 2026 model, so the
overall rating is reported under p = 1 and p = -1 as a range.

Levers: per property and language, the overall gain from fixing the next
1,000 exposed lines worst band first, and the lines needed to raise the
property by 0.5. A lever is sure when it ranks in the top 3 under both
exponents. Report rows now also carry the lines above each bound.

Component independence and entanglement get assumed 3 and 2 star caps for
the estimate only; their discrete check still reads <4 below 4 stars.

Assisted-by: ClaudeCode:claude-opus-5-5
An app may list files in .sig/five-star-files.txt (repo-relative paths, one
per line, # comments allowed). Gate 123 then fails when a unit in a listed
file exceeds NLOC 15, McCabe 5 or 2 parameters, or when the file holds a
duplicated block of 6+ code lines. Units come from gate 122's lizard reader,
clones from gate 122's 6-line windows, now shared through dup_windows().

- Clone windows leave out use/namespace/import lines and comment-only end
  markers such as }//end name(); everything else still counts.
- Parameter rule exemptions, detected from the source: constructors that
  only wire dependencies (promoted, assigned, or forwarded to the parent),
  and PHP methods that implement an interface method in the class's
  implements chain (repo interfaces, parents, vendor via composer maps).
- Diff mode (a base) judges listed files the change touches or adds to the
  list; full mode judges all. A listed file that is gone fails, and so does
  removing a path while its file exists.
- Vue/JS/TS findings are warnings while the pinned lizard is 1.25.0 or older
  (terryyin/lizard#549); the runner reports them as WARNING.
- The gate applies when either .github/sig-floor.json or the list exists.

Assisted-by: ClaudeCode:claude-opus-5-5
In .vue, .js and .ts files the clone windows of gate 123's five-star file
floor now also leave out SFC block tags (<template>, <script setup>,
</style> and the like) and the `export default {` line with the `}` that
closes it. Import lines were already left out. Component lists, lifecycle
bodies and template markup still count.

Assisted-by: ClaudeCode:claude-opus-5-5
A public controller method named as a route target in appinfo/routes.php is
exempt from the parameter rule when every parameter is a path parameter of
that one route. Size, complexity and clones still apply. Detection reads
routes.php: commented-out routes do not count, `Settings\Foo#bar` targets
resolve into the Controller subfolder, and `resources` entries name no method.

PHP comment stripping now keeps string contents, so a `//` or `#` inside a
string no longer cuts the line.

Assisted-by: ClaudeCode:claude-opus-5-5
Gate 122's 6-line windows no longer cross a block boundary in a .vue file.
Template, script, style and custom blocks are separate pieces, and the tag
lines belong to none. The share's denominator keeps every code line. The
five-star file floor shares dup_windows() and follows the same rule; the
boundaries are read from the file's lines because the floor's code lines
leave the tags out.

This is an assumption until a real Sigrid scan confirms it. The report
(markdown and an `assumptions` list in the JSON) and sig-scores.mdx say so.
The jscpd cross-check figure does not apply it.

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde merged commit 50ff143 into main Nov 7, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant