Repository navigation
feat: typed custom fields contract and checker (RFC-0041 step 1) - #94
Merged
Merged
Conversation
…C-0041 step 1) - site.schema.json: optional CollectionSettings.fields (1–30), the FieldDefinition union of nine types with discriminator `type` (ADR-0043), labels, options and the migration marker; 2 valid and 28 invalid fixtures; TS and Rust regenerated. - @cloudhal/core-ts/fields (Worker-safe, eval-free): definition checks and caps, compiling to ADR-0030's props subset for validateProps, per-type value checks, the requiredToPublish check, a JSON Schema for agents within OpenAI and Anthropic strict modes, and resolveFields for localization. Nothing reads the module yet: no behaviour change. 82 new tests; cargo test and clippy pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
This was referenced Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1 of RFC-0041's rollout (ADR-0043). No behaviour change: nothing reads the new module yet.
Contract
site.schema.jsongains an optionalCollectionSettings.fields(1–30 items).FieldDefinitionis aoneOfof nine variants with discriminatortype: text, richText, number, boolean, date, datetime, url, image, select. Labels, options and the migration marker are new$defs.content-entry.schema.jsonchanges only thefieldsdescription.#[serde(tag = "type", deny_unknown_fields)] enum FieldDefinition.@cloudhal/core-ts/fields(Worker-safe, eval-free, rule 6)checkFieldDefinitionsandfieldDefinitionChanges: reserved keys, uniqueness, caps (30 per collection, 200 per site, 256 KB forcollections), and the §6 guard (field_change_needs_operation).fieldsPropsSchemapluscheckFieldValues: compiled to ADR-0030's props subset forvalidateProps, with per-type checks (date, datetime{at, timeZone}, URL schemes, asset id, select), changed-only checking, refusal of unknown keys, and the 256 KB cap.checkRequiredToPublish: for review and publish.fieldsJsonSchema: limited to what OpenAI and Anthropic strict modes accept, with a golden file.resolveFields: localized values fall back to the original's (fromOriginal); non-localized values come from the original.Decisions where the RFC was ambiguous
validatePropscaps strings at 10,000 characters, so the 50,000 limit for richText is checked in code.fieldDefinitionChangesreports for step 2.Checks
cargo testandclippypass.Changeset:
minor, like RFC-0040 step 1, so this moves the fixed group to 0.5.0.🤖 Generated with Claude Code