Repository navigation
Add machine-checked constraints for production builds (0.8.0) - #15
Merged
Merged
Conversation
A starting point for anyone new to xstack. The skill shows the staircase, an interactive page of the five steps from first conversation to a live service, then asks where the team is and gives the one thing to run next. The staircase ships with the skill in skills/help/assets/. The README, quick start, changelog and contributing checklist now point to it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Rules a production service must meet are now enforced by xstack instead of left to instructions. - constraints/baseline.json: 12 rules for every country. A Barbados layer adds two. A service opts in with .xstack/constraints.json - scripts/xstack-check.mjs: a dependency-free runner with write, stop and ci stages, waivers with an expiry, and --vendor for CI - hooks/: refuse a write that breaks a constraint, ask a person before a protected path changes, and block finishing while a "must" fails - /xstack:productionise writes the constraints file and builds the readiness report from check output, with no generated audit.sh. /xstack:threat-model drafts a constraint per control Retrofit the medical-licence example. The shipped checks failed two things its generated audit had passed: a file upload sent by GET and 50 dead links. Both are fixed: the upload posts, and the ten missing pages are built. Also fix tests/security/headers.sh on macOS sed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- .github/workflows/constraints.yml: test the runner and hooks, check vendored copies match the source, and run the ci stage on the medical-licence example - constraints/ci/github-actions.yml: the same job for a service to copy - scripts/xstack-check.test.mjs: ten tests covering each baseline rule, waivers, layering, the write guard and the Stop gate - Commit the example's lockfile and record its first Playwright run: the accessibility suite and two end-to-end tests fail The example job is expected to fail until those are fixed or waived. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The suites had never been run. In desktop Chromium 11 of 28 failed. - Secondary text uses GovBB grey-70 (#595959). #777777 failed WCAG AA contrast on white and off-white - The summary list on the check page is valid dl markup: no region role on the dl, and the Change link sits in a dd - Two test locators were wrong: a substring match on "Back" also found "Give feedback", and a named-group locator for a details element never resolved All 28 now pass in Chromium, and axe is clean on all 19 pages. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Running all five browser profiles at once dropped most connections: the local server was single-threaded and IPv4 only. It is now threaded and listens on IPv4 and IPv6. The skip-link test uses Option+Tab in WebKit on macOS, where plain Tab does not move focus to links. 140 of 140 tests pass across the five profiles, and 16 of 17 constraints pass locally at the ci stage. gitleaks runs in CI. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A Content-Security-Policy without 'unsafe-inline' in style-src makes browsers ignore style attributes, so a page does not look the way it was written. The baseline did not catch this. - SEC-008 in the baseline forbids style attributes in web pages, at the write, stop and ci stages - The medical-licence example had 100 of them across 19 pages. Each is now a utility class in the linked stylesheet, so the styles apply 140 of 140 tests pass across five browser profiles, axe is clean on all 19 pages, and no page logs a policy violation. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Bump the plugin and marketplace versions to 0.8.0 and cut the changelog. The marketplace entry had drifted to 0.1.1 - Add the ten supporting pages to the accessibility spec, and a new end-to-end spec for correcting details, the CPD upload and the footer pages. 245 of 245 tests pass across five browser profiles - Regenerate the example's evidence table from a ci-stage run and rewrite the readiness report's headline to match: 17 of 18 constraints pass locally, and gitleaks passes in CI Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
They could write tests and checks but not run them, so their evidence was a description of what would happen. - Both agents get Bash, with instructions: run the constraints and the tests, report what actually happened, never use the shell to change a protected path, stay inside the project - hooks/guard-bash.mjs asks a person before a shell command that looks like it changes a protected path. Running the checks is not held up. It reads the command as text, so it is a tripwire, not a wall - The Stop gate and the shell guard share one root finder Tested with 11 automated tests and three live sessions: the developer agent ran the checks, refused on its own instructions to edit the constraints file, and the guard held the same command when a plain session tried it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Only Barbados had a profile layer, so a Kestria service got the baseline alone and a new country had nothing to copy. - profiles/kestria/constraints.json: ten rules from the GovKestria design system, the reserved codes, and Kestria's platforms and law. The fictional-country notice, GovKestria markup and tokens, +999 numbers and kestria.test addresses, the language switcher, page weight, and no home-made sign-in or account fields - profiles/_template/constraints.json: four example rules with notes on where to look for rules and how to test them - A max-size check type, for the page-weight rule - The GovKestria starter page used a style attribute, which the baseline refuses. It now uses a kg-help--spaced class - Tests: every bundled layer loads, the Kestria layer passes the starter page, and each Kestria rule catches its mistake Co-Authored-By: Claude Fable 5.2 <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.
What this does
Rules a production service must meet are now enforced by xstack, not left to instructions. Until now every rule was prose, and
/xstack:productionisegenerated its ownaudit.shin the same run as the code it checked.constraints/baseline.jsonhas 13 rules for every country.profiles/barbados/constraints.jsonadds two andprofiles/kestria/constraints.jsonadds ten.profiles/_template/constraints.jsonis the starting point for another country. A service opts in with.xstack/constraints.jsonand adds its ownscripts/xstack-check.mjs, no dependencies. Three stages (write,stop,ci), results of PASS, FAIL, WAIVED or NOT RUN, and--vendorto copy it into a service for CIhooks/guard-write.mjsrefuses a write that breaks a constraint and asks a person before a protected path changes.hooks/stop-gate.mjssends the agent back while a "must" constraint failshooks/guard-bash.mjsasks a person before a shell command changes a protected path/xstack:productionisewrites the constraints file and builds PRODUCTION-READINESS.md from check output./xstack:threat-modeldrafts a constraint per controlStart with
constraints/README.md.The medical-licence example
Retrofitted as the proof. It now meets all 18 of its constraints. What the checks found along the way, all fixed:
SEC-004– the CPD upload sent a file by GET. It now posts, and has an upload button so it works without JavaScriptWFT-001– 50 links went to pages that did not exist. The ten missing pages are builtSEC-008– 100 inlinestyleattributes that the page's own Content-Security-Policy blocked. They are now stylesheet classes, and the baseline forbids style attributesAlso fixes
tests/security/headers.sh, which reported two correct headers as weak on macOSsed.Version
Bumps the plugin to 0.8.0 and cuts the changelog. The marketplace entry had drifted to 0.1.1 and is now 0.8.0 too.
CI
.github/workflows/constraints.ymlis the backstop for the hooks, which only see Write and Edit.scripts/xstack-check.test.mjs, and a check that vendored copies of the runner match the sourcecistage on the medical-licence example: gitleaks,npm audit, the lockfile, security headers, and Playwright across five browser profilesconstraints/ci/github-actions.ymlis the same job for a service to copy.Tested
onclick, an edit to.xstack/constraints.jsonwas held for approval and declined, and the Stop gate sent the agent back over a dead link until it fixed itxstack-checkand reported its result, refused on its own instructions to edit the constraints file withsed, and the shell guard held the same command when a plain session tried itcistage. The eighteenth, gitleaks, runs in CINot tested, not done
Note for the reviewer
This branch was cut from a local branch, so it also carries
b24dab5(Add the help skill, which shows the staircase).🤖 Generated with Claude Code