Skip to content

test: repair token Save double-click browser contract - #289

Merged
pranems merged 1 commit into
masterfrom
vprane/scimserver/containers-token-save-browser-contract-20261124
Nov 24, 2026
Merged

pranems merged 1 commit into
masterfrom
vprane/scimserver/containers-token-save-browser-contract-20261124

Conversation

@pranems

@pranems pranems commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Summary

Repair the token Save browser contract with one trusted double-click and an exact once-only successful localStorage write assertion.

The three-file change replaces concurrent locator clicks and an ignored exception in web/e2e/token-gate.spec.ts. It observes the actual token storage key, requires the write sequence to equal [TOKEN], verifies the stored token, and requires the app shell to open. Session_starter.md and docs/CONTAINER_RUNTIME_REMOVAL_READINESS.md record bounded evidence and remaining acceptance work.

Production/API/web source, runtime configuration, test pools/isolation/deadlines/thresholds, versions and snapshots are unchanged. This is not a full browser, visual, deployed-dev or overall migration completion claim.

Linked Defect / Plan Reference

  • DELIVERY_PLAN.md defect ID: N/A; bounded browser-test repair, not a new delivery-plan feature.
  • Audit doc reference: docs/CONTAINER_RUNTIME_REMOVAL_READINESS.md, "Token Save browser contract repair, 2026-11-24".
  • ADR (if applicable): N/A; no architecture or production behavior change.

TDD Process

  • RED test written first; observed it fail for the expected reason
  • GREEN: minimal implementation that turns the test green
  • Refactor (if any) keeps the test green
  • Permanent regression guard added (where applicable - see existing patterns in api/src/security/)

Preserved old exact-f8 native Prisma browser evidence is 327 passes, one action-delivery failure and 25 skips. The failure was a second locator action after the peer click dismissed the dialog, not proof of a production pendingRef defect. The duplicate same-value write negative control gives seven passes, one expected assertion failure and no skips. The final whole token-gate file gives eight passes, zero failures and zero skips on each owned native InMemory and Compose Prisma fixture. The permanent exact-write-sequence assertion distinguishes duplicate identical writes from the correct final storage value.

Feature / Bug-Fix Commit Checklist (standing rule)

Every behavioral change must include all that apply. Tick or strike through with N/A + reason.

  • Unit Tests - service-level and controller-level coverage of the new behavior. N/A; no service/controller behavior changes.
  • E2E Tests - end-to-end spec under api/test/e2e/ exercising the feature through HTTP. N/A for new API coverage; only the existing browser contract changes. Normal Validate hook API coverage is reported below.
  • Live Integration Tests - new section in scripts/live-test.ps1 runnable against local + Docker + Azure. N/A; no wire-visible change or new live-test section.
  • Feature Documentation - dedicated doc in docs/ with architecture, RFC references, Mermaid diagrams, test coverage. Existing directly related readiness/RCA documentation updated; no new feature or diagram.
  • INDEX.md Update - add the new doc reference to docs/INDEX.md. N/A; no new document.
  • CHANGELOG.md Update - [Unreleased] entry with full test counts and feature summary. N/A; test-only repair, no product release.
  • Session & Context Updates - Session_starter.md and docs/CONTEXT_INSTRUCTIONS.md. Starter updated; general context unchanged because product/version/runtime are unchanged.
  • Version Management - bump api/package.json (and any other version refs) when behavior changed. N/A; product behavior/version unchanged.
  • Response Contract Tests - API responses contain ONLY documented fields (key allowlist assertion at unit + E2E + live). N/A; no API response changes.

Validation Output

Focused native InMemory: 8 passed, 0 failed, 0 skipped
Focused native Prisma:   8 passed, 0 failed, 0 skipped
Duplicate-write control: 7 passed, 1 expected assertion failure, 0 skipped
Strict targeted compiler: passed, exit 0
Focused doc freshness: passed, exit 0
Focused doc content: passed, exit 0
Normal Validate hook: 32/32 gates passed, exit 0, 2322.7 seconds
API unit: 6274 passed (220 suites)
API InMemory E2E: 2519 passed, 45 skipped (120 passed suites, 4 skipped)
Web Vitest: 1664 passed (126 files)
API lint: 0 errors, 507 warnings
Web TypeScript: 66 existing errors, unchanged ceiling 96

Exact supplied commands and results:

  • npx playwright test e2e/token-gate.spec.ts --workers=1 --reporter=line,json --output=<owned output>: final complete file passes 8/8 on each backend, serially, against owned immutable-image fixtures. Original identities retained: 11 containers, 49 volumes, six networks; owned fixtures closed. No full browser rerun was performed at this delivery boundary.
  • npx tsc --ignoreConfig --noEmit --strict --target ES2022 --module NodeNext --moduleResolution NodeNext --skipLibCheck --types node e2e\token-gate.spec.ts: passed, exit 0.
  • pwsh -NoProfile -File scripts\audit-doc-freshness.ps1 -BaseRef f8c2ce1f2e325affd2e780d0fe5ee0aba330901c -Quiet: passed, exit 0.
  • node scripts\audit-doc-content.mjs: passed, exit 0.
  • PREPUSH_MODE=Validate, VITEST_MAX_WORKERS=1, NODE_DISABLE_COMPILE_CACHE=1, generation-only inert DATABASE_URL, then git push --set-upstream origin refs/heads/vprane/scimserver/containers-token-save-browser-contract-20261124:refs/heads/vprane/scimserver/containers-token-save-browser-contract-20261124: passed, exit 0, all 32 unchanged gates green in 2322.7 seconds. Repository gate settings remain unchanged.

Final hook receipt SHA256: 7B1B4B54E5C270D96973E63209162F0E92E9162EF8D403C8F7067025455402B2.

Normal Validate gate Result Numeric exit
dependencies: ownership negative controls PASS 0
api: tsc build PASS 0
api: eslint PASS 0
web: tsc --noEmit PASS; existing 66 errors below unchanged ceiling 96 0
web: vite production build PASS 0
docker: production source included PASS 0
docs: mermaid gate negative controls PASS 0
supply chain: lockfile regeneration controls PASS 0
docs: mermaid diagrams render PASS 0
infra: base images on LTS PASS 0
infra: deployment doc current PASS 0
docs: user-facing docs current PASS 0
docs: doc claims match source PASS 0
supply chain: lockfile provenance PASS 0
docs: patterns pie matches catalog PASS 0
deploy: revision retention selector PASS 0
deploy: workflow run selector PASS 0
live: exact endpoint fixture ownership PASS 0
runtime: independent engine and standalone contracts PASS 0
deploy: tenant rollover contracts PASS 0
copilot: agent skill contract PASS 0
quality gates: orchestrator contract PASS 0
live evidence: pre-serialization redaction contract PASS 0
test matrix: orchestrator contract PASS 0
deploy: browser evidence contract PASS 0
discovery: OpenText ISV-6 verifier contract PASS 0
docs: RFC corpus current + intact PASS 0
api: unit tests (jest) PASS; 6274 tests, 220 suites 0
api: e2e tests (inmemory, maxWorkers=2) PASS; 2519 passed, 45 skipped 0
api: prisma generate PASS 0
api: migration linter (additive-only) PASS; 0 violations across 30 migrations 0
web: vitest PASS; 1664 tests, 126 files 0

The hook's existing API skips do not change the focused browser claim of 8/8 per backend with zero skips. The existing Jest worker-exit/timer warnings were observed; the hook's unit/E2E numeric exits were zero. Web Vitest's existing JSDOM scroll/navigation warnings were also observed; all tests passed. The normal test pass rewrote one snapshot's line endings; its normalized Git blob matched HEAD exactly before restoring only that owned rewrite. No snapshot content or baseline was regenerated.

Supplied private local final report SHA256: F9871C2459B17FDBEDA1FC47FB99BB23ECE0BD32FEEA07FB969B234BDF401E40. Failed receipts are retained locally, not discarded. Delivery records preserve numeric exits and receipt hashes. Missing owned API dependencies first failed the normal hook (tsc unavailable, exit 1); only then npm ci --no-audit --no-fund restored the API directory. The next normal hook exposed the missing generated Prisma client (build exit 2); npm run prisma:generate passed without connecting to a database. Root/API/web lockfiles remained byte-identical. No local lockfile generation, foreign dependency copying or runtime restart occurred.

Private observer evidence is tracked separately. Full zero-skip native browser acceptance and parent delivery/merge remain separate pending claims.

Standing Rules Acknowledgment

  • No em-dash (Unicode U+2014) anywhere in the diff. Verified via Select-String -Pattern ([char]0x2014).
  • No git commit --amend on history that has been pushed.
  • No new credentials, tokens, or secrets committed to source. Forbidden patterns regression spec at api/src/security/forbidden-source-patterns.spec.ts will catch known anti-patterns.
  • Migrations are additive-only (expand-contract for column changes). Migration linter at api/src/scripts/lint-migrations.ts enforces this. N/A; no migrations changed.

Destructive Migration Override (skip if not applicable)

  • This PR contains a NEW destructive Prisma migration (DROP TABLE/COLUMN, ALTER COLUMN ... TYPE, RENAME, INSERT ... SELECT FROM). N/A; no migration changes.
  • I have set ALLOW_DESTRUCTIVE_MIGRATION=1 in the CI environment for this PR. N/A; no destructive migration or override.
  • Justification (required if box above is ticked): N/A; no destructive migration.
    <!-- Why this destructive change is necessary, what the rollback path is, and which release window it ships in -->
    

Reviewer Hint

Diff areas worth special attention from the reviewer:

  • web/e2e/token-gate.spec.ts, the double-click Save test: one trusted dblclick, only successful writes to the real localStorage key are observed, exact sequence assertion plus final stored value and app-shell outcome.
  • Parent directly reviewed the exact three-file source diff. An owner COMMENTED self-review will be recorded against the exact PR head; this is not independent approval. Independent approval is not configured. No additional quota-denied Copilot review or forbidden preview-event route will be retried.
  • Self-improvement: applied the permanent duplicate-identical-write negative control and outcome assertion. Delivery-owner inspection excludes its own ancestor processes to avoid misclassifying its command text as another hook; no competing hook was started.
  • Design/architecture disposition: accepted; cohesive test observation, no production dependency edge, orchestrator growth or speculative abstraction.
  • Remaining: exact-tip CI and parent-controlled eligible merge; full zero-skip native browser acceptance, private observer evidence, full deployment validation, operator visual verification and overall migration completion are not claimed here.

Use one trusted Playwright double-click gesture and assert exactly one successful token persistence write, the exact stored token, and app-shell visibility. Preserve production behavior. Final focused browser file passes all 8 tests on each owned immutable-image native backend; duplicate-write negative control fails as intended. Update session context and bounded execution RCA.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@pranems pranems left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Owner COMMENTED self-review of exact head 28f56ef. Parent directly reviewed this exact three-file source diff. One trusted dblclick replaces concurrent click actions and an ignored catch; successful localStorage writes must equal [TOKEN], the final stored token must equal TOKEN, and the app shell must be visible. Production, API/web source, configuration, thresholds, versions and snapshot content are unchanged. Focused whole token-gate file: 8 passed, 0 failed, 0 skipped per owned native backend. Duplicate-identical-write negative control: 7 passed, 1 expected assertion failure, 0 skipped. Normal Validate push: 32/32 gates passed, numeric exit 0; exact remote/upstream/head match. This is owner self-review plus parent source review, not independent approval. No quota/event-subscription retry, bypass, merge or deployment. Remaining exact-tip CI and eligible merge belong to parent; full zero-skip native browser acceptance and migration completion are not claimed. Design disposition accepted: cohesive test-only change. Self-improvement applied: permanent outcome assertion catches duplicate same-value writes.

@pranems
pranems merged commit 82e5f9a into master Nov 24, 2026
6 checks passed
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