Skip to content

fix(v3): restore test gate + fix document-model regressions (prod readiness)#894

Open
lane711 wants to merge 2 commits into
v3from
lane711/v3-qa-prod-readiness
Open

fix(v3): restore test gate + fix document-model regressions (prod readiness)#894
lane711 wants to merge 2 commits into
v3from
lane711/v3-qa-prod-readiness

Conversation

@lane711

@lane711 lane711 commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Description

QA production-readiness pass on the v3 document model: re-enable the disabled test suite and fix the runtime regressions it was hiding across the content, media, auth, and settings paths. Unit/real-DB suite goes from 51 failed/disabled to 1530 passed / 0 failed, and six genuine production bugs (all live-verified on a seeded server) are fixed.

Fixes #

Changes

Test gate

  • Un-stub packages/core test scripts (real vitest); CI re-enables type-check and triggers on v3.
  • Repair the real-DB harness (d1-sqlite applyScalarSchema) and migrate tests to the code-only collection registry / current APIs.

Runtime bugs fixed (live-verified)

  • test-cleanup: stop querying the dropped collections table, guard legacy tables, fail-closed environment gate (was 500 → 200).
  • /api/documents: register before the /api/:collection wildcard that shadowed it (was 404).
  • /api OpenAPI: report the real package version (was hardcoded 0.1.0).
  • Admin content: stop leaking internal/auth document types into the content-model filter dropdown and the new-content collection selector.
  • Media: flip api-media + admin-media to the document model (media_asset) so greenfield upload/library/delete no longer 500; seed the missing media_asset document type (was an FK failure).
  • Auth: isRegistrationEnabled reads the plugin document instead of the dropped plugins table, so "disable registration" is actually enforced (was a silent no-op).

E2E

  • Fix loginAsAdmin (Better Auth Origin) and the createTestContent helper hang (collections are code-only); refresh stale specs (03 dashboard, 05 content, 23 content-api-crud auth, 68 profile).

Testing

Unit Tests

  • Added/updated unit tests
  • All unit tests passing — 1530 passed / 0 failed / 267 skipped (npm test), type-check clean.

E2E Tests

  • Added/updated E2E tests
  • Core admin specs passing vs seeded server (01-health, 03-dashboard, 05-content, 23-content-api-crud, 37-disable-registration, 68-profile). Remaining red specs are catalogued stale-UI/plugin drift, out of this core-only pass.

Screenshots/Videos

n/a — backend + test changes.

Checklist

  • Code follows project conventions
  • Tests added/updated and passing
  • Type checking passes
  • No console errors or warnings
  • Documentation updated (if needed)

Generated with Claude Code in Conductor

lane711 and others added 2 commits June 13, 2026 21:47
…readiness

Re-enable the disabled test suite and fix the bugs it was hiding across the
content, media, auth, and settings paths of the v3 document model.

Test gate:
- Un-stub packages/core test scripts (real vitest); CI re-enables type-check + triggers on v3
- Fix the real-DB harness (d1-sqlite applyScalarSchema) and migrate tests to the code-only
  collection registry / current APIs -> 1530 unit tests green, 0 failed

Runtime bugs fixed (all live-verified):
- test-cleanup: stop querying the dropped `collections` table; guard legacy tables;
  fail-closed environment gate
- /api/documents: register before the /api/:collection wildcard that shadowed it (was 404)
- /api OpenAPI: report the real package version (was hardcoded 0.1.0)
- admin content: stop leaking internal/auth document types into the content-model filter
  dropdown and the new-content collection selector
- media: flip api-media + admin-media to the document model (media_asset) so greenfield media
  upload/library/delete no longer 500; seed the media_asset document type (was missing -> FK fail)
- auth: isRegistrationEnabled reads the plugin document instead of the dropped `plugins` table,
  so "disable registration" is actually enforced (was a silent no-op)

E2E:
- Fix loginAsAdmin (Better Auth Origin) and the createTestContent helper hang (collections
  are code-only); refresh stale specs (03 dashboard -> content/analytics, 05 content,
  23 content-api-crud auth, 68 profile)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Core fixes:
- auth.ts: delegate POST /auth/login to Better Auth sign-in/email
- admin-users.ts: redirect /admin → /admin/dashboard (was /admin/content)
- app.ts: mount adminDashboardRoutes; move registerPluginRoutes(testimonials)
  before app.route('/api') so /:collection catch-all doesn't shadow it
- csrf.ts: exempt /test-seed-defaults from CSRF check
- test-cleanup.ts: add POST /test-seed-defaults for E2E global-setup

New:
- page-blocks.collection.ts: code-only collection for TDZ/blocks E2E tests
- my-sonicjs-app/src/index.ts: register pageBlocksCollection

E2E fixes:
- global-setup.ts: call /test-seed-defaults after cleanup to restore welcome post
- 05-content: use form#content-form (strict mode fix — 3 forms on page)
- 27-settings-general: button text is "Save Changes" not "Save All Changes"
- 39-slug-generation: set lexical hidden input via page.evaluate() (not textarea)
- 41-reference-fields: skip (field editor removed for code-only collections)
- 42-dynamic-field-tdz: fix seoTitleInput selector (skip hidden type="hidden");
  use toHaveCount for hidden inputs; text block now has heading+body fields
- 65-default-blog-post-seed: handled by test-seed-defaults
- 66-auth-better-auth: fix seed-admin assertion (body.users not body.user)
- 71-home-link-redirect: update URL expectation + skip catalyst nav tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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