Repository navigation
Commit c3da753
feat(ui): the field hand lock holds on the Gantt, the timesheet cell and the palette prefill (#37888)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu7gWK41QJR6jihChx1HnxCf)_
Part of #37448
Open surface: the in-app assistant acting for a person. Its writes run
in the AI service, which does not read the hand lock, so this pull
request does not cover it; card #37898 carries it. The field
descriptions, the metadata-form help texts and the MCP `describe_object`
guidance name it as the one surface that does not honour the lock yet.
Every other surface the card lists is covered, and so is the calendar's
quick-create, which the contract review (7214835610) found writing a
locked field.
Clause-②: no
Metadata-protocol: semantic
Skills-docs: none — no page under skills/** teaches `uiReadonly` or the
hand lock (grep on main), so no skill sentence becomes false
## 维护者速读
- 改了什么:手动锁(`uiReadonly` / `uiReadonlyWhen`)现在在
Gantt(拖动、调整、进度、连线、就地编辑、自动排程、撤销重做)、工时表单元格、日历快速新建和命令面板预填上都生效。
- 用户会看到:被锁的字段在这些界面上改不动,Gantt
会把条退回并提示“只读”;工时表锁定的格子变成只读,全局锁定时不再出现“添加行”;日历的标题或日期字段被锁(含服务端只读)时,点空白日期改开完整新建表单。
- 没覆盖的:应用内助手代人写入(在云端 AI 服务里,不读这个锁),描述里已写明,由 #37898 承接。
- 风险:只收紧手动编辑;API、导入、动作、流程写入不变。
## What changes
Each surface reads the one verdict of `@object-ui/core`
(`fieldReadOnlyByHand`, or its static half
`fieldStaticallyReadOnlyByHand` where no record exists yet) with the
shell's predicate scope (`usePredicateScope`).
- **Gantt** (`@object-ui/plugin-gantt`, new `ganttHandLock.ts`).
- `ganttPatchByHand` judges each write over the stored record inside
`handleTaskUpdateDefault`, the handler every bar write reaches: drag,
resize, progress handle, in-place edit, auto-schedule, conflict
reschedule, and undo/redo (which skips `onBeforeTaskUpdate`, so the gate
sits on the write itself). A write that changes a locked field is
refused: nothing is sent, the bar is put back and a toast gives the
read-only reason. A locked field the write leaves unchanged is dropped
from the patch, so an in-place title edit still saves when the dates it
echoes are locked. Dates compare as instants.
- `persistDependencies` judges a drawn link over the target record's
dependencies field.
- `ganttHandLockedInteractions` narrows the authored interaction
switches by the static half: a move closes when either date is locked, a
resize only when both are, and the progress handle and the link tool
close with their own field. An authored `false` stays `false`.
- ObjectGantt fetches its own rows without `$select`, so the predicate
operands are on the record.
- **Timesheet** (`@object-ui/plugin-timesheet`). `cellEditable` takes a
`lockedByHand` judge: a cell whose record's value field is locked by
hand is read-only, so it is neither edited nor cleared. A row, date or
value field locked on every record closes the create (`grants.create`),
which also hides **Add row**. `writeCell` refuses a locked update or
delete like a `readonly` one. The timesheet fetch has no `$select`, so
the operands are on the record.
- **Calendar quick-create** (`@object-ui/plugin-calendar`,
`ObjectCalendar.tsx`). A create is judged by the static half
(`fieldStaticallyReadOnlyByHand`), as the create dialog judges it. Where
a field the dialog writes itself (the title field, the start or end
field) is locked on every record, `quickCreateLockedOwnFields` sends the
day click and the range drag to the host's full create form, and a
locked date field is left out of that form's prefill. The static half
also answers `readonly: true`, so a server-locked title or date field
now hands off the same way, where `main` opened the dialog and the
server dropped the value on insert. A required locked field is left out
of the dialog's write (the auto-fill loop skips it), so the server
applies its `defaultValue`; `requiredFieldsQuickCreateCannotFill` counts
one with no `defaultValue` as unfillable, so the gesture is handed off
rather than offering a write that would be refused. With no host form,
nothing is offered, as before.
- **Command palette** (`@object-ui/app-shell`, `paletteCreate.ts`). The
create-as prefill skips a `uiReadonly` field, as it already skipped
`readonly`. A create is judged by the static half only, as the create
dialog judges it.
- **List view** (`@object-ui/plugin-list`). `editedInPlace` takes the
kanban lane field the board actually uses (`kanbanLaneFieldOf`: the
block's `groupByField`, else the object's detected lifecycle field), so
the lane field's lock operands are in `$select` even when the block
names no `groupByField` (scope addition from comment 7187109328).
- **Kanban swimlane drag.** No code change: a drop on the swimlane
layout passes only column ids to `onCardMove`, so the write is the lane
(column) field alone, and the existing lane-field gate in
`ObjectKanban.handleCardMove` holds there too. Now pinned.
- **N8 (`BEHAVIOUR_SEGMENTS`).** `uiReadonlyWhen` is not added. The key
is authorable only on field definitions under `objects`, which
`bucketFor` already reads as behaviour; `readonlyWhen` is in the set
because inline-grid columns (a `columns` display segment) carry it, and
those columns have no hand lock. A pin in
`validate-field-consumers.test.ts` proves both keys already credit the
fields they name; the lint source is unchanged.
- **Prose.** The `uiReadonly` / `uiReadonlyWhen` JSDoc and `.describe`,
their metadata-form help texts (all eleven locales), the MCP
`describe_object` guidance and its code comment, and the `handLock.ts`
header now say every console surface honours the hand lock, and each
names the in-app assistant acting for a person as the one that does not
yet. The `uiReadonly` surface lists add "calendar drag and quick-create"
(`uiReadonlyWhen` does not: a create is not judged by the conditional
half). The liveness evidence (`packages/spec/liveness/field.json`) cites
the new readers: `ganttHandLock.ts#ganttPatchByHand`,
`ObjectTimesheet.tsx#valueLockedByHand`, and the calendar's
quick-create. N7: the `cel-field-ui-readonly-when` row of the
expression-conformance ledger is reworded (the edit dialog and grid cell
call `resolveFieldRuleState` directly; every other surface goes through
`fieldReadOnlyByHand`) and lists the Gantt and timesheet readers.
### Small decisions taken in this pull request
- Gantt: a move closes on either locked date, a resize only on both (the
locked edge is refused on the write); a locked but unchanged field is
pruned from the patch rather than refusing it; a refusal toasts the
read-only reason; in-place edit stays open and is judged on the write.
- Timesheet: any statically locked row, date or value field closes the
create (and Add row); a locked record's cell is read-only, which also
blocks clearing it.
- Calendar quick-create: a locked field the dialog writes itself hands
the gesture to the full form rather than closing it; a locked date field
is not prefilled there; a required locked field with a default is left
out of the write, one without counts as unfillable.
- Palette: static half only.
- List view: the detected lane field is always harvested.
- N8: not added, reason above.
- `Metadata-protocol: semantic` where the claim had `none`: the keys'
descriptions change what an author's `uiReadonly` / `uiReadonlyWhen`
does (five more surfaces lock), so the changeset is `minor` on the
packages that move behaviour.
## Why
Phase 1 (#37436) routed the dialogs, record page, grid, kanban column
drag and calendar drag through `fieldReadOnlyByHand`, but a person could
still change a hand-locked field from the Gantt, the timesheet cell and
the palette's create-as prefill. The card asks the lock to hold on every
console surface.
## Tests
One pin per surface; each was ablated with
`scripts/ablation-replace.mjs` and went red, then the file was restored
(`git diff --quiet HEAD`).
| Surface | Pin | Ablation | Red |
|:--|:--|:--|:--|
| Palette prefill | `CommandPalette.previewCreate-36286.test.tsx` |
`fieldStaticallyReadOnlyByHand(field)` → `field.readonly === true` | 1 |
| List view lane operand | `ListView.lockOperandSelect-36806.test.tsx`
"the lane field the board detects when the block names none" |
`kanbanLaneFieldOf(...)` → the block's `groupByField` | 1 |
| Gantt write | `ObjectGantt.harness.test.tsx`
"ObjectGantt.handLock-37448" | verdict forced to `write` | 2 |
| Gantt link | same describe, link test | link gate forced open | 1 |
| Gantt interactions | same describe, static test | lock defs passed as
`undefined` | 1 |
| Timesheet cell | `ObjectTimesheet.test.tsx` "the field hand lock" |
`lockedByHand(...)` line disabled | 2 |
| Timesheet create | same describe | `&& !createLockedByHand` removed |
2 |
| Kanban swimlane | `ObjectKanban.handLock-36806.test.tsx` "a drag on
the swimlane board" | lane `fieldReadOnlyByHand` forced false | 1 |
| Calendar quick-create, own fields |
`ObjectCalendar.quickCreateHandLock-37448.test.tsx` |
`quickCreateLockedOwn.length === 0` made always true | 3 |
| Calendar quick-create, prefill | same file | the prefill's locked-key
filter made a pass-through | 2 |
| Calendar quick-create, unfillable | same file | the locked branch of
`requiredFieldsQuickCreateCannotFill` disabled | 1 |
| Calendar quick-create, auto-fill | same file | the auto-fill loop's
locked-field skip disabled | 1 |
Each Gantt, timesheet, kanban and calendar describe also carries a
CONTROL (an unlocked record or field still writes; on the calendar, a
`uiReadonlyWhen` does not judge the create).
## Acceptance notes
- The in-app assistant is the open surface named above; it needs the
hand lock judged where the assistant's writes run. Card #37898 carries
it.
## Verification
Head `1916ae98` (main merged in twice; no conflict, the merges bring
only `main`'s content). CI on the head: 61 success, 9 skipped, none
failed.
- Affected suites: UI (plugin-gantt, plugin-timesheet, the ListView
operand pin, the kanban hand-lock pin, app-shell `chrome/`, core
`evaluator/`) 1650 passed, 148 skipped; UI plugin-calendar and core
`evaluator/` after the rework 1105 passed, 122 skipped;
`@objectstack/spec` `src/data` 6893 passed; `@objectstack/mcp` 1589
passed; `@objectstack/platform-objects` 2214 passed; `@objectstack/lint`
`validate-field-consumers.test.ts` 203 passed. After the last merge the
new calendar pin re-ran: 7 passed.
- `pnpm --filter @objectstack/spec run check:generated` passes on a
fresh spec build (docs, liveness state counts and api-surface included);
`check:liveness` passes; `node scripts/check-i18n-bundles.mjs` OK; `node
scripts/check-nul-bytes.mjs` passes.
- `node scripts/pm/dispatch-gates.mjs --commands` (122 commands) ran on
the first head: every one passes except three that refused on a missing
prerequisite (no verdict): `check:skill-examples`, `check:dts-closure`
and `check:dual-build-cjs-loads`, which read `.d.ts` files this
container built without (`OS_SKIP_DTS=1`). On the rework the families
its paths touch were re-run, all exit 0: `check-changeset-no-major`,
`check-empty-changeset` (and `--self-test`), `check-issue-citations`,
`check:changeset-gate-self-tests`, `check:doc-authoring`, `check:i18n`,
`check:i18n-stale-fill`, `check:issue-citations`.
- Package type-checks were not measured locally (the workspace's
dependent declarations are not emitted here); CI's `TypeScript Type
Check` and `Type Check UI` are green on the head.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic
(only describe and JSDoc text moved there).
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A changeset with both declaration lines, here and in the
changeset.
- [x] 6. `packages/spec` generated artifacts 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.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgWGbDsK1qEW72jibhi)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgWGbDsK1qEW72jibhi
<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgWGbDsK1qEW72jibhi -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent ff63b02 commit c3da753
36 files changed
Lines changed: 804 additions & 69 deletions
File tree
- .changeset
- content/docs/references
- data
- system
- packages
- lint/src
- mcp/src
- platform-objects/src/apps/translations
- qa/dogfood/test
- spec
- liveness
- src/data
- ui/packages
- app-shell/src/chrome
- core/src/evaluator
- plugin-calendar/src
- plugin-gantt/src
- plugin-kanban/src
- plugin-list/src
- __tests__
- plugin-timesheet/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
0 commit comments