Skip to content

Generate executable schema contracts - #38

Merged
crimson-knight merged 3 commits into
mainfrom
agent/v2-executable-schema-generators
Aug 13, 2026
Merged

Generate executable schema contracts#38
crimson-knight merged 3 commits into
mainfrom
agent/v2-executable-schema-generators

Conversation

@crimson-knight

Copy link
Copy Markdown
Member

Outcome

Fresh Amber V2 projects now use the automatically enforced schema contract as
their primary controller path instead of manually constructing a second schema
object.

Depends on amberframework/amber#1408.

What changed

  • amber generate schema teaches schema :action, SchemaClass plus
    validated_as(SchemaClass) while retaining direct construction only in the
    isolated schema unit spec.
  • HTML scaffolds declare application/x-www-form-urlencoded, bind create and
    update automatically, and override the framework failure hook to return an
    ECR form with field errors.
  • Preview API resources declare JSON and use the same automatic action binding;
    invalid requests retain the framework's structured JSON failure.
  • The generated-app smoke harness can name an exact fork repository and commit
    so a dependent framework candidate is tested without pretending it has
    already merged upstream.
  • The release smoke now proves that missing species returns HTML 422 before
    proving create, persisted read, PATCH update, assets, and the compiled app.

Compatibility

This does not remove or change Amber's deprecated params.validation API.
Existing applications can upgrade first and migrate action by action. The
framework change keeps that legacy path functional, with removal planned no
earlier than a later V2 minor such as 2.5 and the exact release announced
separately.

Validation

  • crystal spec: 412 examples, 0 failures
  • scripts/check_beta_contract.sh: passed
  • complete generated Pet Tracker against framework commit
    eba20af31b2eb41ca6a7409ccd52792290c75a7b: passed
    • dependency installation
    • asset build/check
    • generated specs and formatting
    • development and test migrations
    • application compilation and boot
    • HTML 422 field error for invalid form input
    • persisted create and PATCH update
    • fingerprint, integrity, MIME, immutable-cache, and gzip checks

@crimson-knight

Copy link
Copy Markdown
Member Author

CI follow-up is complete at bfe786a.

The failing PR jobs were compiling schema-aware generators against released Amber 2.0.0-beta.4, which does not contain validated_as. Pull-request builds now pin the exact coordinated framework candidate from amberframework/amber#1408 (crimson-knight/amber@eba20af31b2eb41ca6a7409ccd52792290c75a7b) on macOS, Linux x86-64, Linux ARM64, and Windows. Main/manual/release paths still test the published framework emitted by the template.

All replacement checks are green, including both packaged builds, Linux ARM64, Windows x86-64, integration/platform tests, and docs. Local verification also passed: 412 CLI examples and the complete generated Pet Tracker smoke, including HTML 422 schema failures, persistence, PATCH update, and asset delivery.

@crimson-knight
crimson-knight marked this pull request as ready for review August 13, 2026 17:14
@crimson-knight
crimson-knight merged commit 1cba58b into main Aug 13, 2026
11 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