Skip to content

feat(spec)!: a view holds lists only; view-held forms are tombstoned - #38888

Closed
huangyiirene wants to merge 7 commits into
mainfrom
claude/project-thread-3s1qta
Closed

huangyiirene wants to merge 7 commits into
mainfrom
claude/project-thread-3s1qta

Conversation

@huangyiirene

Copy link
Copy Markdown
Collaborator

Requested by Irene · project thread

Fixes #37112

Draft, pushed in commits. PR 2 of the split (claim amendment 6): the tombstones, view reads that serve lists only, the kept-reader pins on a 19 build, the console, and the boot guard (ruling 7303149461). The body is filled in as the commits land.

What changes

  • Tombstones in @objectstack/spec: view.form, view.formViews, the form view kind, the flattened form overlay, and the _views.KEY.title / .submitBehavior translation tails (ADR-0159 D7, D8). The served container expansion drops form members; the raw expansion stays for the projection and the conversions.
  • View reads serve lists only (metadata-protocol, intake, rest, loaders); the save door refuses the old shapes.
  • Lint stops reading old shapes; form-view-internal-not-loaded is retired (Q6).
  • Kept-reader pins on a 19 build, with ablations; the dual-read tests rewritten to the major's answer.
  • Console (ui/).
  • Boot guard: a 19 runtime without the switch marker refuses to start, naming os migrate protocol --to 19 --apply --yes. No skip switch. Birth half pending.
  • Docs, skills, BREAKING changeset.

Why

ADR-0159 card ⑤b: forms are their own type, and the major stops reading the three view shapes.

Verification

To be filled in: the before-tombstoning readings (GET /api/v1/meta/form per example, and the grep, with tree and commit), the pins and their ablations, and the dogfood battery on the final head.

Clause-②: yes (narrowing)
Metadata-protocol: narrowed

Skills-docs: pending

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

A view holds lists only (ADR-0159 D7): `view.form`, `view.formViews` and
the `form` view kind are retiredKey / enumWithRetiredValues tombstones
naming `forms:`, the flattened form overlay is gone, and the served
container expansion drops form members while the raw expansion stays
for the projection and the conversions. The translation tails
`_views.KEY.title` and `.submitBehavior` are tombstoned and the
translator no longer reads them (D8).

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAmjLdCQkCPb8p8sKJs
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/metadata-protocol, @objectstack/rest, @objectstack/spec, touching 74 documentable anchor(s). ⚠️ 20 changed file(s) yielded no anchor (packages/spec/api-surface/api.json, packages/spec/api-surface/root.json, packages/spec/api-surface/ui.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

40 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json ac97540f75444580952e9518b1276d8f5abc4672.

⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 20 changed file(s) yielded no anchor (packages/spec/api-surface/api.json, packages/spec/api-surface/root.json, packages/spec/api-surface/ui.json, …) — pages documenting those are invisible to this run
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 186 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json ac97540f75444580952e9518b1276d8f5abc4672 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 0d449e185e7a58c418db14d97b765e41fc6c6c17 — the merge of head 240a1f54f2f45b70266de5da97d25865d2052ec7 into base ac97540f75444580952e9518b1276d8f5abc4672, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 0d449e185e7a58c418db14d97b765e41fc6c6c17 && git checkout 0d449e185e7a58c418db14d97b765e41fc6c6c17
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ac97540f75444580952e9518b1276d8f5abc4672 240a1f54f2f45b70266de5da97d25865d2052ec7 && git checkout -B drift-repro ac97540f75444580952e9518b1276d8f5abc4672 && git merge --no-ff 240a1f54f2f45b70266de5da97d25865d2052ec7

node scripts/docs-audit/affected-docs.mjs --json ac97540f75444580952e9518b1276d8f5abc4672

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs ac97540f75444580952e9518b1276d8f5abc4672 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

A view item keeps its discriminated-union shape with the list arm alone,
and its unmatched discriminator answers the `viewKind: 'form'`
prescription. The view ledger grades `form` and `formViews` dead with
REMOVED notes; the undrilled-container, key-mention and
dropped-refinement baselines shrink by the sites the tombstones closed;
generated references follow.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAmjLdCQkCPb8p8sKJs
Every test that asserted a view-held form (the container's form and
formViews, the viewKind 'form' item, the flattened form overlay, and the
_views form translation tails) now asserts the protocol-19 answer: the
door refuses the whole form at its own key with the D7 prescription, and
the same body is judged where a form lives now, the form item. No test
is deleted; each rewritten case carries an [ADR-0159 D7] or D8 note.

A shared testkit holds the four retired view-held doors so the
form-key retirement tests judge their old rows in one place. The
dropped-refinements header count follows the 22 site lines already
removed.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAmjLdCQkCPb8p8sKJs
@github-actions github-actions Bot added the tests label Dec 1, 2026
…ewContainer

The served view read uses expandServedViewContainer (lists only). Every
other reader keeps the raw expansion of a stored container.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAmjLdCQkCPb8p8sKJs
…oors and in the census

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAmjLdCQkCPb8p8sKJs
… serves no projected item

The served view list leaves out stored old-shape form items. The form
doors' withdrawal layer reads them through getViewItemsWithStoredForms.
The stored-form census keeps the before-the-switch reading.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAmjLdCQkCPb8p8sKJs
GetUiViewResponse is a view for `list` or `{ object, form }` for `form`.
The answer is unchanged, and a test pins it byte-equal.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAmjLdCQkCPb8p8sKJs
@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Superseded by #38908. The holding seat (repo:objectstack#3, claim 7310210133 on #37112, resuming from release record 7310012461) continues this draft from 240a1f54f2 on its own branch in #38908. This draft is not pushed to again; the seat closes it once #38908 lands.

Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
objectstack-ai#38913)

<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB8bGG76Ba3qpTAkGh8yPgHA)_

Fixes objectstack-ai#37770

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up objectstack-ai#38961

## 维护者速读

- 新增一个由数据层回答的锁读取(单条和一页最多 200 条),告诉任何能读记录的人它是否被锁、是因关闭态还是因审批锁住。
- 不装审批插件也能用,此时只有关闭态会锁;审批原有的读取、SDK 方法和服务成员一字未改。
- 上传链接在发放前改问这个读取,关闭的记录用新句子拒绝,审批中的记录仍用原句子。
- 控制台记录页、表格和明细表格改问这个读取的工作归 objectstack-ai#37773,不在本 PR。

## What changes

ADR-0162 D9: one answer to "is this record locked, and by which lock",
for both locks a record can be under.

- **Answer shape** (`packages/spec/src/api/record-lock.zod.ts`):
`RecordLockSchema`, `GetRecordLocksRequestSchema`,
`RecordLockEntrySchema`, `GetRecordLocksResponseSchema`,
`RECORD_LOCKS_MAX_RECORD_IDS = 200`. Spelled as two strict arms
(`locked: true` with both kinds, `locked: false` with none) so the
published JSON Schema carries the "both kinds exactly when locked" rule
too. Done-when item 5 (N12): **the internal seam requires the source**,
so `lockSource` is never optional under `approval`.
- **The read** (`packages/objectql/src/record-lock-read.ts`,
`ObjectQL#getRecordLock` / `#getRecordLocks`). Readability is read as
the caller, with each form's approvals-counterpart anchor (seat ruling
7152650156): the single read counts any row its by-id read returns and
judges the engine-spelled id; the page counts a row only when its id is
the asked id. The closed-state producer reads straight from the driver,
above the caller's grants (so field permissions on the state field do
not hide the answer, per D9) and inside the caller's org scope
(`buildDriverOptions`). A store read that fails is thrown, never read as
open. Order: `closed_state` before `approval`; within a reason `master`
before `record`.
- **The approvals producer**
(`packages/plugins/plugin-approvals/src/record-lock-producer.ts`):
pending under a locking node, or a passage on a `closedStates` object,
for the record itself and for `master_detail` lines of such a master. It
reuses the lock hooks' own helpers (four of them gain `export` in
`lifecycle-hooks.ts`, which the package entry does not re-export). It is
bound beside the lock hooks inside the `disableAutoHooks` block and
cleared in `destroy()`, so a composition that binds no approval lock
answers no approval lock.
- **Data protocol**
(`packages/metadata-protocol/src/protocol-record-lock.ts`):
`getRecordLock` / `getRecordLocks`, the object-existence gate first,
then the engine. An engine without the read answers `undefined`, which
the REST doors turn into 501.
- **REST** (`packages/rest/src/record-lock-routes.ts`, registered from
`data-action-routes.ts`, so `rest-server.ts` does not move): closed
empty query sets, `sendOk` envelope, the by-id read's localized `404
RECORD_NOT_FOUND` with `Vary`, 400 for a bad page body, 501 when the
read is missing. Two ledger rows (`data.getRecordLock`,
`data.getRecordLocks`) with their response schemas.
- **SDK** (`packages/client`): `data.getRecordLock(object, id)` and
`data.getRecordLocks(object, recordIds)`, with the types re-exported.
- **Upload-link door**
(`packages/services/service-storage/src/record-file-access.ts`): asks
`engine.getRecordLock` as the caller before it issues a field link and
refuses `409 RECORD_LOCKED` with "the record is closed, so no file can
be added to it" on `closed_state`, or the existing approval sentence on
`approval`. An engine without the read falls back to the approvals
service, as before.
- **Docs**: `content/docs/api/data-api.mdx` § Record locks,
`content/docs/api/client-sdk.mdx`, and a pointer from the approvals lock
reads in `content/docs/automation/approvals.mdx`.
- **Engine line ceiling**: `engine.ts` gains one import line and two
one-statement forwarders (+3, 6857 → 6860). The
`check:facade-delegation-only` row is raised by that measured growth,
per the maintainer's ruling record
[7314474264](objectstack-ai#37770 (comment))
on objectstack-ai#37770 (「提到 6861」): `baseLines` 6860 at `dd7675de60`, `maxLines`
6860. No other engine growth is covered by that ruling.
- **Level**: the two new request and response shapes enter the `api`
authorable-surface shard, which the changeset level axis reads as
`Metadata-protocol: added`, so `@objectstack/spec` is a `minor`; the
other packages are `patch`.

Out of scope here: moving the console askers (record page, grid, line
grid) onto this read belongs to objectstack-ai#37773, together with its wording.

Follow-ups: objectstack-ai#38961 (the skills page § Reading the lock points at this
read) and objectstack-ai#38962 (the contract review's nits: pin the passage arm and
the read's jsdoc on a failed store read; the closed-state lines'
semi-join and the repeated foreign-key read).

## Why

A client could only ask the approvals read, which knows nothing of
closed states, so a closed invoice looked editable until the save was
refused. ADR-0162 D9 (adopted, ruling record 7200732942) puts one read
in the data layer for both.

## Tests

- `plugin-approvals/src/record-lock-one-read-37770.integration.test.ts`
(11): real ObjectQL over better-sqlite3 with the real
`ApprovalsServicePlugin`. Every Done-when combination: closed own, line
of a closed master, held by an approval, line of a held master, both at
once, neither, unreadable, missing; agreement with the write path; the
reader whose field permissions hide the state field is told
`closed_state`; no read on the object refuses the same for every id;
`lockRecord: false` and a decided request let go; the approvals-family
read still calls a closed record unlocked; without the plugin only
closed states lock; `destroy()` empties the slot, and the cross-package
key is the one the engine reads; the page answers entry by entry,
refuses 201 ids and takes 200.
- `rest/src/record-lock-routes.test.ts` (10): both doors, parsed against
the ledgered schemas; only the three members are served; 404/Vary;
relayed refusals; 501; 400 for each bad body; closed query sets.
- `rest/src/rest-write-route-hook-refusal-sentence.ledger.test.ts`: the
page door's write-verb row is driven.
- `service-storage/src/record-file-access.integration.test.ts`: the
fixture's approvals stand-in now also fills the engine slot; a new case
pins the closed-state sentence and that closed wins over held.

## Acceptance notes

- `git diff origin/main -- packages/rest/src/approvals-routes.ts
packages/spec/src/contracts` and the client's `approvals.*` methods: no
change (Done-when item 7).
- The read answers for a caller. A system context is bound by neither
lock and is not described.
- No permission or sharing boundary moves: readability is the caller's
existing read, and the answer carries no field, value, request id or
participants.

## Verification

- Package typechecks: objectql, metadata-protocol, rest, client,
plugin-approvals, service-storage — clean.
- Spec build with generated baselines regenerated and committed
(authorable surface, json-schema manifest, api surface, export origins,
strictness ledger counts, reference pages, llms.txt inventory).
- `dispatch-gates --commands`: every derived gate was run locally. The
ones that failed were fixed (route envelope, query-options erasure,
ADR-0122 alias pins, api surface, docs, export origins, llms.txt, facade
ceiling under ruling 7314474264). Four could not run here, for
environment reasons only: `check-plugin-teardown-shape --self-test`
needs an unshallow clone, and `check:skill-examples`,
`check:dual-build-cjs-loads` and `check:i18n` need built dists. CI runs
all four.
- Package suites: objectql 14662, rest census and route tests,
plugin-approvals, service-storage 94, metadata-protocol canonical-fold
census — green.
- `overlap-check`: clean against origin/main, objectstack-ai#38908, objectstack-ai#38888.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM

<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzfGw8DS75kHUYrjbLM -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

2026-12-02T03:30Z · Closed as superseded. PR #38957 merged (f42afe7f64) and closed #37112. It started from #38908's head and carries every commit of #38908 and #38888, as its body states, so nothing on this branch is lost. Its body asked for this pull to be closed on landing. Reopen it if anything here is found missing from main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:system protocol:ui size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants