feat(spec): defineX factories + XInput aliases for the 16 remaining writable domains (#2035)#2088
Merged
Merged
Conversation
…ritable domains (#2035) Adds one type-safe authoring entry per writable domain — defineDatasource, defineConnector, definePolicy, defineSharingRule, defineRole, definePermissionSet, defineEmailTemplateDefinition, defineReport, defineWebhook, defineObjectExtension, defineCube, defineMapping, defineTheme, defineTranslationBundle, definePage, defineAction — mirroring the 19 existing factories (XSchema.parse(z.input)). Each factory is a *value* export: a broken import hard-errors instead of silently degrading to `any` (the #2023 failure mode), and authoring errors surface at .parse() time with field-level messages. Also backfills the six missing input aliases: PolicyInput, CubeInput, MappingInput, ThemeInput, TranslationBundleInput, PageInput. Purely additive — no existing exports change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Migrates every example authoring file across crm/showcase/todo from bare output-type literals (`: Page`, `: UI.ActionInput`, …) to the corresponding defineX factory. The factory accepts input-shape config and validates each definition at module load, so a malformed metadata object now fails loudly at authoring time instead of silently passing as `any` (#2023). Covers 36 files / 16 domains — including files the *.{domain}.ts filename scan missed (reports/index.ts, actions/index.ts, security/sales-roles.ts, …), which the new lint guard surfaced. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds an AST-only no-restricted-syntax rule that flags exported consts in examples/** annotated with a spec domain type (simple `Page` or qualified `UI.Page`) instead of being wrapped in the defineX factory. Turns the authoring convention into an invariant so the "pick by history" pattern cannot creep back into the reference corpus AI learns from — it already caught 15 unmigrated authoring files in this change. No type info required. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 89 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This was referenced Jun 21, 2026
Merged
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 21, 2026
…2097) The #2088 guard only covered examples/**. Broadens it to the platform's own apps (account/setup/studio) so the "author metadata via defineX, never a bare `: DomainType` literal" convention holds across every authoring surface, not just the example corpus. Explicitly excludes packages/downstream-contract, whose bare literals are an intentional frozen backward-compat fixture (#2089). No migrations — apps author no bare-literal metadata today; this is future- proofing. Verified the guard fires on a probe under packages/apps and that `pnpm lint` is green. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 21, 2026
…ates (#2035) (#2098) Documents the layered strategy built across #2088/#2089/#2092/#2093/#2095/#2097 in one authoritative place: why in-repo consumers can't witness backward compat (they co-evolve with the spec), the six gates and each one's job, and — crucially — the FREEZE CONTRACT: a change that requires editing the fixtures or removing a snapshot entry is by definition breaking (bump major), never a mechanical test-update. Also formalizes `objectstack validate` as the third party's authoritative self-gate. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 21, 2026
…erals (#2035) (#2124) The example apps were migrated to the `defineX` factories in #2088/#2095 and a lint guard keeps them clean — but the skills and hand-written docs still taught the old bare-literal pattern (`: Page = {}`, `: Action = {}`, `: PermissionSet = {}`, …). Skills are the corpus AI authors from, so this directly undercut the #2035 north star: leaving the unsafe pattern as the thing AI copies. Converts every bare output/Input-type metadata literal for the 16 factory domains to its `defineX(...)` factory call, across: - skills/objectstack-ui/SKILL.md (8: Page/Action/Report/Cube) - content/docs/guides/security.mdx (8: PermissionSet/SharingRule) - content/docs/{guides/standards,concepts/index,concepts/architecture, getting-started/architecture,protocol/objectui/record-alert}.* (7) Imports are rewritten in place (preserving each block's import source — root vs subpath) or injected where the snippet had none. Pre-existing `defineView` / `defineFlow` examples are untouched. `check:skill-docs` stays green (generated references come from frontmatter, unchanged). Docs-only — no package code, no changeset. Code blocks in MDX/skills are not type-checked by any gate, which is why they drifted; a lightweight MDX code-block lint is noted as a separate follow-up. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
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.
Closes #2035.
What
Gives every writable domain one type-safe authoring entry, closing the third (bare-literal) idiom that #2023 tripped over.
PR 1 — spec (
feat(spec)): 16 newdefineXfactories + the 6 missingXInputaliases.defineDatasource·defineConnector·definePolicy·defineSharingRule·defineRole·definePermissionSet·defineEmailTemplateDefinition·defineReport·defineWebhook·defineObjectExtension·defineCube·defineMapping·defineTheme·defineTranslationBundle·definePage·defineActionPolicyInput·CubeInput·MappingInput·ThemeInput·TranslationBundleInput·PageInputEach is the canonical 3-line shape
XSchema.parse(z.input<typeof XSchema>), mechanically identical to the 19 existing factories, re-exported from rootindex.ts(and already flowing through each subpath barrel viaexport *). Purely additive.PR 2 — examples (
refactor(examples)): migrated 36 authoring files across crm/showcase/todo from bare output-type literals (: Page,: UI.ActionInput, …) to the factory. Now every metadata object is.parse()-validated at module load.PR 3 — lint guard (
feat(lint)): an AST-onlyno-restricted-syntaxrule that bans bare: DomainTypeexported-const literals inexamples/**, turning the convention into an invariant. It earned its keep immediately — it surfaced 15 authoring files the*.{domain}.tsfilename scan missed (reports/index.ts,actions/index.ts,security/sales-roles.ts, the connector/mapping/email/extension/policy/webhook files, …), all of which are migrated here.Why
defineXis a value import — a broken import hard-errors instead of degrading toany..parse()time instead of a structural TS wall.Verification (local, worktree)
pnpm --filter './examples/*' typecheck→ green (all 3 apps)pnpm lint→ green@objectstack/spectests → 6599 passed@objectstack/spectsc --noEmit→ cleanChangeset:
@objectstack/specminor.🤖 Generated with Claude Code