diff --git a/AGENTS.md b/AGENTS.md index d81b285..4084abb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,3 +52,22 @@ The documentation is the source of truth. Do not invent requirements when an aut Prefer small, focused changes. Avoid unrelated refactoring. When a decision changes the architecture or requirements, update the relevant documentation before or with the implementation. + +## Vertical slice completion + +Each vertical slice must be complete before it is committed and pushed: + +- A new or changed Vue visual component must have a colocated Storybook story or an updated existing story covering its meaningful states. +- Stories must use representative fixture data and must not introduce production domain behavior solely for visual coverage. +- Visual slices must pass the web tests, production build, Storybook build, and Storybook interaction/accessibility runner before commit: + + ```sh + npm run test --workspace=@pokemon-inventory/web + npm run build --workspace=@pokemon-inventory/web + npm run build-storybook --workspace=@pokemon-inventory/web + npm run test-storybook + ``` + +- Storybook stories must cover relevant loading, empty, error, selected, disabled, responsive, light/dark theme, and keyboard states when those states exist in the component. +- Backend-only slices do not require Storybook changes unless they alter a user-facing visual contract. +- The final commit gate includes the appropriate API/domain/integration tests plus all applicable web and Storybook checks. diff --git a/docs/TESTING.md b/docs/TESTING.md index 4060d0f..22e44d4 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -27,7 +27,18 @@ Test: ## Component -Test important Vue components and composables. +Test important Vue components and composables. Every new or changed visual component must include a colocated Storybook story or an update to an existing story before its vertical slice is committed. + +For visual slices, run the complete Storybook gate from the repository root: + +```sh +npm run test --workspace=@pokemon-inventory/web +npm run build --workspace=@pokemon-inventory/web +npm run build-storybook --workspace=@pokemon-inventory/web +npm run test-storybook +``` + +Stories should use mock fixture data and cover the component states that users can encounter, including keyboard focus, selected, disabled, loading, empty, error, responsive, and light/dark theme behavior where applicable. Do not add production domain behavior just to make a story render. ## E2E @@ -58,4 +69,6 @@ GitHub Actions should run: - accessibility checks - build validation +The Storybook build and interaction/accessibility runner are part of the visual-slice commit gate. Backend-only slices may omit them when no visual component or UI contract changes. + Do not weaken or skip tests to obtain a passing build.