Skip to content

Tighten lint:pkg gate: fail CI on publint suggestions (enforcement #33)#49

Merged
jasperboerhof merged 1 commit into
armory-publint-git-prefix-sweepfrom
armory-publint-gate-tightening
Apr 23, 2026
Merged

Tighten lint:pkg gate: fail CI on publint suggestions (enforcement #33)#49
jasperboerhof merged 1 commit into
armory-publint-git-prefix-sweepfrom
armory-publint-gate-tightening

Conversation

@Goosterhof
Copy link
Copy Markdown
Contributor

Summary

Why a wrapper, not a CLI flag

publint 0.3.18's documented `--strict` flag only promotes warnings → errors. Empirical testing of all four flag combinations (no flag, `--strict`, `--level suggestion`, `--strict --level suggestion`) confirmed all exit 0 on a real `git+` suggestion. Option (a) in enforcement #33 was vaporware. The wrapper was the only viable path.

How the wrapper works

`scripts/lint-pkg.mjs` iterates each workspace and for each:

  1. Runs `publint run` — captures stdout
  2. Runs `attw --pack` — captures stdout
  3. Greps for `/^(Suggestions|Warnings|Errors):$/m` in either output
  4. On any match, exits non-zero with a greppable single-line failure naming the package and the advisory class

Per-package `lint:pkg` scripts stay `publint && attw --pack` for developer ergonomics — only the CI-facing root gate enforces the tightened severity.

Smoke test verified the gate fires

State Command Exit
`git+` reintroduced to one package direct `publint && attw --pack` 0 (drift silent)
`git+` reintroduced to one package `npm run lint:pkg` (this PR) 1 with `@script-development/fs-http: publint emitted "Suggestions:" block (fail-on-suggestion gate)`
reverted `npm run lint:pkg` 0 with `lint:pkg gate PASS — 10 packages clean`

Stacking

This PR is stacked on #48 (publint `git+` sweep). Base is `armory-publint-git-prefix-sweep`, not `main` — because tightening the gate on top of the regressed manifests would fail CI immediately. When #48 merges to main, this PR auto-retargets.

Test plan

All 8 CI gates confirmed green locally on the stacked branch:

  • `npm audit` — 0 vulnerabilities
  • `npm run format:check` — 131 files clean (+1 for wrapper)
  • `npm run lint` — 81 files, 93 rules, 0/0
  • `npm run build` — 10 packages
  • `npm run typecheck` — `tsc --noEmit` clean
  • `npm run lint:pkg` (tightened) — 10 packages clean
  • `npm run test:coverage` — 427/427 tests
  • `npm run test:mutation` — all ≥ 90% threshold
  • Smoke test (above table) replayed on merged state post-rebase

Future-proofing

If publint adds a native `--strict-suggestions` (or equivalent) flag in a future release, the wrapper is a one-character swap away from being replaced by a flag. Until then, the wrapper is the enforcement surface.

Closes enforcement queue #33. publint 0.3.18 CLI does not expose a
flag to fail on suggestions: --level only controls log verbosity,
--strict only promotes warnings → errors. Verified empirically with
all three flag combinations on a real git+ URL suggestion — every
invocation exits 0.

Option (a) rejected by empirical test; Option (b) chosen.

Adds scripts/lint-pkg.mjs — ESM Node wrapper that runs publint per
workspace, detects Suggestions:/Warnings:/Errors: blocks, runs attw
--pack alongside, and exits non-zero on any publint advisory OR attw
failure. Failure output names both the package and the advisory class
in a single greppable line.

Root "lint:pkg" now points at the wrapper; per-package "lint:pkg"
scripts stay as "publint && attw --pack" for developer ergonomics
during per-package iteration.

Smoke test:
  - BEFORE tightening: publint && attw on git+-stripped http/package.json → exit 0 (silent drift)
  - AFTER tightening: npm run lint:pkg on same regression → exit 1 with "fs-http: publint emitted \"Suggestions:\" block (fail-on-suggestion gate)"
  - Post-revert: npm run lint:pkg → exit 0

All 8 CI gates green on sweep-normalized base (stacked on
armory-publint-git-prefix-sweep).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying fs-packages with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4a02c7b
Status: ✅  Deploy successful!
Preview URL: https://116a3c2e.fs-packages.pages.dev
Branch Preview URL: https://armory-publint-gate-tighteni.fs-packages.pages.dev

View logs

@jasperboerhof jasperboerhof merged commit d3f7143 into armory-publint-git-prefix-sweep Apr 23, 2026
1 check passed
@jasperboerhof jasperboerhof deleted the armory-publint-gate-tightening branch April 23, 2026 06:12
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.

2 participants