Skip to content

Commit 67154ed

Browse files
docs(skills): lookupAutofill copies a currency amount only between fields in the same currency (#37044)
repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr Fixes #36349 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感;读「数据建模」技能的 AI 助手现在知道,选取关联记录时金额只在两边币种相同的情况下才会自动带出,不同币种时目标字段保持原值并说明原因,平台不做换算。 - 为什么做:这是「选产品不跨币种抄价格」那项改动欠下的技能文字,替按技能写应用的 AI 助手补上,免得它继续承诺一定会带出价格。 - 出错会怎样:只是技能里的两句说明、一处指引和几处表格用词,不影响任何运行行为;可以直接撤回这一个合并。 - 要你做什么:无。 ## What changes `skills/objectstack-data/rules/field-types.md`, the `lookupAutofill` paragraph. It ended at the sentence about the grid's same-named `autofill` copy and stated no currency condition. Two sentences are appended there, covering the declared pair and the same-named copy together: > Either copy moves a `currency` amount only between fields in the same currency (`fixed` or per-record); else the target is left as it was and the form says why. Nothing is converted. This is what the merged code does (`crossCurrencyRefusal` and `judgePickWrites` in `ui/packages/fields/src/widgets/lookupAutofill.ts`, used by the record form and by the grid's `planLookupAutofill`; the spec describe of `FieldSchema.lookupAutofill` states the same rule for both copies). `skills/objectstack-data/rules/relationships.md`, the "Catalog auto-fill" bullet (the grid's same-named copy), now ends "picking a record fills those cells (a `currency` amount only in the same currency: field-types.md → `lookupAutofill`)": a pointer to the sentence above instead of a second statement of the rule. It fits that file's headroom (4180 to 4202 of 4203 tokens); nothing was deleted there. `field-types.md` sat at its token ceiling (3541 of 3541), so its sentences are paid for in the same file, by deletion and with no ceiling moved: - the paragraph's own example is shortened from the full pair literal to "`unit_price` from a product's `list_price`" (the heading already spells the pair shape), and "(single-value `lookup` / `master_detail`)" becomes "(single-value only)" (the table rows directly above name the two types); - fourteen "When to Use" cells that only restated the type name lose the restating words: `date`, `time`, `datetime`, `number`, `file`, `markdown`, `html`, `richtext`, `boolean`, `signature`, `location`, `avatar`, `tags`, `slider` keep a shorter cell with the same meaning (for example "Date only (no time component)" is now "Date only"). Published-skill size, measured at `b01d8f97e9` (before) and `a141c91fb2` (after): `rules/field-types.md` lines 267 / 270; `rules/field-types.md` tokens 3541 / 3540 (ceiling 3541); `rules/relationships.md` tokens 4180 / 4202 (ceiling 4203); whole `skills/` tree lines 22996 / 23000; whole bundle tokens 294236 / 294257. A `patch` changeset for `@objectstack/skills` is included: the skill text ships in that package. Read first: the appended sentence (the risk is a promise the runtime does not keep); then the trimmed table cells (the risk is a lost hint). ## Tests No code or test changes. No case under `skills/objectstack-data/evals/` mentions `lookupAutofill` or the grid `autofill` copy, so no eval asserts the old promise and none was edited. The evals are model-graded fixtures and were not run live here: NOT MEASURED, reason: no local runner. <details><summary>Local gates at a141c91</summary> The gate list was derived with `node scripts/pm/dispatch-gates.mjs --commands` (48 families). 43 ran and exited 0, among them: - `node scripts/check-skills-token-ratchet.mjs`: exit 0, "60 authored bundle file(s) within their ceilings"; the rows read `field-types.md 3540 / 3541 (-1)` and `relationships.md 4202 / 4203 (-1)` - `pnpm --filter @objectstack/spec run check:skill-served-sections`, `pnpm check:skill-links`, `pnpm check:skill-identifier-liveness`, `pnpm check:skill-compatibility`, `pnpm check:skill-frame-sync`, `pnpm check:doc-authoring`, `pnpm check:nul-bytes`, `pnpm check:pm-skill-id-lint`, `pnpm check:role-word`: exit 0 - `node scripts/check-empty-changeset.mjs --base origin/main`, `node scripts/check-changeset-no-major.mjs --base origin/main`, `node scripts/check-adr-0087-registration.mjs --base origin/main`, `pnpm check:published-files`: exit 0 Five exited 3 (PREREQUISITE NOT MET, they read built output and nothing was built for a text-only diff) and are NOT MEASURED locally, left to CI: `check:doc-formula-expressions`, `check:dts-closure`, `check:dual-build-cjs-loads`, `check:lean-entry-closure`, `check:sourcemap-no-sources-content`. `node scripts/pm/overlap-check.mjs` at a141c91: "VERDICT clean exit 0" against `origin/main` and against the other open pull that edits both files. </details> ## Acceptance notes - The card's wording is "the target stays empty". The merged code leaves the target as it was: empty on a fresh line, and holding its earlier value on a re-pick or an `overwrite: true` pair. The sentence says "left as it was" so that it promises only what the runtime does. - "The same currency" also covers two amounts that both sit in the home currency (neither declares one), which copy as before. - The rule also has finer cases the sentence does not spell out (a target whose record holds no code yet, a parent code that could not be read): each is the same outcome, target left as it was with a stated reason. - The grid's catalog auto-fill bullet points at the field-types sentence rather than restating it. The grid leaves a refused cell as it was and shows a note under the line (`planLookupAutofill`'s `withheld` list, drawn by `GridFieldWidget`). ## Verification `node scripts/check-skills-token-ratchet.mjs` prints `field-types.md 3540 / 3541 (-1)` and `relationships.md 4202 / 4203 (-1)` and ends with a line starting with a check mark. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr)_ --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 3691a5c commit 67154ed

3 files changed

Lines changed: 37 additions & 23 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the data skill says a lookup pick copies a currency amount only between fields in the same currency
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-data` described `lookupAutofill` (`rules/field-types.md`) and the line-item grid's catalog auto-fill (`rules/relationships.md`) as unconditional copies. The first now states, and the second points to, the rule the platform applies to a declared pair and to the line-item grid's same-named `autofill` copy: a `currency` amount is copied only between fields in the same currency (a `fixed` code or a per-record one); otherwise the target is left as it was and the form says why. Nothing is converted, so a line in another currency takes its price by hand. The sentence is paid for in the same file by trimming type-table cells that only restated the type name. No behaviour changes.

‎skills/objectstack-data/rules/field-types.md‎

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,31 @@ const fields = {
4040
| `phone` | Phone numbers | `format` |
4141
| `password` | ⚠️ Masked-on-read input. On a generic object the value is stored **PLAINTEXT at rest**. Prefer `secret` for credentials; a generic `password` field triggers a build warning | `minLength`, `maxLength` |
4242
| `secret` | Reversible **encrypted-at-rest** credential (DB password, API key, token) — encrypted on write via `ICryptoProvider`, masked on read, fail-closed (ADR-0100) | — |
43-
| `markdown` | Markdown-formatted content | `maxLength` |
44-
| `html` | Raw HTML content | `maxLength` |
45-
| `richtext` | WYSIWYG rich text editor | `maxLength` |
43+
| `markdown` | Markdown content | `maxLength` |
44+
| `html` | Raw HTML | `maxLength` |
45+
| `richtext` | WYSIWYG editor | `maxLength` |
4646

4747
## Numbers
4848

4949
| Type | When to Use | Config |
5050
|:-----|:------------|:-------|
51-
| `number` | Generic numeric value | `min`, `max`, `precision`, `scale` |
51+
| `number` | Numeric value | `min`, `max`, `precision`, `scale` |
5252
| `currency` | Monetary amounts | `currencyConfig` (→ Currency) |
5353
| `percent` | Percentage; stored as a fraction (0-1) unless the field declares `max` above 1 (`max: 100`), then whole points; seeds, defaults, API values use that scale | `min`, `max`, `precision`, `percentDisplay` — the read-only face: unset or `'bar'` draws a progress bar, `'plain'` the number alone, for a rate or a probability |
5454

5555
## Date & Time
5656

5757
| Type | When to Use | Config |
5858
|:-----|:------------|:-------|
59-
| `date` | Date only (no time component) | `defaultValue` |
60-
| `datetime` | Full date + time | `defaultValue` |
61-
| `time` | Time only (no date component) | `defaultValue`, `format` |
59+
| `date` | Date only | `defaultValue` |
60+
| `datetime` | Date + time | `defaultValue` |
61+
| `time` | Time only | `defaultValue`, `format` |
6262

6363
## Logic
6464

6565
| Type | When to Use | Config |
6666
|:-----|:------------|:-------|
67-
| `boolean` | Standard checkbox | `defaultValue` |
67+
| `boolean` | Checkbox | `defaultValue` |
6868
| `toggle` | Toggle switch (distinct UI from checkbox) | `defaultValue` |
6969

7070
## Selection
@@ -94,22 +94,25 @@ options: [
9494
| `tree` | Hierarchical self-reference | `reference` — optional; when written, this object's own name (any other object is refused at parse) |
9595
| `user` | Person picker — a lookup specialized to `sys_user` (reviewer, watchers). Stored identically to `lookup` | `multiple` (collaborators), `defaultValue: 'current_user'`, `deleteBehavior` (no default; declared, as on `lookup`: relationships.md → Delete Behaviors) |
9696

97-
**`lookupAutofill: [{ target, source, overwrite? }]`** (single-value `lookup` /
98-
`master_detail`): a pick copies the picked record's `source` into this object's
99-
`target` (`[{ target: 'unit_price', source: 'list_price' }]` on a product lookup),
100-
in the form and the line-item grid. `target`: a field of this object an author
101-
writes (not the lookup, `readonly` or computed), named once. `source`: a declared,
102-
non-`internal` field of `reference` the target can hold. A pick fills an empty
103-
target or an earlier pick's fill; `overwrite: true` always replaces. Client-side
104-
only; in a grid a declared target leaves the same-named `autofill` copy.
97+
**`lookupAutofill: [{ target, source, overwrite? }]`** (single-value only): a
98+
pick copies the picked record's `source` into this object's `target`
99+
(`unit_price` from a product's `list_price`), in the form and the line-item
100+
grid. `target`: a field of this object an author writes (not the lookup,
101+
`readonly` or computed), named once. `source`: a declared, non-`internal` field
102+
of `reference` the target can hold. A pick fills an empty target or an earlier
103+
pick's fill; `overwrite: true` always replaces. Client-side only; in a grid a
104+
declared target leaves the same-named `autofill` copy. Either copy moves a
105+
`currency` amount only between fields in the same currency (`fixed` or
106+
per-record); else the target is left as it was and the form says why. Nothing
107+
is converted.
105108

106109
## Media
107110

108111
| Type | When to Use | Config |
109112
|:-----|:------------|:-------|
110113
| `image` | Image files (PNG, JPG, GIF, WebP) | `multiple` |
111-
| `file` | Generic file attachments | `multiple` |
112-
| `avatar` | User/profile picture | — |
114+
| `file` | File attachments | `multiple` |
115+
| `avatar` | Profile picture | — |
113116
| `video` | Video files | — |
114117
| `audio` | Audio files | — |
115118

@@ -135,17 +138,17 @@ Stored as JSON on the parent row, no separate table/FK:
135138

136139
| Type | When to Use | Config |
137140
|:-----|:------------|:-------|
138-
| `location` | Geographic coordinates (lat/lng) | — |
141+
| `location` | Coordinates (lat/lng) | — |
139142
| `address` | Structured address (street, city, country) | — |
140143
| `code` | Syntax-highlighted code editor | `language` |
141144
| `json` | JSON data (untyped escape hatch) | — (validate with a `json_schema` validation rule on the object) |
142145
| `color` | Color picker | — |
143146
| `rating` | Star/heart rating | `max` (default 5) |
144-
| `slider` | Numeric slider | `min`, `max`, `step` |
145-
| `signature` | Digital signature pad | — |
147+
| `slider` | Slider | `min`, `max`, `step` |
148+
| `signature` | Signature pad | — |
146149
| `qrcode` | QR code / barcode | — |
147150
| `progress` | Progress bar | `min`, `max` |
148-
| `tags` | Free-form tag input | — |
151+
| `tags` | Free-form tags | — |
149152
| `vector` | AI/ML embeddings (semantic search, RAG) | `dimensions` (flat sibling, e.g. `1536`) |
150153

151154
## Common Field Configurations

‎skills/objectstack-data/rules/relationships.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ InvoiceLine = {
333333
clock: a scheduled flow too).
334334
- **Catalog auto-fill** — a `lookup` line field + sibling columns whose names
335335
match fields on the referenced record (e.g. `unit_price`, `description`) →
336-
picking a record fills those cells.
336+
picking a record fills those cells (a `currency` amount only in the same
337+
currency: field-types.md → `lookupAutofill`).
337338
- **Sort field** — a numeric `position` / `sort_order` / `sequence` field is
338339
auto-detected, hidden from the grid, and stamped on drag-reorder.
339340

0 commit comments

Comments
 (0)