Repository navigation
feat(spec)!: a view holds lists only; view-held forms are tombstoned - #38888
huangyiirene wants to merge 7 commits into
Conversation
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
📓 Docs Drift CheckThis PR changes 3 package(s): 40 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 186 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 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
|
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
…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
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Superseded by #38908. The holding seat ( |
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>
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS 2026-12-02T03:30Z · Closed as superseded. PR #38957 merged ( |
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
@objectstack/spec:view.form,view.formViews, theformview kind, the flattened form overlay, and the_views.KEY.title/.submitBehaviortranslation tails (ADR-0159 D7, D8). The served container expansion drops form members; the raw expansion stays for the projection and the conversions.form-view-internal-not-loadedis retired (Q6).ui/).os migrate protocol --to 19 --apply --yes. No skip switch. Birth half pending.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/formper 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
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code