Sharing a toolbox meant exporting a JSON file and passing it around by hand. A toolbox can now be sent from the site while staying local first: the browser compresses and encrypts the v2 export with AES-GCM, and the key lives only in the link fragment, so the server keeps for at most 24 hours a copy it cannot read. - Add the /api/shares service: upload, metadata, download and revoke, with files in SHARES_DIR, a purge every 10 minutes, and single-use links (the default) deleted only once fully downloaded. - Cap the server load: 50 MiB per share, total storage, free disk space, daily volume, concurrent and stalled uploads, reads per link, plus a wide per-connection cap kept in memory without storing IPs. - Limit each browser to 2 shares and 100 MiB per day and 2 active links, and show the existing link of a toolbox already shared. - Add the send dialog (card and game drawer) and the /receive page, which previews or directly imports through the existing import path. - Move shared HTTP helpers to services/http.js for both APIs. - Document the format, delivery, server layout and privacy wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
8.5 KiB
Markdown
104 lines
8.5 KiB
Markdown
# Test Strategy
|
|
|
|
## Scope
|
|
|
|
The risk-based completion boundary for audit C06 (2026-09-09), agreed on
|
|
2026-09-17, is regression coverage of important workflows, not elimination of
|
|
every source-text assertion. Beads task `sokko-g-zsd` tracks acceptance and status.
|
|
This document is a coverage reference, not a separate task backlog.
|
|
|
|
An inventory found 350 `match` / `doesNotMatch` calls across the static app,
|
|
toolbox and style tests before the final batch. This counts assertion calls,
|
|
not bugs, missing scenarios or a percentage of work remaining.
|
|
|
|
## Coverage Boundary
|
|
|
|
| Risk | Behavioral coverage |
|
|
| --- | --- |
|
|
| Data loss, startup failure, deferred media | `e2e/persistence.spec.js`, `storage-startup.spec.js`, `deferred-media.spec.js`; Node persistence queue and image action tests |
|
|
| React lifecycle, shared editing and navigation | `e2e/editor-lifecycle.spec.js`, `inline-edit.spec.js`, `form-reorder.spec.js`, `shell-behavior.spec.js`, `session-state.spec.js` |
|
|
| Public data loading, retry and stale responses | `e2e/app-data.spec.js` |
|
|
| HTTP cache policy of the delivered Node server | `tests/server-cache.test.mjs`; production E2E remains responsible for stale bundle recovery |
|
|
| Node server resilience: hostile requests, invalid Cards configuration, clean shutdown | `tests/server-robustness.test.mjs` |
|
|
| Sokko TCG ownership, recharge, idempotence, transfers, campaign codes, account deletion and backup/restore | `tests/nebula-cards.test.mjs`, `tests/nebula-cards-api.test.mjs`, then `e2e/nebula-cards.spec.js` against the delivered Node API and a temporary SQLite database |
|
|
| Toolbox sharing by encrypted link: server caps, single use, expiry, browser quotas, encryption, send and receive under the production CSP | `tests/toolbox-shares-api.test.mjs` (real HTTP server, temporary directory), `tests/toolbox-share-crypto.test.mjs`, `tests/toolbox-share-quota.test.mjs`, then `e2e/toolbox-share.spec.js` with isolated recipient contexts and `e2e/production/toolbox-share.spec.js` |
|
|
| Shared reorder policy and module order | `e2e/grouped-reorder.spec.js`, `module-order.spec.js` |
|
|
| Toolbox creation, import/export, text exchange | `e2e/toolbox.spec.js`, `text-exchange.spec.js`; Node toolbox module tests |
|
|
| Links: creation, copy, category removal preserving links, deletion and reload | `e2e/basic-tools.spec.js` |
|
|
| Counters: creation, signed values, reset, deletion and reload | `e2e/basic-tools.spec.js` |
|
|
| Checklist: quantities, clamping, completed item/category visibility and persistence | `e2e/basic-tools.spec.js` |
|
|
| Images: gallery, detail navigation, keyboard controls and focus restoration | `e2e/basic-tools.spec.js` |
|
|
| Guide checklists: persistent association, page controls, drawer scope and live completion | `e2e/guide-checklist.spec.js` |
|
|
| Mémos : bande fixe, portée par route et persistance du toggle | `e2e/memos-ticker.spec.js` |
|
|
| Planner: editing, quantities, partial-progress resets, prerequisites, subtree reorder, drawer and cross-page persistence | `e2e/task-planner.spec.js`; `tests/task-planner-quantities.test.mjs` and v2 import tests |
|
|
| Representative visual states and responsive layouts | `e2e/style-layouts.spec.js`, `tool-style-states.spec.js`, `card-surfaces.spec.js`, `nds-controls.spec.js`, `nds-patterns.spec.js` |
|
|
| Production onboarding | `e2e/production/onboarding.spec.js` |
|
|
| Formula tools under the production CSP | `e2e/production/content-security-policy.spec.js`; `tests/server-cache.test.mjs` forbids string evaluation in client code |
|
|
|
|
These suites cover selected risks, not every permutation of every tool.
|
|
Public formats, product vocabulary, editorial validation, security restrictions
|
|
and deliberate architecture constraints retain static or pure-function tests.
|
|
Implementation-name assertions can be replaced when their owning code changes;
|
|
their mere presence is not a functional defect.
|
|
|
|
## Validation by Change Risk
|
|
|
|
`npm run check` is the baseline for every significant change. It covers syntax,
|
|
lint, generated list indexes, Node tests and the production build. Add the
|
|
targeted checks below while implementing; use `npm run check:full` when the
|
|
change affects persisted data, imports, user interaction or delivery.
|
|
|
|
| Change | Targeted evidence | Completion gate |
|
|
| --- | --- | --- |
|
|
| Documentation only | Verify relative links, paths, commands and the described source of truth. No browser matrix is required when behavior and accessible labels are unchanged. | `npm run check` for a significant grouped update. |
|
|
| Public JSON or game data | Run the relevant data validator and loader tests; regenerate list indexes when lists change. Exercise the affected game route if shape, retry behavior or visible content changes. | `npm run check`, plus targeted E2E for behavior visible in the browser. |
|
|
| IndexedDB, persistence or JSON import/export | Cover canonical compaction, failures, conflicts, deletion, startup recovery and at least one concurrent-page scenario. Imports must prove atomic rejection and reference remapping. | Targeted Node and Playwright suites, then `npm run check:full`. |
|
|
| Interaction or accessible label | Search E2E locators that use the role or accessible name. Verify focus, keyboard and pointer behavior at 768 px and any other width affected by the layout. | Targeted Playwright scenario, then `npm run check:full`. |
|
|
| Sass, component surface or layout | Run the owning NDS/layout suites and inspect the real page at the affected desktop widths. Computed-style checks may prove stable primitives; source-text assertions do not prove rendering. | `npm run check`; add `check:full` when a workflow or interactive control changes. |
|
|
| Server, workflow or deployment | Run workflow contract tests, the direct Node server cache test when headers change, and the full browser gate. Verify the public origin only after an authorized deployment. | `npm run check:full` before delivery; post-deploy SHA and HTTP health checks afterward. |
|
|
|
|
## Validation Layers
|
|
|
|
- `npm run check:cards` est le gate d'itération de Sokko TCG. Il exécute le
|
|
lint ciblé, les tests Node du catalogue, des règles, de l'API, des sauvegardes
|
|
et des données publiques, puis le build et les deux parcours Cards contre le
|
|
serveur Node avec une base SQLite temporaire. Il n'exécute pas les E2E des
|
|
toolboxes et des guides.
|
|
- `npm test` runs Node tests for pure logic, data contracts, architecture guards
|
|
and the direct `server.mjs` cache test. The latter opens a local ephemeral port.
|
|
- `npm run test:e2e` uses Vite in development and therefore includes React
|
|
`StrictMode`; it validates interactive behavior against source modules.
|
|
`npm run check:full` lui réserve le port 4181 pour ne pas réutiliser une
|
|
instance personnelle éventuellement ouverte sur 5173.
|
|
- `npm run test:e2e:production` rebuilds the client and serves it with
|
|
`server.mjs`, Sokko TCG disabled. It catches build-only behavior, stale-bundle
|
|
recovery and anything the Node server's CSP blocks, such as `eval` in a tool.
|
|
It does not exercise headers added by the production proxy.
|
|
- `npm run test:e2e:cards` construit l'application puis lance `server.mjs` avec
|
|
une base SQLite temporaire, la connexion de test et Sokko TCG activé. Il
|
|
valide la reprise d'ouverture, l'album, l'administration et le layout à
|
|
768 px sans utiliser une API simulée.
|
|
- `tests/server-cache.test.mjs` exercises the HTTP policy implemented by
|
|
`server.mjs`. It does not prove headers added or replaced by the public proxy.
|
|
- Public `curl` checks after deployment validate the delivered origin and remain
|
|
separate from local and CI tests.
|
|
|
|
## Optional Extensions
|
|
|
|
Exhaustive advanced tool variants (calendar recurrence operations, goal graph
|
|
combinations, equipment and combo permutations), every text-exchange UI adapter,
|
|
fine calculator geometry and wholesale conversion of remaining implementation
|
|
assertions are outside this closure boundary. They are candidates when related
|
|
features change or a concrete regression demonstrates missing coverage, not
|
|
automatic follow-on batches required to finish this audit.
|
|
|
|
## Completion and Reporting
|
|
|
|
Run the gate required by the matrix after the targeted checks. Review the diff
|
|
and report the behavior changed, commands executed, results, remaining limits
|
|
and Beads task. Keep historical results dated instead of presenting them as a
|
|
current run. Close only the task whose acceptance criteria were actually met.
|
|
Do not introduce visual snapshots solely to prove that a page loads.
|
|
Keep detailed command logs outside tracked source and report concise results.
|
|
Pour les itérations exclusivement limitées à Sokko TCG, `check:cards` suffit ;
|
|
`check:full` reste le gate avant un push.
|