Skip to content

feat(e2e): nine custom editors + grand tour — a complete signed-off NIS2 implementation - #39

Open
simonorzel26 wants to merge 3 commits into
mainfrom
feat/e2e-editors
Open

feat(e2e): nine custom editors + grand tour — a complete signed-off NIS2 implementation#39
simonorzel26 wants to merge 3 commits into
mainfrom
feat/e2e-editors

Conversation

@simonorzel26

@simonorzel26 simonorzel26 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What

The nine bespoke editors (the largest remaining coverage block) driven end to end: the five PolicyEditorShell editors, the risk methodology, both risk registers, and the treatment/acceptance view. Every spec waits on the real mutation, asserts the JSONB config or risk rows in Postgres, and re-renders after reload.

Highlights:

  • Shared-shell leverage: three testids on PolicyEditorShell cover the edit/save cycle of five editors.
  • Risk story in one chain: 2.1 sets the methodology (threshold 6) → 2.3 creates a score-16 risk on a seeded asset through the matrix picker → 2.4 adds a treatment, sets residual 1, and accepts it (§38 risk-acceptance flow) → 5.3 does the supplier-side register.
  • ~25 data-testid hooks across 11 components, selected from a 4-agent mapping pass that identified the silent-failure selectors (twin selects, locale-dependent table rows).

Coverage after this PR (bun e2e/coverage-report.ts)

42/49 requirements primary-surface tested (was 34). Completely untouched: 1.2 (team page), 5.2 (supplier contract fields) — both belong to the upcoming invite-flow specs — and 9.2 (per-asset crypto enrichment). Partials: 1.1/8.2/8.3 (training-record surfaces, pending the course spec) and 5.1 (supplier register).

Verified

  • Full suite: 76 passed + 1 documented skip (1.4m), hermetic DB per run
  • bun test e2e/l0: 110 pass; typecheck clean
  • One iteration to green: a wrong assertion key (model vs accessModel) — the save itself worked first try on all nine editors

Awaiting review — not merging without an explicit go.

🤖 Generated with Claude Code

https://claude.ai/code/session_01De1NY1HDUJkkwetVKTbYtH

The last big coverage block: every bespoke editor driven through its real
UI with persistence asserted in Postgres and re-rendered after reload.

- Five PolicyEditorShell editors (patch 6.4, crypto 9.1, access control
  10.1, procurement 6.1, secure dev 6.2): edit, change distinctive values
  (SLA hours, key rotation, access model + review frequencies, threshold
  + clause toggle, SDLC/hardening selects + segregation), save via the
  shared shell, assert the JSONB config keys.
- Risk methodology 2.1: name + acceptance threshold into
  company_risk_methodology.
- Asset and supplier risk registers 2.3/5.3: inline risk creation with
  the matrix picker (score 16), chained create+link mutations, join-table
  asserts against seeded assets/suppliers.
- Risk treatment 2.4: add measure, set residual via matrix, accept risk;
  asserts accepted_at, residual score and the treatment row.

Product hooks: ~25 data-testid attributes across 11 components, chosen
from a 4-agent mapping pass that flagged exactly which selectors were
silent-failure risks (twin selects, locale-dependent row labels, shared
shell buttons covering five editors with three testids).

Suite: 76 passed + 1 documented skip; 110 L0; typecheck clean. Coverage:
45/49 requirements primary-surface tested; untouched list is now only
1.2 (team) and 5.2 (supplier contract), both awaiting the invite-flow
specs.
…implementation

The capstone the suite was built toward: after l1 fills every intake
form, l2 populates modules, editors and evidence, and l3 proves the
sign-off mechanics, the grand tour walks all 49 requirement pages in
journey order and signs off everything still open through the real
button (41 signed, 8 already done in this run). Two authoritative
proofs close the run: zero NIS2 status rows outside
completed/approved/not_applicable in Postgres, and the product's own
sidebar rendering 49/49.

Shared journey helpers (slug map, makeSignable, signOffViaUi) extracted
to e2e/lib/journey.ts; the l3 spec now imports them.

Full suite: 77 passed + 1 documented skip in 2.3m, hermetic DB.
@simonorzel26 simonorzel26 changed the title feat(e2e): all nine custom editors — SQL-verified config round-trips feat(e2e): nine custom editors + grand tour — a complete signed-off NIS2 implementation Jul 28, 2026
@simonorzel26

Copy link
Copy Markdown
Contributor Author

Second commit adds the grand tour capstone: after the earlier layers populate intake, modules, editors and evidence, the tour walks all 49 requirement pages in journey order, signs off everything still open through the real UI (41 signed / 8 already done this run), and closes with two proofs — zero open NIS2 status rows in Postgres and the sidebar rendering 49/49. With this, the suite drives one company through a complete, fully signed-off NIS2 implementation end to end. 77 passed + 1 documented skip, 2.3m, green on first run.

…bility

From the code-review + coverage-audit pass:

- form-driver: option matching no longer false-greens. Exact match wins,
  else a single non-empty prefix match; empty/icon labels ("") and
  substring collisions ("3levels" in "13levels") are rejected, ambiguity
  throws. verifyFields tightened the same way.
- coverage-report: EDITORS_TESTED is derived from UI_CUSTOM_EDITORS
  instead of a third hand-copy of the nine codes; the report no longer
  sorts the shared nis2Categories array in place ([...nis2Categories]).
  Comment clarifies "editor tested" = page driven, not every sub-table.
- signoff carry-over query: joins src through the framework so code 3.1
  matches the NIS2 requirement, not any same-coded ISO row (was missing
  the filter its sibling statusRow query has).
- start-server.sh guard: parses host + db name and checks them exactly,
  so a glob like localhost* can no longer accept localhost.evil/x_e2e on
  the only guard for the destructive migrate+seed path.
- e2e app port 3026 -> 3410: no longer collides with the dev server's
  port, closing the "run e2e while a dev server is up -> writes could land
  in the dev DB" footgun.
- walker EXTRA_MODULE_BACKED: dropped 2.3/5.3 (shadowed dead code, custom-
  editor branch wins), keeping only the live 9.2.
- grand tour: page-ready via networkidle then a deterministic sign-off-
  button check, replacing the fixed 5s wait that both wasted time on
  already-done pages and could misclassify a slow signable page.

Full suite 77 passed + 1 skip (rebuilt on 3410); grand tour reaches 49/49;
L0 110 pass; typecheck clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant