Skip to content

feat(core): add visibility-aware submit flow and dry run preview#29

Open
lattln wants to merge 4 commits intomainfrom
eSheet-output-cleanup
Open

feat(core): add visibility-aware submit flow and dry run preview#29
lattln wants to merge 4 commits intomainfrom
eSheet-output-cleanup

Conversation

@lattln
Copy link
Copy Markdown
Collaborator

@lattln lattln commented Apr 13, 2026

Overview updated 4/14/2026

This PR enforces stricter schema requirements and improves validation, export, and feedback flows across builder, core, renderer, and demo packages.

The primary change is the introduction of a required top-level form id, which is now enforced across schema definition, state management, export, and demo usage. Alongside this, validation handling has been standardized and made reusable, with clearer error formatting and a shared UI for surfacing issues.

The builder and demo flows have been updated to align with these stricter guarantees, ensuring invalid definitions are blocked early and surfaced clearly. Local CI validation has also been verified end-to-end.

What Changed

Schema & State Management

  • Enforced required top-level id in form definition schema (types.ts)
  • Updated schema tests to reflect new requirement
  • Added formId state and setFormId action in form-store.ts
  • Updated hydrateDefinition to return { schemaType, id, fields }
  • Updated store tests to validate new behavior

Export Flow

  • Updated export flow to require form id confirmation before download
  • Introduced modal-driven confirmation/edit step in BuilderHeader.tsx
  • Enhanced FeedbackModal.tsx to support reusable confirm/cancel/custom content patterns

Validation & Error Handling

  • Introduced reusable Zod error formatter (zod-errors.ts)
  • Exported formatter via core index for cross-package usage
  • Renderer validation (useRendererInit.ts) now uses structured, mapped error output

Validation UI

  • Added shared ZodIssuesPanel.tsx component
  • Exported from fields package
  • Integrated into renderer (EsheetRenderer.tsx) for invalid schema display

Builder Validation & Import Flow

  • Code view (CodeView.tsx) now validates definitions using safeParse
  • Displays formatted Zod error messages (first issue surfaced clearly)
  • Import flow blocks invalid/unsupported schemas and surfaces issues in BuilderHeader.tsx

Demo Updates

  • Renderer demo schemas now use build-time glob auto-discovery instead of hardcoded URLs (RendererView.tsx)
  • Builder demo default schema now includes required id (BuilderView.tsx)

Tests & Validation

  • Updated builder tests (EsheetBuilder.spec.tsx)
  • Updated renderer tests (EsheetRenderer.spec.tsx, renderer.spec.ts)
  • Local CI/CD preflight (gh act) now passes end-to-end
  • Fixed demo typecheck issue (missing form id in BuilderView.tsx)

Additional Files

  • Added ci-monitor-subagent.agent.md
  • Added demo schema: patient-intake-broken.json

How to Test

  1. Run all test suites and confirm they pass.

  2. Open the builder and attempt to export a schema without an id.

  3. Verify:

    • export is blocked,
    • a modal prompts for id confirmation or entry.
  4. Provide an id and confirm export proceeds successfully.

  5. Open Code View and input an invalid schema.

  6. Verify:

    • validation runs,
    • a formatted Zod error message is displayed.
  7. Attempt to import an invalid schema.

  8. Verify:

    • import is blocked,
    • validation issues are surfaced in the UI.
  9. Open the renderer with an invalid schema.

  10. Verify:

    • validation errors are displayed using the shared issues panel.
  11. Open the demo renderer view.

  12. Verify:

    • schemas load via auto-discovery,
    • all schemas render correctly.
  13. Run local CI validation:

    gh act push -W ci.yml --pull=false
  14. Confirm the workflow completes successfully.

Breaking Changes

Yes.

  • Form definitions now require a top-level id
  • Any existing schemas without an id must be updated

Notes

  • This change standardizes schema identity across builder, renderer, and export flows
  • Validation is now centralized and reusable across packages
  • Invalid schemas are blocked earlier and surfaced more clearly in both builder and renderer contexts
  • Demo improvements ensure more realistic validation and rendering scenarios for testing and review

lattln added 4 commits April 13, 2026 14:52
…e validation, and demo improvements

* Added preview-only **Dry Run Submit** in builder with validation + payload drawer
* Introduced **visibility-aware validation & hydration** (skips hidden/disabled fields and section descendants)
* Renamed renderer API `getResponse` → `getRawResponse`; reinforced `getValidResponse` as submit path
* Updated demo to use validated submit flow with inline result panel (replacing alerts)
* Replaced synthetic schemas with **real-world examples** (patient intake, PHQ-9, NPS, onboarding, comprehensive)
* Expanded test coverage across builder, core logic, and renderer APIs
* Updated CI instructions to standardize **`gh act` local workflow testing**
* gaps in preview mode per field is reduced by 1rem
* modal for dryRunfeedBack now has both desktop & mobile draw
* demo: RendererView now has proper Names for Labels
* Answer is not omitted from the response when empty.
Require top-level form ids across builder and renderer flows.

- add required id to form definition schema
- persist and manage formId in the form store
- return schemaType, id, and fields from hydrateDefinition
- update export flow to confirm or edit form id before download
- add reusable Zod error formatting and validation issues panel
- align code view and import flows with stricter schema validation
- update demo definitions and renderer schema discovery
- refresh builder, renderer, and schema-related tests

Also fixes the app-demo typecheck issue in BuilderView.tsx found during local CI/CD preflight.
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