feat(build): run the contract checker on every installed artifact - #101
Merged
Merged
Conversation
The publish-docs action checks a docs repo's output before release; the build now runs the same checker (actions/lib/check.js) again on what the knowledge base actually received, because not every artifact went through a current action: one published before a rule existed, one packed by hand, one whose HTML the old pattern-matching checks missed. - scripts/check-artifact.js checks each app as installed into apps/, before inline scripts are hoisted, on every source (prebuilt and local included). Findings are logged grouped by rule, one line per rule with a count and the first example, plus a per-artifact summary. - A strict build (KB_STRICT, the deployment workflow's default) refuses an artifact with an error finding, naming the rule and file. Warnings never fail a build. - This replaces the build's entry-point-only headless marker warning. check.js resolves htmlparser2/postcss from actions/node_modules when that tree is installed and from the root otherwise (CI's E2E job installs only the root), so the root package.json now pins both at the versions actions/package.json pins, and a test holds the two in step. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Follow-up to #100. The knowledge base build now runs the same contract checker the
publish-docsaction runs (actions/lib/check.js, rules incontract/RULES.md), on every artifact it installs.Why
Not every artifact in a registry went through a current action:
formaction.The build repairs some findings as it re-hosts a page, so a failing publish is not the only signal a registry owner needs. They need to see which docs repo to chase, and for what.
What
scripts/check-artifact.jschecks each app as installed intoapps/, before inline scripts are hoisted, on every source (prebuilt and local included).KB-HTML-004 ×9, e.g. user-guide/admin/index.html: …, then0 error(s), 28 warning(s).errorfinding. Strict isKB_STRICT, which the deployment workflow turns on by default. The error names the rule and the file. Warnings never fail a build.htmlparser2andpostcssare now root dependencies, pinned at the versionsactions/package.jsonpins.check.jsresolves them fromactions/node_moduleswhen that is installed, otherwise from the root.tests/artifact-checks.spec.jsfails if the two pins drift.Strict is on by default in
build-image.yml, so after this merges a deployment build fails if any registered artifact has an error finding.Artifacts published by the v1 action should pass: the action has refused these error rules since v1.0.0. The remaining risk is:
To check a deployment registry before rolling this out, run a non-strict build of it. It logs every finding without failing.
Testing
npm test: 382 of 382 passed, including the 10 new tests.npm run selftestinactions/passes.actions/node_modulesmoved aside, the hermetic build andartifact-checks.spec.jsboth pass.contract/DEPLOYMENT.mdgains the new strict-rejection row, andRULES.mdandCLAUDE.mdare updated.Refs #67. The build now logs inline handlers (
KB-HTML-005) per artifact; it still does not strip them.🤖 Generated with Claude Code