Skip to content

test(scripts): audit wave A — endpoint-script coverage for every v1.5/v1.6 endpoint + roles-400 contract fix - #328

Merged
voidvec merged 2 commits into
masterfrom
test/audit-wave-a-endpoint-coverage
Nov 12, 2026
Merged

voidvec merged 2 commits into
masterfrom
test/audit-wave-a-endpoint-coverage

Conversation

@voidvec

@voidvec voidvec commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Summary

Executes Wave A of the 2026-11 P0/P1 retro-audit fix plan: the roadmap §7-3 DoD ("endpoint script suites grow with every release") had been violated for two consecutive releases — both suites stopped growing before v1.5.0, leaving nine new endpoints with zero black-box script coverage. This PR closes that gap and collects what the new cases found.

  • Endpoint scripts (sh + ps1, both suites; the bat dialect is intentionally untouched — it has been stale since Test 44 and is documented as exempt):
    • admin +6: audit CSV export (window guard 400 / text/csv / the audit_exported self-audit row), claim-mapping CRUD red lines (reserved claim 400, openid-trigger 400, create→list→PUT enabled→DELETE), custom-attributes round trip + __proto__ rejection, role-permission full-replace (grant users:read → read-back → unknown-name fails the whole replace), email-template list + <script> content-policy 400, org lifecycle (create, invalid-color 400, PATCH, members, soft-delete → 404, tombstone re-registration 409)
    • oauth2 +3: authorize-context (resolved name / unknown 404 / missing-param 400), WebAuthn credential-delete guards (401 without token; the SAME generic 404 for unknown ids — no ownership oracle), end_session dedicated post_logout_redirect_uris authority (drives RFC 7591 registration + admin scope grant first, then asserts logout-registered URI → 302 and login-only URI → 400)
    • TOTAL counters realigned to reality (admin 52→61 actual, oauth2 58→62 actual)
  • Contract fix found by the new unknown-name case: PUT /api/admin/roles/{roleId}/permissions answered 500 DB_QUERY_ERROR for unknown permission names — openapi documents 400 and the P1-8 design says "unknown names fail the whole replace". The branch now responds VALIDATION_INVALID_INPUT; the transaction is pristine at that point (no writes) and rolls back on scope exit. Genuine DB/rollback failures keep the 500 classification.
  • MFA backup-code HTTP tier: Integration_P0_MfaBackupCode_LoginFallback_EndToEnd pins what unit tests could not — the login fall-through at the HTTP layer, one-shot CAS replay rejection, both historical hash-case storage forms, the mfa_backup_code_used audit row, and mfa_rebind_required on the last code. restoreAdminMfa also clears mfa_backup_codes.
  • Docs: testing-guide gains the Level 6 RP-interop-smoke section (four drivers, interop.yml triggers, local-run pointer) in EN + zh mirror; CHANGELOG [1.5.0] date aligned to the tag (2026-10-16); [Unreleased] entries for the fix and this batch.

Two further observations the new cases surfaced are filed as #327 (delete of a client with issued token rows answers 500; DCR registration grants no scopes).

Addresses #327

Verification (live dev stack, run-endpoint-tests.ps1 wrapper)

Gate Result
Admin endpoint suite (61 cases incl. the 6 new) 61/61 green (after the roles-400 fix + two assertion corrections)
OAuth2 endpoint suite (62 cases incl. the 3 new) 61/62 — the single failure is the pre-existing Test 2 /health/ready 503 (local stack has no Redis; unrelated to this PR)
bash -n both sh scripts / PS Parser both ps1 scripts clean
naming_validator.sh tests / drogon_macro_bool_check.py PASS
zh-mirror consistency (51/51) / check-doc-links (357) green
llms regen zero drift
MSVC Release build (fulla-server + fulla-tests) green

Notes for reviewers: the sh dialect mirrors the ps1 cases 1:1 (the sh leg runs in CI/on Linux); PS 5.1 quirks are handled (-UseBasicParsing, curl.exe for the 302 Location capture). The new MFA test compiles and links; its suite-level run is blocked locally by a pre-existing startup crash that reproduces identically without this PR's changes (verified by stash-control) — CI is the authoritative runner for it.

Out of scope

…/v1.6 endpoint + roles-400 contract fix

Closes the roadmap §7-3 DoD gap from the 2026-11 P0/P1 retro audit: both
endpoint-script suites stopped growing before v1.5.0, leaving nine new
endpoints with zero black-box script coverage.

- test-admin-endpoints.{sh,ps1} +6 (audit CSV export incl. the
  audit_exported self-audit row; claim-mapping CRUD red lines; custom
  attributes round trip + __proto__ rejection; role-permission
  full-replace; email-template list + content policy; org lifecycle with
  tombstone 409). 46->52 cases, TOTAL realigned (55->61).
- test-oauth2-endpoints.{sh,ps1} +3 (authorize-context name/404/400;
  WebAuthn credential-delete guards; end_session dedicated
  post_logout_redirect_uris authority, driving RFC 7591 registration +
  admin scope grant first). 44->47 cases, TOTAL realigned (59->62).
  bat dialect intentionally untouched (already stale since Test 44).
- fix(rbac): PUT /api/admin/roles/{roleId}/permissions answered 500
  DB_QUERY_ERROR for unknown permission names — the documented contract
  (openapi: 400) and the P1-8 design ("unknown names fail the whole
  replace") both require a validation response; the branch now answers
  VALIDATION_INVALID_INPUT with the pristine transaction rolling back.
  Found by the new unknown-name script case. Verified against a live
  stack: admin suite 61/61 green.
- test(mfa): Integration_P0_MfaBackupCode_LoginFallback_EndToEnd pins
  the HTTP tier of the P0-3 backup-code path — both hash-case storage
  forms, one-shot CAS replay rejection, the mfa_backup_code_used audit
  row, and the mfa_rebind_required flag on the last code;
  restoreAdminMfa also clears mfa_backup_codes now.
- docs: testing-guide gains the Level 6 RP interop smoke section
  (four drivers, interop.yml triggers, local run) in EN + zh mirror;
  CHANGELOG [1.5.0] date aligned to the tag (2026-10-16) and [Unreleased]
  entries added for the fix and this coverage batch.

Addresses #327 (the two further observations the new cases surfaced)
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-11T08:25:46.590593Z
We couldn’t complete this review. Comment @codex review to try again.
864c5ea PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…the relative link breaks the Docusaurus site build

The local check-doc-links gate resolves ../../tests/interop/README.md
against the repository filesystem and passes, but the website build
mirrors docs/ into the Docusaurus tree where the same link resolves to
/tests/interop/README.md — a site-internal path that does not exist
(build job failure on #328). Point at the repository path as plain text
(same treatment as the zh mirror) and regenerate llms.
@voidvec
voidvec force-pushed the test/audit-wave-a-endpoint-coverage branch from ad4df05 to 330ac50 Compare November 12, 2026 02:24
@voidvec
voidvec merged commit 16992b7 into master Nov 12, 2026
26 of 28 checks passed
@voidvec
voidvec deleted the test/audit-wave-a-endpoint-coverage branch November 13, 2026 03:02
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.

2 participants