EnergyVenom's picture
Astra: regression catalogue, runner robustness, idempotent Agent Studio contract, key-screen design (2182ef729b22)
152e0c1 verified
|
Raw History Blame Contribute Delete
6.23 kB

Quality gates

Audience: anyone changing Astra. The backend and agent gates come first; the web app gates follow.

Backend and agent gates

A release goes out only when every gate below passes. The first one runs in CI on every push; the others need a Fusion test pod and are checked by a person on the release candidate, before the deploy.

Gate Checks Run Where
Full test suite Every backend test, with the browser in stub mode; ruff lint; pip-audit PLAYWRIGHT_MODE=stub python -m pytest coworker/tests triage/tests -q, ruff check coworker triage reports qa CI (backend)
Container self-test The image starts, serves the app, the practice pod answers; selftest offline and --live; deploy/smoke_run.py quick and --full on the practice pod .github/workflows/image.yml CI (image, on main)
Scenario yield per area For each business area of a live Fusion run, the AI wrote scenarios and they reached the gate. The run's events carry one line per area: "AP: the AI model wrote N scenario(s), offered for approval ..." (or "... M passed the dry run" with FPT_FUSION_AI_DRY_RUN=1). An area with 0, or with "no new scenario was written", fails the gate until the reason in that line is fixed. A live run on the Fusion pod; GET /api/runs/{id}/events Release candidate
Screen coverage of key tasks The screens read for each area include its key business tasks (platform/fusion_catalog.py key_tasks, for example Create Invoice, Manage Invoices for AP). The pod card lists the screens read and the ones that failed; a key task missing there means the AI designs from the wrong screens. Test environments > the pod > Read screens; the pod's screens state Release candidate
Test data from the right business unit The pod's sampled test data (Test environments) uses the business unit the tests run in, and the invoice line account comes from that unit's chart of accounts. Unit test: test_discovery.py test_the_line_account_comes_from_the_tests_business_unit. Test environments > Discover on the pod, then read its test data CI and release candidate
Live smoke run On the release candidate, after deploy/runner/sync.sh: a short live run (depth smoke, real browser) on the Fusion pod through the runner. Pre-flight passes (runner version is the deployed commit, sign-in works, test data present), the scenarios run in the browser, triage and the report finish, and the Excel test script downloads. Start a run from the app on the Fusion pod Release candidate

The suite covers the design rules behind these gates (test_regression_checks.py: key screens first, no screen taking more than its share, catalogue regression checks asked at depth full within the cap), but only a live run shows the yield on a real pod.

Web app gates

All commands run in web/. The browser gates start their own backend and practice app on a fresh, throwaway data folder (e2e/playwright.config.ts). Before the first run you need:

  • the Python virtual environment in architecture/.venv (or a global python);
  • npx playwright install chromium.
Gate Checks Run Where
Type-check, lint, build TypeScript, ESLint with 0 warnings, the Vite build npm run build, npm run lint CI (web)
Unit tests Vitest + Testing Library npm test CI (web)
End-to-end Consultant flow, RBAC/CSRF, live view, chat, brand and keyboard npm run e2e CI (web-e2e)
Accessibility axe-core on every main screen (signed out and in, including the run views) at 1280 and 375 px, light and dark npm run test:a11y CI (web-e2e)
Visual regression Sign-in, Home, Test runs, Ask and Settings at 1280 and 375 px against stored screenshots npm run test:visual Local
Lighthouse Sign-in page, desktop and mobile npm run lighthouse (start the app first) Local
Pre-commit ESLint on staged .ts/.tsx, type-check of both TS projects Automatic on git commit Local (husky)
Dependencies npm audit npm audit --omit=dev CI (web)

Budgets

  • Accessibility:

    • Fails on any serious or critical axe violation.
    • Moderate and minor findings appear as test annotations in the report, without failing.
  • Visual regression: a screen may differ by at most 1 % of its pixels (maxDiffPixelRatio: 0.01). These are masked:

    • times and dates;
    • run ids;
    • the version line;
    • 3D canvases.
  • Lighthouse (sign-in page):

    Category Minimum
    Performance 80
    Accessibility 95
    Best practices 90
    SEO 80

    Signed-in screens are covered by the accessibility gate instead. Lighthouse runs as npx lighthouse@13.6.0 and is not a dependency (see docs/DEPENDENCIES.md).

Visual baselines

Baselines live next to the spec in e2e/visual.e2e.ts-snapshots/. When a screen changes on purpose:

  1. Run npm run test:visual:update.
  2. Open the new images and check each one.
  3. Commit them together with the change.

Screenshots differ between operating systems (fonts, anti-aliasing), so baselines are made and compared on the same platform. That is why visual regression is a local gate and not a CI one.

Pre-commit hook

npm install runs prepare, which points git at web/.husky. The hook runs npx lint-staged, configured in web/lint-staged.config.js.

  • It checks only staged files, except the type-check, which runs once for each project.
  • Skip it in an emergency with HUSKY=0 git commit ….
  • CI sets HUSKY=0.

Prettier is not used. The codebase has its own consistent formatting, and adding Prettier now would reformat every file in one unrelated commit.

Pending owner decisions

  • Storybook: the shared components (DataTable, QueryState, NavTabs, CoworkerCard, the pw-* surfaces) would benefit from it. It adds a large dev-dependency tree and a build to maintain, so it waits for an owner decision.
  • Tooling majors: vitest 5 and ESLint/typescript-eslint majors clear the remaining dev-only npm audit advisories (docs/DEPENDENCIES.md).