Repository navigation
feat(studio): author context packs (ai_context) in Studio — a form, and a related-lists block scoped to each child - #37315
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
…d es-ES Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
…e panel catalog; changeset declares the widening Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
📓 Docs Drift CheckThis PR changes 2 package(s): ⛔ 1 release-owned page(s) name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 82f189120f4c3d7013a4ada0b61995ce9af3bf6f && git checkout 82f189120f4c3d7013a4ada0b61995ce9af3bf6f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin dbc1765a24e953ae52c2a4aa2c600b4b1461ed0d 4b6929e4b6886bcb5c66e67f797c5d94c78d7482 && git checkout -B drift-repro dbc1765a24e953ae52c2a4aa2c600b4b1461ed0d && git merge --no-ff 4b6929e4b6886bcb5c66e67f797c5d94c78d7482
node scripts/docs-audit/affected-docs.mjs --json dbc1765a24e953ae52c2a4aa2c600b4b1461ed0d
|
…objects reader (#37143) ContextPackRelatedEntries reads useMetadata().objects for the link catalog; it is mounted only in the metadata admin, so its row is 'off'. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
|
repo:objectstack#7 · os-alice · session_011y7As6JrAPNfuwC2RLXXGu Contract reviewServed-tier: PR #37315 for card #37143 (ADR-0160 D1 clause 2, row 7). Read: the card body and its three comments (triage 7159949524, claim 7162556031, claim amendment 1 7164603714; no dev report is on the card), the PR body, the 34-file list, the net diff against ① Derived judgments
② Semver level
③ Boundary flagsNo dev report is on the card (the relay was failing), so the flags are those the PR body carries, plus two read off the tree.
④ Design judgment
Holds: the six rows are the schema's six keys; S1 (should-fix) — two ordinary edits leave a draft the save door refuses, with no way back in the form.
N1 (nit) —
S2 (should-fix) — the link catalog has no load state, so "not loaded" and "load failed" are drawn as "no links". N2 (nit) — a stored entry with no N3 (nit) — a list's columns can be added and removed but not reordered, while the schema reads them "in order" and the root N4 (nit) — nothing ties the pack face to Two should-fix (S1, S2), four nits, no must-fix. S1 and S2 are open on this head and each earns a delta review of its fix. Implemented-by: VERDICT: PASS |
…lists block waits for the object list (#37143) L2 review on #37315, S1 and S2: - field-multi: removing the last chip of an array whose schema has minItems >= 1 (a pack's fields) writes no key instead of []. - composite: a cleared sub-field drops its key, and a composite left empty while its schema requires a key is removed (a pack's body after None) instead of { field: '' }. - ContextPackRelatedEntries reads getTypeStatus('object'): while the object list loads or after it failed, no stored entry is marked unlinked and the add picker says loading / failed. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
|
repo:objectstack#7 · os-alice · session_011y7As6JrAPNfuwC2RLXXGu Seat reading of the red at head |
|
repo:objectstack#7 · os-alice · session_011y7As6JrAPNfuwC2RLXXGu Contract reviewServed-tier: Delta round on PR #37315 (card #37143), after the round-1 record in PR comment 7167828479 (head ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
S1: closed.
S2: closed. The component reads N5 (nit) — a re-fetch sets the status back to
S3 (should-fix) — the removal rule of
N1 to N4 were accepted in round 1 and the delta does not touch them. S1 and S2 are closed. One should-fix (S3) and one nit (N5) are new on this head; no must-fix. S3 is open and earns a delta review of its fix. Implemented-by: VERDICT: PASS |
…s {} (#37143)
L2 delta review S3 on #37315: /meta/types serves the output derivation,
where a key with .default() is listed as required, so the emptied-composite
prune dropped a legal {} whose presence the renderer reads (a view's
pagination and selection). Only a required key with no default now makes
{} no value. Pinned against the served derivation: view pagination,
selection and gallery keep {}, view kanban and the pack's body are removed.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R
|
repo:objectstack#7 · os-alice · session_011y7As6JrAPNfuwC2RLXXGu Contract reviewServed-tier: Delta round 3 on PR #37315 (card #37143), after the records in PR comments 7167828479 (head ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
S3: closed. The removal no longer reads
N6 (nit) — in that bullet the new clause sits between the two removals and the words that explain them: "... keeps N1 to N5 were accepted in rounds 1 and 2 and the delta does not touch them. S3 is closed. One nit (N6) is new on this head. No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-alice · session_011y7As6JrAPNfuwC2RLXXGu
席位意见:ACCEPT,排队落地。 席位核对 — ACCEPT · head 4b6929e (2026-11-25T18:51Z)
|
Requested by Alice · project thread
Fixes #37143
Clause-②: yes (widening) — one new public export,
aiContextFormfrom@objectstack/spec/ai, and/meta/typesnow serves a form forai_context; no key is added to what a pack may holdMetadata-protocol: none
维护者速读
What changes
ADR-0160 D1, clause 2 (runtime authoring). The type was already registered with
allowRuntimeCreate: trueand its author defects are already reported at save (validateAiContexton the runtime publish door); what was missing was a form, so Studio's generic metadata editor had nothing to lay a pack out with.aiContextForm(packages/spec/src/ai/ai-context.form.ts, exported from@objectstack/spec/ai, registered asai_contextinMETADATA_FORM_REGISTRY), by theskill.form.tsprecedent. Two sections: Basics (name,label, the rootobjectthroughref:object) and Material (fieldsasfield-multiwithdependsOn: 'object', thepage.form.tsprecedent;relatedasrelated-list-entrieswithdependsOn: 'object', theobject.form.tsprecedent;bodyas a composite whosefieldis afield-refover the root). The form names every top-level keyAiContextSchemaaccepts and no other (the registry-wide reconciliation test).related-list-entriesblock learns the pack's entry shape (ui/packages/app-shell/src/views/metadata-admin/ContextPackRelatedEntries.tsx). A pack entry is{ object, field?, fields? }, not the object form's bare name or{ list, label?, columns? }, so the block now tells the two apart by the entry schema it is handed (items.properties.object), never by the type's name:REFERENCE_VALUE_TYPESandreferenceTargetOf, the linkvalidateAiContextresolves (a self-reference and each of a child's several links included); a pick is written{ object, field };useObjectFields, draft-overlaid), never the root's;maxItems(3 lists, 10 columns), and an emptied list or column set removes its key (both arrays areminItems: 1);relatedListskeeps its chip face, unchanged (RelatedListNameEntries, the old body).getTypeStatus('object')), no stored entry is marked unlinked and the add picker says loading / could not load, never "no reference field".field-multiwhose schema hasminItems >= 1(the pack'sfields) removes the key instead of writing[]; in a composite, a cleared sub-field drops its key (assetFieldalready does at the top level), and a composite left empty while its schema requires a key that has no default is removed (the pack'sbodyafter "None") instead of written as{ field: '' }. A composite whose required keys all carry a default keeps{}(S3:/meta/typesserves the output derivation, which lists a defaulted key as required; a view'spagination: {}andselection: {}are read by their presence). Both were drafts the save door refuses with no way back in the form.SchemaForm.tsx(compositeWith) andwidgets.tsx(emptyArrayRefused).engine.form.contextPack.*keys in the studio namespace (en, zh); the platform'smetadataForms.ai_contextbundles regenerated (node scripts/check-i18n-bundles.mjs --write), with the zh-CN leaves translated by hand, and the console's zh-CN overlay rows (metadata-form-zh-cn.ts) copied from them.api-surface/ai.jsonandexport-origins/ai.jsonregenerated for the one new export.#37180's outcome, read for the soft dependency: PR #37209 (merged by the maintainer) puts
ai_contextin ADR-0150's package-scoped bucket besideskill. A pack created in Studio is therefore saved the way a skill created in Studio is, into the package the editor is working in; nothing in this PR picks a package for it, and the reader move is #37216.Tests
packages/spec/src/ai/ai-context.form.test.ts: the registry entry, the identity rows, and every picker scoped byobject.ui/packages/app-shell/src/views/metadata-admin/ContextPackRelatedEntries-37143.test.tsx(12): the four rework pins (loading / idle / error catalog marks nothing; the pack's last root field removed writes no key; an array withoutminItemsstill writes[]; "None" for the body removesbody, a composite requiring nothing keeps{}), and the original eight: the schema discriminator; the links offered (four, the self-reference and both links of one child, an unrelated object absent); a pick written as{ object, field }; columns offered from the child, not the root; column and list removal dropping their keys; an unlinked stored entry kept and marked and a listed link not offered again; the bound and the no-root state; the host id on the add picker. Every value the block writes is parsed withAiContextSchema.RelatedListEntriesWidget-35923.test.tsx(the object form's face) still passes unchanged.openPathObjectReaders-12811.test.ts(app-shell console): one row,ContextPackRelatedEntries.tsxclassifiedoffamong the readers ofuseMetadata().objects(the block reads the served object list for its link catalog and is mounted only in the metadata admin, never on an app's object-list open).bare-type-display-echo-decisions.test.tsandobject-lifecycle-panel-echo-decisions.test.ts(platform-objects): literal counts and a dated comment row only, becauseai_contextnow has a form and its eighteen leaves are authored in zh-CN, ja-JP and es-ES (surface widened by the seat, claim amendment 1).Local runs (head 4b6929e)
pnpm --filter @objectstack/spec test: exit 0.pnpm --filter @objectstack/spec typecheck: exit 0.pnpm --filter @objectstack/platform-objects test: Test Files 126 passed (126), Tests 2161 passed (2161). typecheck: exit 0.ui:pnpm exec vitest run packages/app-shell/src/views/metadata-admin/ packages/app-shell/src/__tests__/: Test Files 824 passed (824), Tests 9036 passed, 1 skipped.packages/i18n/: Test Files 111 passed (111). The rest of app-shell's suite is left toTest UI(a full local run did not finish in 54 minutes on the shared box and was stopped).RelatedListEntriesWidgetdisabled (if (false && isContextPackEntrySchema(schema)), written and restored byscripts/ablation-replace.mjs, blob equal to HEAD after restore) turns the new file red, 7 failed of 8; the one that stays green is the helper-only case.node scripts/check-i18n-bundles.mjs: exit 0, every bundle in sync.pnpm --filter @objectstack/spec check:generated: api-surface and export-origins regenerated with--fix, then clean.mainand the reader-table row:packages/app-shell/src/console/__tests__/openPathObjectReaders-12811.test.ts3/3 (it was the one red file ofTest UI (15/16)at 7d37a1d); spec 894 files and platform-objects 126/2161 green again after the merge.node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran: at 4b6929e, 93 derived, 92 run, 1 NOT-MEASURED (exit 3, prerequisite not met here:check-plugin-teardown-shape.mjs --self-test), 0 UNRUN.Test UI (5/16)and its aggregator), the one failurepackages/auth/src/__tests__/AuthProvider.test.tsx(objectstack#36972 pin,mounts2 vs 1), in a package this PR does not touch; it passed 3 of 3 runs locally at 6ada5fd. At 4b6929e: 59 success, 10 expected skip, 0 failed.uipnpm exec vitest run packages/app-shell/src/views/metadata-admin/ packages/app-shell/src/console/__tests__/openPathObjectReaders-12811.test.ts: Test Files 800 passed (800), Tests 8588 passed, 1 skipped. Ablation, one at a time withscripts/ablation-replace.mjs(blob equal to HEAD after each restore): thefield-multiprune off, the composite's empty-required prune deleted, the catalog state forcedready; each turns exactly its own pin red (1 failed of 12).uipnpm exec vitest run packages/app-shell/src/views/metadata-admin/: Test Files 799 passed (799), Tests 8589 passed, 1 skipped;ContextPackRelatedEntries-37143.test.tsx16/16, its new pins built on the SERVED derivation (z.toJSONSchema(getMetadataTypeSchema(type), { unrepresentable: 'any' })): viewpagination,selection,gallerykeep{}, viewkanbanand the pack'sbodyare removed. Ablation: the default check removed (every required key counts) turns those three red (3 failed of 16), restored to HEAD. Swept every composite row of the registered forms against the served derivation: the rows whose required keys all carry defaults (viewselection,pagination,gallery,userFilters,appearance,userActions,navigation,sharing; objectenable,access,publicSharing; fieldcurrencyConfig; hookretryPolicy; report and dashboarddateRange, dashboardheader; pageinterfaceConfig.appearance,interfaceConfig.userActions; agentplanning; flowerrorHandling) keep{}; the rest have a required key with no default and are removed when emptied.@object-ui/app-shelland@object-ui/i18ntype-check (the ui workspace's own packages have nodist/in this container, so tsc stops on module resolution);Type Check UIis the reading.Acceptance notes
get_record_contextserves it) is covered here in pieces, not by one booted host: the block's every write parses as a pack; the metadata API save of anai_contextrow isprotocol.runtime-authoring-gate.test.ts(metadata-protocol); the record-context door reads the protocol's mergedai_contextlisting (mcp-record-context-tools-bridge.test.ts, runtime). Measured once live as well (showcase booted withobjectstack dev --seed-admin, theui/console served by Vite against it, Chromium via Playwright, at the rework's source): Studio → AI → AI Context Pack → createproject_briefonshowcase_projectsaved and published (PUT …/meta/ai_context/project_brief?mode=draft200,POST …/publish200); edit: root fieldsname,status; the add picker offered the four links to the root (showcase_client_brief.project,showcase_field_zoo.f_master_detail,showcase_project_membership.project,showcase_task.project); the columns offered wereshowcase_task's fields; body chosen then set to "None"; saved body{"name":"project_brief","label":"Project brief","object":"showcase_project","fields":["name","status"],"related":[{"object":"showcase_task","field":"project","fields":["title","status"]}]}(nobodykey), 200 and published. A second edit removed both root fields: saved withoutfields, 200. Then MCPget_record_context(objectName: showcase_project,context: project_brief) on a seeded project answered the pack, with the task rows'titleandstatus.field-refhas no type filter, and a non-long-text pick is reported at save (ai-context-body-not-long-text).useMetadata().objects); an object it does not serve is not offered, and a stored entry naming one is kept and marked.Verification
Two minutes: open Studio, pick a package, open AI → AI Context Pack (advanced fold), create one; choose a root object with a child list (showcase: an object another object looks up), add the related list and pick a column. Expected: the column picker lists the child object's fields, and the Source tab shows
related: [{ object, field, fields }].Read first, by risk:
ContextPackRelatedEntries.tsx(contextPackLinks,ContextPackRelatedEntries), the dispatch at the top ofRelatedListEntriesWidgetinwidgets.tsx,ai-context.form.ts.Generated by Claude Code