feat(studio): spec-driven package create/edit/view form in a modal - #2535
Merged
Conversation
Package create/edit/view were three hand-rolled forms (CreatePackageDialog, EditPackageDialog, BuilderLanding's inline form) with two different id-validation regexes — a package created on one surface was rejected by another, and neither matched what the server accepts. Replace them with ONE modal (PackageFormDialog) that renders the manifest form from the spec (ManifestSchema → z.toJSONSchema → SchemaForm), mirroring the existing page-schema / view-schema pattern. - package-schema.ts: spec-derived JSONSchema + a curated FormView (Basics + collapsible Advanced). id/type/namespace/scope are `immutable` — editable on create, locked on edit (the REST PATCH only persists name/description/version). - PackageFormDialog: create → POST, edit → PATCH, view → readOnly. Duplicate 409 maps to a friendly "already exists" message. Create sends NO scope, so a runtime-created base stays writable (not 只读). - CreatePackageDialog / EditPackageDialog kept as thin wrappers so call sites (ResourceListPage, the Studio switcher) don't change; BuilderLanding's inline form now opens the dialog; PackageDetailSheet gains a "View info" (readOnly spec form) action. Net −254 lines (three forms collapse into one spec-driven component). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…pec-form # Conflicts: # packages/app-shell/src/views/metadata-admin/PackagesPage.tsx # packages/app-shell/src/views/studio-design/BuilderLanding.tsx
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
The merge with main brought in CreatePackageDialog.namespace.test.tsx (framework#2694), which targeted the old hand-rolled form's test ids and broke now that CreatePackageDialog renders the spec form. PackageFormDialog already auto-derives namespace from the id and gates submit on NAMESPACE_RE; this adds keystroke sanitization (lowercase + allowed alphabet) to match the old field, and rewrites the test to target the spec form by label. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
added a commit
that referenced
this pull request
Jul 15, 2026
…on (#2540) After #2535 replaced the three hand-rolled package forms with the spec-driven PackageFormDialog, several helpers and i18n keys are no longer referenced: - packages-io.createBasePackage (the old landing/switcher create path); - PackageIdInput's PackageIdSuggestionHint (name→id suggestion for the old landing create form) + its test block; - 10 now-unused i18n keys (× en/zh): the old create-form id/namespace validation messages and name/id/namespace placeholders. PackageIdInput itself stays — the landing "duplicate package" form still uses it (and its idStripped/idFormat hints). No behaviour change; type-check + the affected tests pass. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.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.
Why
Package create / edit / view were three hand-rolled forms —
CreatePackageDialog,EditPackageDialog, andBuilderLanding's inline form — with two different id-validation regexes. A package created on one surface was rejected by another (myappallowed in the dialog, rejected by the landing form), and neither matched what the server accepts. Surfaced during a Studio package-create dogfood.What
One modal,
PackageFormDialog(create | edit | view), rendering the package manifest form from the spec —ManifestSchema(@objectstack/spec/kernel) →z.toJSONSchema→SchemaForm— mirroring the existingpage-schema.ts/view-schema.tspattern. No framework change needed for the form.package-schema.ts— spec-derived JSONSchema + a curated FormView (Basics: name/id/version/type/description; collapsible Advanced: namespace/defaultDatasource/scope/dependencies).id/type/namespace/scopeareimmutable→ editable on create, locked on edit (the RESTPATCH /packages/:idonly persists name/description/version).PackageFormDialog— create → POST, edit → PATCH, view →readOnly. A duplicate-id 409 maps to a friendly "already exists" message. Create sends noscope, so a runtime-created base stays writable (not 只读).CreatePackageDialog/EditPackageDialogkept as thin wrappers so existing call sites (ResourceListPage, the Studio package switcher) are untouched;BuilderLanding's inline form now opens the dialog;PackageDetailSheetgains a "View info" (readOnly spec form) action.Net −254 lines — three forms collapse into one spec-driven component.
Verified (browser, live app-showcase backend)
scope:'project'default that made new packages read-only).readOnly.Tests
PackageFormDialog.test.tsx— create POST contract + 409 → "already exists".EditPackageDialog.test.tsxrewritten — PATCH sends only name/description/version + error handling.Related
Pairs with framework objectstack-ai/objectstack#2971 (POST /packages 409 duplicate detection). No hard dependency — this PR compiles/works against current framework
main.🤖 Generated with Claude Code