CI gates
CI Gates
This file documents the quality gates wired into .github/workflows/library-ci.yml
and their current enforcement state. Updating this file is part of changing a
gate's enforcement level — if you flip a step from continue-on-error: true to
required, update the table here in the same PR.
Gate matrix
| Gate | Tool | Scope | State | Promotion blocker |
|---|---|---|---|---|
| Package unit tests | pnpm test:packages:ci (vitest) | All workspaces | REQUIRED | — |
| Legacy root vitest suite | ./node_modules/.bin/vitest | Root src/ | NOT WIRED | Root src/ was removed when the code moved into packages/, so the root run finds no tests and no workflow invokes it. |
| Bundle size budgets | size-limit | core/react/vue/ng | WARN | Budgets are still pre-build measurements off src/index.ts; core currently reports ~242 kB against a 30 kB limit. |
| Publish hygiene (exports/types/main) | publint --strict | core/react/vue/ng | WARN | publint needs dist/ to verify file existence under pkg.exports. |
| Type-resolution (ESM) | @arethetypeswrong/cli (attw) | plot-contracts/script/core/script-chart/agent-runtime/vue/react/ng | REQUIRED | — |
| UI token gates | pnpm lint:ui (stylelint, bulk suppressions) | packages/vue/src | WARN (temporarily demoted) | The tokens-v2 adaptation of the Vue components is incomplete. stylelint-suppressions.json still lists the pre-reorg flat component paths (packages/vue/src/components/<File>.vue), which the semantic folder move invalidated, so recorded debt resurfaces as new violations on top of the ones still being added. Restore REQUIRED once the tokens are applied and the suppression baseline is re-recorded. |
SFC style src ban | scripts/check-style-src.mjs (part of pnpm lint) | packages/vue/src | REQUIRED | None. Shared CSS must be imported from <script setup>; <style src> duplicates the stylesheet per consumer and breaks under Vitest 5's persistent transform cache (vitejs/vite-plugin-vue#877). |
| Per-package build | pnpm -r build (tsc) | All workspaces | WARN | The recursive run also targets packages/desktop-electron (electron-builder) and examples/angular-universal (ng build, fails outside its own workspace), so it is not a library gate. The publishable packages are built by the test job instead. |
| Coverage threshold | @vitest/coverage-v8 | Root | NOT WIRED | Intentionally deferred until Round 1E lands real engine code worth covering. |
Package test scheduling
pnpm test:packages:ci runs workspace test scripts without topological
sorting, then runs script-chart on its own. Package builds still run in
dependency order before this step: tests
can consume built workspace exports, but do not need another package's tests
to finish first. Each package keeps its own Vitest configuration and file isolation.
The command limits concurrency to two packages, each with at most three Vitest
workers. This caps file workers at six; the two Vitest host processes are
additional. The modest overcommit on the four-vCPU CI runners accommodates
worker startup, imports and I/O. Increasing package concurrency or worker counts
can instead slow the suites down and trigger the script tests' existing timeouts.
script-chart executes the complete built-in script catalog inside its existing
five-second test deadline. It runs after the parallel phase so that this CPU-heavy
test does not compete with core transforms or other script execution. It remains
part of the same required gate, with the same worker cap, isolation and timeout.
Re-evaluate both limits together when the runner size or test workload changes.
The Node 26 job runs the complete package suite. For a local
comparison, set TZ=Asia/Shanghai, use the same machine and clear the Vitest
caches before each run so both commands start cold:
pnpm test:packages --clearCache
pnpm test:packages # existing dependency-ordered baseline
pnpm test:packages --clearCache
pnpm test:packages:ci # bounded scheduling, followed by script-chartCompare the package-test step's elapsed time, test-file/test counts and exit
status. Workflow totals include runner queueing and unrelated gates. The normal
pnpm test:packages command remains available for dependency-ordered local runs.
attw profile
pnpm lint:types runs scripts/lint-types.mjs, which pins one profile for
every publishable package:
--profile esm-only— each publishable package ships ESM only, and Node 26+ supportsrequire()of ESM, so the legacy Node CJS resolution rules only produce false alarms here.--exclude-entrypoints style.cssfor the Vue package — a CSS entry is not JavaScript and can never resolve as a type.
The package list and the per-package exclusions live in that script, so the profile has a single definition. Gate the new package by adding it there.
UI token gates
Biome provides the repository lint, formatting and import checks through pnpm lint.
pnpm lint:ui enforces ADR 0004 on packages/vue/src:
- stylelint (
stylelint.config.mjs, pluginscripts/lint/stylelint-plugin-klc.mjs): no raw colours, no raw px for padding/margin/gap/radius/font-size, no raw z-index, no textarearesizehandle, notransition: all. Fallbacks insidevar(--token, fallback)are allowed.
Existing style debt is recorded in stylelint-suppressions.json; CI fails only
when a file gains violations. After fixing debt run pnpm lint:ui:prune.
Temporarily demoted to WARN (the workflow step carries
continue-on-error: true): the tokens-v2 adaptation of the Vue components is not
finished, so the gate reports ~226 raw-px violations. The suppression entries also
still point at the pre-reorg flat paths (packages/vue/src/components/<File>.vue),
which the semantic folder move invalidated, so re-record the baseline once the
components settle. Restore [REQUIRED] when the adaptation lands.
Per-package bundle budgets
These are pre-build, source-based measurements (size-limit reads from
packages/<x>/src/index.ts). They will be re-measured against dist/index.js
once the build pipeline lands.
| Package | Limit (gzip) | Today's measurement | Rationale |
|---|---|---|---|
| core | 30 KB | ~1.6 KB | Headroom for signals + controller scaffolding + a minimal indicator set. |
| react | 8 KB | ~0.8 KB | Thin wrapper around core (use* hooks); peers excluded from the budget. |
| vue | 8 KB | ~1.1 KB | Thin composable layer; vue excluded from the budget. |
| angular | 10 KB | ~1.2 KB | Angular decorator runtime traditionally adds 1–2 KB; extra slack on top. |
If a limit trips, do not raise it reflexively — first check whether a tree shake or peer-dep externalization is the right move.
Publishing readiness (Round 1E target)
When Round 1E lands and we are ready to publish:
library-ci.ymlalready builds every package under the type-resolution gate before running it;lint:publishandsize:packagesreuse those builds.- Flip the remaining warn-only gates to required (remove
continue-on-error: true) once their blockers in the matrix are resolved. - Re-baseline the size budgets against the real
dist/index.js. - Verify
publishConfig.provenance: trueis honored by the publish workflow (it requiresid-token: writepermission and OIDC-enabled runners — already the default onubuntu-latest).
Promotion order for the remaining warn-only gates
lint:types (attw) is required as of #189. The two gates still warn-only:
publint --strict— cheapest to fix, catches brokenexports/main/typespaths before a user ever installs the package. Failure here means the package is literally unimportable. It passes today; promote it once theexportsshape of every publishable package is settled.size-limit— still measured pre-build offsrc/index.ts, so the budgets must be re-baselined against the realdist/output before the gate can be trusted.
Promoting attw first was deliberate: unlike the other two, it was the only
gate that could see the type/runtime mismatch shipped in #189 (extensionless
relative imports, .vue declaration specifiers, a leaked workspace path), so
it had to go live before the packages could be called correct.
Local commands
pnpm test:packages # workspace tests
pnpm test:packages:ci # same tests, with bounded CI scheduling
pnpm size:packages # bundle budgets
pnpm lint:publish # publint --strict, every publishable package
pnpm lint:types # attw (esm-only profile), every publishable package