fix(ci): widen node workspace detection, refuse a silent pass (G-015) - #92
Merged
Merged
Conversation
nself-ci wired into nself-org/plugins ran only secrets:gitleaks and still reported "Overall: PASSED", because the node stack detector required a formal pnpm-workspace.yaml or package.json "workspaces" field to find member packages. plugins has 5 nested package.json files and neither declaration, so the gate verified zero lines of code while looking green. Detection: add a bounded fallback walk (discoverNestedMembers) that finds nested package.json files when no workspace is declared, skipping node_modules/dist/build/.git/etc. Declared workspaces (pnpm-workspace.yaml or package.json "workspaces") still take priority and run via `pnpm -r`; implicit members run individually since pnpm can't recurse into packages it doesn't know are related. Also fixes package.json "workspaces" support, which was previously dead code (loadPackageJSON only ever returns the "scripts" sub-object, so the old type assertion could never succeed). Silence: GateResult gains Substantive and Skipped fields. Run() now refuses to pass when every executed gate is non-substantive (secrets scan, gateway routing, eval) even though the old "zero gates" guard doesn't fire — this is the exact G-015 shape (gitleaks ran, node contributed nothing). Every script the node gate doesn't find gets an explicit Skipped gate naming the reason, so a run is never silently missing a check. Split gate_runners.go and gate_helpers.go to stay under the 300-line cap: node-specific runners move to gate_runners_node.go, workspace detection to gate_workspace.go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nself-ciwired intonself-org/pluginsran onlysecrets:gitleaksand reportedOverall: PASSED, because node workspace-member detection required a formalpnpm-workspace.yamlorpackage.json"workspaces"field.pluginshas 5 nestedpackage.jsonfiles and neither declaration, so the node stack contributed zero checks.discoverNestedMembers,gate_workspace.go) that discovers nested member packages when no workspace is declared (skipsnode_modules/dist/build/.git/etc). Declared workspaces still win and run viapnpm -r; implicit members run individually since pnpm can't recurse into packages it doesn't know about. Also fixespackage.json"workspaces"support, previously dead code (the old lookup could never succeed).GateResultgainsSubstantive/Skippedfields.Run()now refuses to report a pass when every gate that executed was non-substantive (secrets/gateway/eval only) — the exact shape of this bug, where the pre-existing "zero gates" guard didn't fire because gitleaks counted as a gate. Every script the node gate can't find anywhere gets an explicitSKIPentry naming the reason.gate_runners.go/gate_helpers.goto stay under the repo's 300-line-per-file cap: node runners →gate_runners_node.go, workspace detection →gate_workspace.go.Coordinates with #91 (workflow/docs wiring) without touching the same files — no conflict.
Verification (real output, this repo)
Before (
git stashthe fix, same repo):After, fresh checkout with no
node_modules(honest — deps were never installed, so it says so instead of lying):After, deps installed (
pnpm installper member) — real, pre-existing bugs inpluginsthe old gate never once ran a check against:None of this is invented — it's real signal the old gate never surfaced because it only ever ran gitleaks. Fixing those app-level bugs is separate, follow-on work.
Test plan
go build ./... && go vet ./...cleango test ./...— 22 passed (12 pre-existing unchanged + 10 new), 0 failedgofmt -lclean on every touched/added filepluginsbefore and after, pasted above