chore: pre-publish hardening#7
Merged
Merged
Conversation
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.
Gate audit
Gate 1 — Error class boundary behavior: Implementation correct (
Object.setPrototypeOf(this, new.target.prototype)present in both constructors;toJSON()present;instanceofchain intact). Finding: tests coveredinstanceof,name, anderr.toJSON()round-trip, but no test calledJSON.stringify(err)directly — the spec requires verifying the error instance itself serializes correctly viatoJSON, not just the result of callingtoJSON()manually. Action: added two tests (one per class) that callJSON.parse(JSON.stringify(err))directly and assert all metadata fields are present.Gate 2 —
prepublishOnlyordering:"prepublishOnly": "npm run typecheck && npm run test && npm run build"— typecheck → test → build. Finding: correct. No change needed.Gate 3 — README "What the library does not do" section: Section present at line 290 with all 7 required items (no usage tracking, no period reset enforcement, no persistence, no remote config fetching, no auth beyond feature gating, no billing integration, no framework bindings). Finding: complete and correct. No change needed.
Gate 4 — Sourcemap trade-off documented: Finding: missing — no mention of sourcemaps in README or CHANGELOG. Action: added a "Package notes" block to CHANGELOG.md under
[0.1.0]stating that sourcemaps are excluded and how to get them.Gate 5 — Type tests run in CI:
vitest.config.tshastest.typecheck.enabled: trueandinclude: ['tests/**/*.test-d.ts']. CI runsnpm run testwhich invokesvitest run --coverage. Prior test runs confirm✓ TS tests/types.test-d.ts (3 tests)appears in output. Finding: type tests are exercised in CI. No change needed.Gate 6 — Package size budget: Running
npm pack --dry-runafter all changes: 33.6 KB unpacked. Exceeds 30 KB. Going with option (b): documented explicitly in CHANGELOG.md under[0.1.0]Package notes. Rationale: README sections required by v1 spec cannot be trimmed without removing required content; CHANGELOG.md inclusion (gate 7) adds 2.9 KB; total reflects all required content.Gate 7 —
npm packcontent audit: Pre-fix tarball contents wereLICENSE,README.md,dist/index.{js,cjs,d.ts,d.cts},schema/config.schema.json,package.json. Finding:CHANGELOG.mdwas present in the repo but absent from the tarball — the spec says "include if present." No other leakage (nosrc/,tests/,tsup.config.ts,vitest.config.ts,biome.json,tsconfig.json,.github/). Action: added"CHANGELOG.md"to thefilesfield inpackage.json. Post-fix tarball: 9 files, 8.9 kB packed / 33.6 kB unpacked.Final tarball contents:
Gate 8 — Branch protection on
main: Finding: not configured (missing). Action: configured viagh apibefore opening this PR. Settings applied:required_status_checkswithstrict: trueand contexts["CI (Node 18)", "CI (Node 20)"](matched fromgh api repos/.../commits/main/check-runs),allow_force_pushes: false,allow_deletions: false,enforce_admins: false. API call succeeded.Tests
76 tests pass (up from 74), 100% coverage maintained on all runtime files.
User-side TODOs before
npm publishnpm profile enable-2fa auth-and-writes— required for publishing scoped or high-value packages and strongly recommended for any package.mainafter this PR merges, runnpm publish --dry-runand inspect the output. Confirm the tarball contents match the gate 7 list above before running the real publish.