Skip to content

docs(adr): ADR-0158 units of measure records ruling U1–U8 and settles L1–L4 - #35370

Merged
os-zhuang merged 6 commits into
mainfrom
claude/issue-35339-uom-adr
Nov 19, 2026
Merged

os-zhuang merged 6 commits into
mainfrom
claude/issue-35339-uom-adr

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #35339
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户无感;这是一份设计记录,把您同意的计量单位方案(标准单位表、各组织自加的单位、带单位的数量字段、分两期交付)和您在决策卡上的原话「可改,只影响以后」写成合同;在您原话之外的细则(重算、谁能改比例、删除单位、单位只有一个名称)都标明是席位按分析建议定的;另有两个问题记为待您以后裁决的开放项,实现卡动手前再定。
  • 为什么做:来自「平台计量单位」这张卡;各套件各写一套单位,数量在套件之间、和 ERP 之间对不上,箱和个、千克和吨也没法换算。
  • 出错会怎样:只影响后续实现卡的依据,不改任何运行行为;写错了撤回或改这份记录即可。
  • 要你做什么:审阅并批准这份设计记录(受管文件,由您批准合入)。

席位核对

What changes

  • New docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md (581 lines), Status Accepted by ruling record 7001193034 on Units of measure on the platform: a standard unit list, quantity fields that carry their unit, and conversion #35339. Decision quotes U1 to U8 verbatim with the ruling's own labels; Non-goals quotes "Out of scope". It declares and implements nothing.
  • "Left to this record" has four sections, all settled, and each part says whose it is:
    • L1: the maintainer's pick is the maintainer's own words on the decision card, option A 「可改,只影响以后」, read as the record's first two sentences of 1A (a ratio can be edited, an edit affects later writes only, stored rows keep their quantity and factor). Ruling record 7003532733 is quoted verbatim; beyond those words, the recompute, the admin edit and its audit, the UI sentence and the delete are marked "settled by the seat, per the analysis recommendation", and the immutability bullet is marked as the seat's technical item.
    • L2: 2A (one label per organization unit, translation deferred to units of measure: translate organization-added unit labels (deferred by the units ADR, 2A) #35404, per-locale labels for standard codes) is marked "settled by the seat, per the analysis recommendation".
    • L3 and L4: settled by the owning seat as technical items, unchanged in substance.
  • This round, at db734f1d, answers the seat's contract review (comment 7005127062 on this PR):
Where each review item was closed
Item Closed in the ADR
S1, a unit code with no quantity beside it Open item 8, owed a ruling by the maintainer, not settled; pointers from L3's object door and its master_detail bullet
S2, which writes U5 judges Open item 9, for the membership card: the three cases, the two precedents, the third shape and its rollout order; the Consequences line on delete points to it
S3, U6's decimal places for a standard code Open item 10, owed a ruling by the maintainer, not settled; pointer from L4
S4, immutability across delete-then-create Open item 11, for the sys_unit card; L1's immutability part and the Consequences line narrowed to a unit row
E1, what rests on 7003532733 beyond 「可改,只影响以后」 Status line, Decided by, Provenance item 2, the "Left to this record" intro, L1's part list, L2, Consequences, Non-goals and References; Open item 5 named as R2's later card
E3, the PR title said "pending" Retitled through the relay in the same patch as this body
N1 The immutability bullet is marked the seat's (with E1)
N2 A mirror-table row: ADR-0144 D5's third bullet and D7 parameter 2 against the seat's L1 settlement
N3, N6 Open item 4: the arithmetic of the ratio and the factor, and what the base-quantity field holds
N4 Open item 9: whether U5 checks a code's dimension against unitDimension
N5 Open item 6: what the display default does at render
N7 Open item 12, with a pointer from the backfill row of the mirror table
N8 The U3 notes are marked as the seat's settlement, the read grant named a new rule; Open item 2 adds the write grants
  • Other edits this round: Open item 3 attributes the deleted-code refusal to the seat; L3's master_detail bullet says "a code on the row" instead of "a sibling code on the row". Open items keep their numbers 1 to 7, and items 8 to 12 are new.
  • Every newly cited source was read at bce0263d and checked to say the same at 3819afec, so the record's Evidence line stands: the two validation headers in packages/objectql/src/validation/, sys_exchange_rate's currency field, backfillRecordCurrencyCodes's header, os migrate recompute-home-amounts, and ADR-0144 D5, D7 and D8 and ADR-0148 D4.
  • docs/adr/README.md regenerated by node scripts/adr-index.mjs (generator-owned). This round leaves it unchanged, because the index reads only the start of the Status line.
  • Number 0158, not 0157: docs(adr): ADR-0157 working calendars are organization-editable runtime data, resolved by code or refused #35364 (working calendars) holds 0157 as an open PR.

Tests

No code. Gates derived by node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack for this diff, run at head db734f1d: 21 of 21 exit 0, reconciled by --ran (21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN).

Gate verdict lines at db734f1
  • check-adr-links: 1173 relative link destination(s) under docs/adr/ resolve
  • check:adr-symbol-anchors: 3804 anchors across 159 records resolve, 0 line anchors
  • check:adr-index: docs/adr/README.md is current, every record parsed
  • check:adr-anchors: OK, 153 decision numbers each naming one decision
  • check:nul-bytes: OK, no raw ASCII control bytes
  • check:doc-formula-expressions: exit 3 first in this fresh worktree (PREREQUISITE NOT MET: @objectstack/formula and @objectstack/lint not built; nothing measured). After turbo run build of those two under the verify lock (VERDICT command-exit 0) it exits 0 ("26 record-scoped formula example(s) ... judged clean").
  • check:doc-authoring, check:pm-prior-rulings, check:pm-governed-merges, check:closed-ceremony-text and the rest of the 21: exit 0
Verbatim check of the quotations

A script compared every quoted line of ruling record 7001193034 with the ADR text, blockquote markers and line wraps collapsed: 32 of 32 present at db734f1d (earlier bodies said "33 of 33", a miscount). A second script did the same for ruling record 7003532733: its four "Picked" bullets, the two card questions and the ruling reference, 7 of 7 present. Control: a copy with "writes" changed to "write" in 1A reports 1A missing. The seat's L4 text is present byte for byte.

Acceptance notes

Verification

Read first: L1 and L2 (whose each part is), then Open items 8 to 11 against the review's S1 to S4, then the U3 notes and Consequences.

Two-minute check: open the ADR and search for a ruling is owed; expect 2 hits, Open items 8 and 10. Search for per the analysis recommendation; expect 6 hits. Search for PENDING; expect 0.

Governed (Tier H): stays draft; landing is the maintainer's.


Generated by Claude Code

…ems pending

Records the maintainer's units-of-measure ruling (record 7001193034) as
ADR-0158: a closed standard unit table in packages/spec beside the value
domains (U1, U2), organization units in sys_unit (U3), a unit declaration
on number fields mirroring currencyConfig (U4), the write-path membership
check (U5), unit decimals (U6), the R1/R2 release plan (U7) and no formula
conversion function (U8), each quoted verbatim.

The ruling's three "Left to the ADR" items, and U6's sentence on the
field's scale, are sections marked PENDING that state the question only;
their settlement comes from the seat.

docs/adr/README.md is regenerated by scripts/adr-index.mjs: the new row,
the summary counts, and ADR-0137's row, which was stale on main.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
…detail follow yet

Writes in the owning seat's settlement of the ruling's third "Left to
the ADR" item, a technical one: the unit declaration is spelled
unitConfig: { unitMode, unit, unitField, unitDimension }, with unitMode
required and no default, unit rather than defaultUnit, and unitDimension
rather than dimension, which already means a group-by axis. A child
quantity does not follow its parent's unit through master_detail in this
record; the two-segment spelling is reserved for a later amendment.

Adds two consequences under U3 (sys_unit readable by members; labelled
"unit of measure") and states the R2 open item that the suite-supplied
factor pointer and the engine-written factor field get distinct names.

L1, L2 and L4 stay PENDING.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 19, 2026
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation labels Nov 19, 2026
…nit decimals only display

Writes in the owning seat's settlement of U6's sentence on the field's
scale, a technical item, quoted as the seat's text: the field's scale
governs storage and is the ceiling; a unit's decimal places are only the
display default for that unit and never exceed it; nothing is rounded at
write by a unit's decimal places; in R2 the projected base quantity
rounds to the base field's scale.

The open item on R2 rounding leaves the list, which renumbers the last
open item; one Consequences line states the rule.

L1 and L2 stay PENDING with the maintainer.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
L1 (ratio lock) and L2 (org-unit label translation) now quote the
maintainer's picks from ruling record 7003532733 verbatim: an org
unit's ratio stays editable and affects later writes only, deleting an
org unit leaves its rows readable and refuses new saves with its code,
a unit's code and dimension are immutable after create, and an org unit
has one label with translation deferred to its own card. Both PENDING
markers are gone.

Open items gain two unsettled questions for the R2 and R1/R2 cards (an
edited old row's stored factor; a quantity field with no scale), and
the list is renumbered with its cross-references.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

Final head for review · area data-2 · 2026-11-19T08:40Z
Head: 6f59e12c5aeeb61481d0bf1311d8281a2680a28e — all check runs on it concluded: 26 success, 22 skipped, 0 failed (docs-only path; Check Documentation Links, Lint · docs & code guards and Test Core green).
Fixes #35339 · ADR-0158 (units of measure) · the maintainer's picks 1A + 2A (ruling record 7003532733) are written in verbatim, 0 PENDING markers left; Open items 1–7 (5 = R2 stored-factor reuse, 6 = field with no scale) settle nothing new.
Known overlap: docs/adr/README.md with #35364 (generated index) — the second to land merges main and re-runs pnpm adr:index.
Review route: L1-a thread, then seat 5 (L2 + governed-path handoff to the maintainer).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:暂时没有。这是计量单位的设计记录,写下你上午定的整体方案,以及你刚定的两点:自定义单位的换算比例可以改,但只影响以后保存的数据;自定义单位只有一个名称。
  • 为什么做:各套件的数量没有统一单位,同一个“千克”有好几种写法,跨套件对账和以后接 ERP 都要先清洗数据。
  • 出错会怎样:不改任何运行行为。记录写错了,改记录或撤回即可。
  • 要你做什么:席位复核后请你合入。新增设计记录必须由你本人合入。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 6f59e12c5a · 2026-11-19T08:42Z

  • Shape: docs only, 2 files, +490/−4. Adds docs/adr/0158-…md (485 lines). Regenerates docs/adr/README.md: the new row, the counts, and the same stale ADR-0137 row that docs(adr): ADR-0157 working calendars are organization-editable runtime data, resolved by code or refused #35364 also refreshes. No code, no changeset, Clause-②: no, Metadata-protocol: none, Fixes #35339.

  • Verbatim check (my own script, independent of the dev's). Every content line of ruling 7001193034's "Ruled design" (24 lines) and of record 7003532733's "Picked" block (4 lines) is present in the ADR's quotations, list markers aside. "Out of scope" and "Left to the ADR" are present too, and the three accepted answers are quoted. 0 missing.

  • Fixes vs card:

    • U1–U8 are quoted under Decision, and the text outside the quotations only cross-references.
    • L1 (1A, delete under 1A, code and dimension immutable) and L2 (2A, with the deferred card units of measure: translate organization-added unit labels (deferred by the units ADR, 2A) #35404) carry Bill's pick verbatim. 0 PENDING markers remain.
    • L3 and L4 match the seat-settled lines of 7003532733: unitConfig: { unitMode, unit, unitField, unitDimension }, no master_detail follow with the spelling reserved, and scale as the ceiling with the unit's decimals as display default only.
  • Open items: renumbered 1–7, and none of them decides anything.

    • The new 5 (whether R2 reuses a stored factor on an edited old row) is a real edge that 1A leaves. It belongs to R2's card.
    • The new 6 (a field with no scale) follows from L4, which names scale as the ceiling. It belongs to the R1/R2 cards.
  • Pinned readings: I spot-checked the cited anchors on 3819afec: CurrencyConfigSchema, refuseRecordModeKeyMismatch, refuseDishonestHomeAmount, EXCHANGE_RATE_SCALE, recordCurrencySummaryRefusal, and the value-domain header. CI on 6f59e12c is 26 success and 22 skipped, with 0 failed and 0 pending. It merges cleanly into current main.

  • For the seat's L2: adopt these four seat settlements explicitly. The ADR labels each "the owning seat's settlement, 2026-11-19", but record 7003532733's seat-settled list names only the U4 spellings, the master_detail reservation and U6. The L2 record should adopt or strike each of these by name:

    1. The two U3 consequences: members can read sys_unit and sys_exchange_rate's grant is not copied; the object is labelled "unit of measure".
    2. L3's design beyond the spellings: unitMode required with no default; the fixed/record cross-refusals, with unitDimension record-only; the alias prescriptions; refused on formula/summary; the shared-unit-field dimension check; and a two-segment unitField refused at the object door.
    3. Open item 4's two-names rule, separating the factorField input from the engine-written factor output.
    4. L3's R1 consequence that a summary over record-mode child quantities is always refused.

    None of these contradicts a ruling. The member read grant is the one with access weight, and it is what U7 R1's "display of the value with its unit" needs. This doesn't block L1. Their provenance is the seat's to sign, not the ruling's.

  • Nits (non-blocking):

    • The Status line reads "Accepted — 2026-11-19" before the merge. That has precedent for a maintainer-ruled record (ADR-0155, ADR-0156), but sibling ADR-0157 says "Proposed". The seat can align the two at handoff.
    • The labels "L1"–"L4" for the "Left to this record" items collide with the L1/L2 review vocabulary used in landing records. A rename is optional.
  • Landing route: check-governed gives GOVERNED, landing tier H(人合). An added ADR file and a generated README that removes lines keep it off the low-risk arm. So the order is the seat's CONTRACT_REVIEW_TIER L2, then the maintainer's merge, or a GOVERNED_APPROVERS APPROVED review followed by the owning seat landing it.

  • Before merge: K = 18 since base 3819afec, so merge main and get a green re-run first. docs(adr): ADR-0157 working calendars are organization-editable runtime data, resolved by code or refused #35364 (ADR-0157) shares the generated README. Whichever lands second merges main and re-runs pnpm adr:index.

  • Landing clause: a new push needs a fresh L1 only if it changes more than a main merge plus the README regeneration, the Status-line alignment or the label rename.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: bce0263dbdcafb64a6afcad2d38bcad7e7c7f0af
Local-runs: none
Scope: docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md, docs/adr/README.md + none
Security-touching: yes
Three hunks teach permission behaviour: U3 puts sys_unit behind the tenant wall with organization_id injected; the note under U3 makes sys_unit readable by every member and says sys_exchange_rate's admin-only grant is not copied (a new grant on the member baseline); L1 says only an organization admin edits a ratio and that the edit is audited by field history. The seat adopting this record adds the security label.

Read for this record: card #35339 (body and all six comments), PR #35370 (body, file list, net diff against main), the 44 check-runs on the head (25 success, 19 skipped, none red, none pending). Cited code was read on main at ee40658d, not only at the record's own 3819afec.

① Derived judgments

  • The diff itself. Two files, both under docs/adr/: one new record, one generator-owned index. No schema, no code, no changeset. No accept set moves and no public surface changes. Right.
  • Registry. The record takes 0158 while 0157 is unlanded; the open draft docs(adr): ADR-0157 working calendars are organization-editable runtime data, resolved by code or refused #35364 holds 0157 (its file list read). The index's record and number counts (158, 153) equal the tree at the head, Accepted rises by one, and the ADR-0137 row now matches that record's status line on main. Right. main has not touched docs/adr/ since the merge base.
  • What the record commits later cards to, each judged:
    • unitConfig on number is additive: FieldSchema declares no unit, uom or dimension key today, so no authored field changes its answer. Right.
    • unitMode required with no default, against currencyMode's dynamic default. Right: there is no tenant unit to default to.
    • The new refusals (U5 membership, the R1 aggregate door, R2's no-ratio refusal) bind only a field that declares the new key. Right; each card's changeset declares its own level.
    • Every summary over record-mode child quantities is refused in R1. Right as the mirror of the currency door before its amendment (recordCurrencySummaryRefusal); a suite that adds unitConfig to a child quantity it already rolls up reds its build, by design.
    • sys_unit is a new sys_ object with a member read grant. Right for display, and a change to the member baseline: see the security line.
    • The value-domain vocabulary stays at three members and no other record is edited ("Amends: no decision"). Right.
    • U1 is a table in packages/spec, not logic; Prime Directive 2 holds as it does for CURRENCY_FRACTION_DIGITS. Right.

② Semver level

skip-changeset matches the diff: nothing a package ships is touched, and Check Changeset is skipped on the head. Clause-②: no on the PR body and on the claim, and right: the diff narrows nothing. The refusals the record declares are each owed their own declaration by the card that builds them.

③ Boundary flags

Dev flags, from the report on the card (7003941232) and the PR body:

  • Verbatim count corrected from 33 to 32: answered. My own comparison of the two ruling comments with the record, quote marks and wraps collapsed, finds every ruling unit present and none altered; the count is a convention.
  • Wording beyond the ruling (Open items 2, 3, 5; L4's pointer to item 6): answered. Each restates a pick or names an edge; none settles anything.
  • The record was not merged with main despite the stale-tree warning: overtaken. The head is that merge, its two blobs equal those at 6f59e12c, and the head's own check-runs are the ones read here. The PR body still reports gates at 6f59e12c.
  • Number 0158, the refreshed ADR-0137 row, the title avoiding sys_unit (tooling: the generated ADR index drops underscores from titles (sys_metadata shows as sysmetadata) #35372): answered above; accepted.
  • Model-free trailer pair kept against the harness reminder: accepted, it is the repository's rule.
  • open_questions: empty. security_findings: none stands as a statement about defects; the record still teaches permission behaviour, hence the security line.
  • Overlap with docs(adr): ADR-0157 working calendars are organization-editable runtime data, resolved by code or refused #35364 on the index: whichever lands second regenerates it. If that is this PR the head moves and the index alone owes a delta.

SQL push-down: nothing in the diff builds a query. Of what the record declares, U5 is a keyed read of one organization table plus a constant, the R1 door groups on the stored code column, and L1 removes the one scan the ruling feared ("no quantity table is scanned"). No id materialisation and no in-app join is declared. The membership card carries the check for bulk writes: one read per batch of distinct codes.

Escalations:

  • E1, to the seat. On GitHub the maintainer's own words for the second ruling are 「可改,只影响以后」 and nothing else. Everything further in L1 and L2 reaches this record through 7003532733, which the implementing session wrote from the seat's relay. The seat relayed the card and is the one who can say what it carried; the items are named below.
  • E2, to the maintainer through the seat. S1 and S3 below each sit between two ruled clauses (U4 with U5; U3 with U6). A card cannot settle either without reading ruled text down.
  • E3, to the seat. The PR title still reads "L1, L2 and L4 pending"; the tree has no pending item and the title becomes the squash subject. Retitling moves no head.

Settlement items, by name, for the seat to adopt or strike:

  • Presented as the maintainer's pick, on the strength of 7003532733 alone: 1A-recompute (stored rows change only by an explicit recompute that previews first); 1A-admin-audit (admin-only ratio edit, field history); 1A-ui-sentence; L1-delete (delete allowed, rows keep the code and show it unlabelled, a new save with it refused); 2A-one-label (one label per org unit, translation deferred to units of measure: translate organization-added unit labels (deferred by the units ADR, 2A) #35404, a platform-shipped per-locale label table for standard codes).
  • Settled by the seat and marked so: L3-keys (unitMode, unit, unitField, unitDimension, the cross-refusals and did-you-mean rows); L3-number-only (refused on formula and summary); L3-no-marker (the unit field carries no marker; S1 bears on it); L3-no-numeric-top-level; L3-no-parent-follow (master_detail not admitted, spelling reserved); L4-scale; U3-member-read; U3-label; OI4-two-names (factorField is the suite's input, the engine's stored factor takes another name).
  • Settled by the seat and not marked so: L1-immutable (N1).
  • Left to a later card though it reads the pick itself: OI5-edited-old-row. 1A's two sentences pull apart there ("affects later writes only" against "they change only through an explicit recompute"), so whichever R2's card picks is a reading of the maintainer's words.

④ Design judgment

docs/adr/0158-…md. Against ruling 7001193034 it holds: Decision is the ruling's text and cross-references, nothing more. Against the pick it holds: no lock, no scan, stored rows keep quantity and factor, and Open item 5 isolates the one place the pick is ambiguous. Against the code it cites it holds on main today: the three-member vocabulary and its "does not widen" header; CURRENCY_FRACTION_DIGITS and its reader in the home projection; CurrencyConfigSchema's modes, the removed 'CNY' default and refuseRecordModeKeyMismatch; HomeAmountSchema's rateField; sys_exchange_rate's tenancy sentence, scale 12, admin-only grant and field history; refuseDishonestHomeAmount; the sibling-unit exemption in collectDurationKeys; the max_scale refusal that never rounds; ADR-0144's D4, D5, D6, D7, D8 rule 2 and Open items 13 and 14. The three verification greps print the same counts on main now.

Against its first consumers, the R1 cards, it breaks in four places. Each is closable on this face by an Open item or a marked settlement; none needs code.

No must-fix.

S1 (should-fix) — a unit code with no quantity beside it has no declaration, and the card's first evidence is one.
U4 puts the declaration on the number field, and L3 settles that the unit field "carries no marker" and "the pointer is the declaration". So a text field that holds a unit code is judged by U5, offered a picker and reached by the backfill only when a quantity on the same object points at it. A material master's base unit, a product's sales unit and the unit columns of a suite's pack table (the table R2's factorField reads) have none. The card's own measurement is srm_material.uom; L3 files it as "a sibling code on the row" from a card reading the record says was not checked against source. Currency has no such gap: any text field declares valueDomain: 'iso_4217_currency' on its own, and sys_exchange_rate.currency is one. U1 rules out a fourth value domain; it does not rule out a marker, and L3 closes that door without saying a shape is left outside. Fix: declare the gap the way L3 declares the fixed-unit roll-up ("declared here, not discovered later"), as an Open item that says a ruling is owed, since admitting a standalone unit field widens U4.

S2 (should-fix) — which writes U5 judges is not stated, and the two precedents the record mirrors answer opposite to L1.
The record validator judges valueDomain on the written value only (packages/objectql/src/validation/record-validator.ts, header). The currency pair guard judges only the pairs a payload touches, and only for a blank code (packages/objectql/src/validation/record-currency-code.ts, header). Under either, an update that changes the quantity on a row whose stored code is no longer a member passes. L1 says "a new save with that code is refused (the row's quantity must move to an existing unit first)", which needs a third shape: membership of the row image's code whenever the pair is touched. That shape also refuses a quantity edit on every row still holding free text before the backfill runs, so it orders R1's rollout. Whether a quantity may be stored beside a blank unit is unstated as well; ADR-0144 D8 rule 4 refuses the currency twin. L1 says the pick leaves "one edge"; this is a second, and it is R1's first member. Fix: an Open item for the membership card naming the three cases (a code written; a quantity written beside a resting code that is no member; a quantity beside a blank code).

S3 (should-fix) — U6's org-editable decimal places have no home for a standard code.
U3: sys_unit "holds org-added units only, and the platform ships zero rows", and org codes live in a namespace no standard code can enter. U1 is a closed spec constant. U6 makes a unit's decimal places "an org-editable default" and argues from Rec 20, which is to say about standard codes. L4 then defines them as the display default "for that unit", and Open item 2 counts U6 among the texts naming sys_unit fields. For KGM or H87 the value has nowhere to be stored or edited. R1's display member is its first reader. Fix: an Open item that states the conflict and that a ruling is owed, or the seat's settlement, marked as such.

S4 (should-fix) — "code and dimension are immutable after create" does not survive delete-then-create, and the record does not say so.
L1 allows deleting an org unit. A sys_* row has no recycle bin and frees its unique value at once (ADR-0148: "Unique keys free immediately"; v1 reaches "business objects — not sys_* objects"). The same code can therefore be created again with another dimension, ratio and label. Resting rows keep the code, take the new label in R1's display, fall into one group with the new rows under U7 R1's grouped aggregate, and sit under a unitDimension they no longer satisfy. That is the relabel hazard ADR-0144's D4 lock closed for currency; this record declines the lock for the ratio only. L1 also rules out scanning for "used", so the card cannot close it with a use check. Consequences says "A unit's code and dimension cannot change after create" without that limit. Fix: an Open item for the sys_unit card (a deleted code stays retired, or re-creation is admitted and its consequence stated), and the Consequences line narrowed to what holds.

Nits, none moving the contract:

  • N1 (nit) — L1's quoted block sits under "Picked by the maintainer ... Verbatim", and its third bullet calls itself "technical, settled by the ADR". Provenance item 2 says L1 carries the maintainer's pick. Mark that bullet as the seat's, as L3 and L4 are.
  • N2 (nit) — The mirror table lists D4 as "Not mirrored" and never names what 1A does mirror: ADR-0144 D5's third bullet ("A corrected rate reaches stored rows only through 'an explicit recompute operation'") and D7 parameter 2. That row would hand R2's card its precedent, os migrate recompute-home-amounts.
  • N3 (nit) — No line states the arithmetic: base quantity equals quantity times ratio, and which way a suite-supplied factor points. ADR-0144 D7 had to add "Parameter 3 as arithmetic" after a workload row and a card body wrote the inverse.
  • N4 (nit) — unitDimension has no named reader. U5 as quoted admits any member code; U4's word "restriction" implies a write check on the code's dimension. Open item 7 covers the release, not who reads the key.
  • N5 (nit) — L4's "never exceed the field's scale" can only be a clamp at render, since a unit row has no field to compare with, and L4 does not say whether the display default pads or rounds (1.5 stored beside a zero-decimal unit). The currency cell formats to the currency's CLDR digits whatever is stored, so a mirrored answer exists; say it.
  • N6 (nit) — Open item 4 is titled as spelling, yet the base-quantity field has semantics no item names: its unit (the dimension's base under a ratio, the suite's own under factorField, mixed when a record field declares no unitDimension) and whether a raw aggregate over it is admitted the way D6 reads the home field.
  • N7 (nit) — The backfill is a looser mirror than the table says. os migrate record-currency-codes writes one given code into blank cells; the unit door rewrites free text in place from a mapping. Where the mapping comes from and what an unmatched value does are unlisted, as is which aggregates count as raw (ADR-0144 Open item 10).
  • N8 (nit) — The note under U3 states the read grant and calls itself "not new rules"; a member read grant on a new system object is one. The write side is stated for the ratio alone: who creates, relabels and deletes an org unit is left to the baseline by silence, and delete is the act L1 attaches refusals to.

docs/adr/README.md. Generator-owned and current: the new row, the three counts and the refreshed ADR-0137 row equal what the tree at the head holds. It holds; no finding.

S1 to S4 each earn a delta review of their fix. A fix on the record moves the head; the index is untouched by any of them unless the title or status line changes.

Implemented-by: claude/issue-35339-uom-adr
Reviewed-by: isolated-l2-35370

VERDICT: PASS

L1 now keeps the maintainer's pick to the maintainer's own words on the
decision card, 「可改,只影响以后」. The rest of what ruling record
7003532733 writes out (the recompute, the admin edit and its audit, the
UI sentence, the delete, and all of 2A) is marked as settled by the seat
per the analysis recommendation, and the immutability bullet as the
seat's technical item. The edited-old-row question is named as R2's.

Open items gain five entries from the contract review: a unit code with
no quantity beside it and U6's decimal places for a standard code, each
owed a ruling by the maintainer; which writes U5 judges; a deleted code
created again; and R1's backfill and raw aggregates. Items 2, 4 and 6
name the write grants, the R2 arithmetic and base field, and the display
default at render. The Consequences line on immutability is narrowed to
what holds, and the U3 notes are marked as the seat's settlement.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels Nov 19, 2026
@objectstack-fleet objectstack-fleet Bot changed the title docs(adr): ADR-0158 units of measure records ruling U1–U8; L1, L2 and L4 pending docs(adr): ADR-0158 units of measure records ruling U1–U8 and settles L1–L4 Nov 19, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: db734f1d91390a35b4d42bc49a4b91a6afd30c61
Local-runs: none
Scope: docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md, docs/adr/README.md + none
Security-touching: yes
The record still teaches permission behaviour, and this delta adds to it: the note under U3 is now named a new rule, "a read grant on the member baseline for a new system object"; Open item 2 opens the write grants (who creates, relabels and deletes an org unit); the admin-only ratio edit and its audit stay, now marked the seat's. The security label stays on.

Delta review from bce0263d (record 7005127062: PASS, should-fix S1 to S4, nits N1 to N8) to this head. Read for it: the dev report 7005510172 on #35339, the PR's title, body and file list, the diff between the two heads, and the 48 check-runs on this head (26 success, 22 skipped, none red, none pending). Newly cited code was read on main at a5ddeb6e.

① Derived judgments

  • The delta itself. One commit, a fast-forward from bce0263d, touching the record alone (148 lines added, 52 removed). The index blob is identical on both heads. No accept set moves and no public surface changes. Right.
  • Attribution moved; no rule moved. Every quoted line in the record (both rulings and the seat's L4 text) is byte-identical on the two heads. What changed is whose each part is said to be. Right.
  • The member read grant is called what it is, a new rule on the member baseline. Right.
  • Immutability is narrowed to a unit row. Right: that is what the platform can hold once delete is allowed and a deleted sys_* row frees its unique value at once (ADR-0148).
  • Five new Open items, none settling anything. Items 8 and 10 put a ruling ahead of the card; items 9, 11 and 12 name the card. Items 2, 4 and 6 each gain a question for their card. Right. No later card is committed to anything it was not committed to on the earlier head.

② Semver level

Unchanged. skip-changeset matches the diff, Check Changeset is skipped on this head, and Clause-②: no on the PR body is right: the delta narrows nothing a package publishes.

③ Boundary flags

Dev flags, from report 7005510172:

  • A fresh worktree under another local branch name, pushed to the PR's branch: answered. The head's one parent is bce0263d, the commit is one author's, and the remote branch is the PR's.
  • S2 and S4 closed as Open items for their cards instead of as seat settlements: answered under ④; both are acceptable closes.
  • Wording beyond the review's literal items (L3's "a code on the row"; the titles of Open items 2, 4 and 6): answered. Each follows from a closure and settles nothing.
  • N5 posed as a question, without the claim about the currency cell: accepted. The claim came from the header of packages/spec/src/data/field-scale.ts, not from the renderer, and the question loses nothing without it.
  • Pushed before the gate sweep: accepted, it is the repository's rule.
  • Not merged with main: answered. The check-runs on this head are green; main has not touched docs/adr/ since the PR's base; of the eighteen source files the record cites, three moved on main since the earlier record's read (field.zod.ts, object.zod.ts, record-currency-aggregate-door.ts), all in the admission of a dynamic roll-up, which no claim here reads; recordCurrencySummaryRefusal is still there.
  • open_questions, two entries, both escalated as E2: Open item 8 (a unit code with no quantity beside it) and Open item 10 (decimal places for a standard code). The dev picked neither, and neither is a reviewer's to pick.
  • security_findings: none: stands as a statement about defects; see the security line.

SQL push-down: unchanged. The delta declares no query, no id materialisation and no in-app join.

Escalations:

  • E1: answered in the tree. Only option A 「可改,只影响以后」 is carried as the maintainer's pick. One sentence added for it is the seat's to sign, since nothing on GitHub shows the card: "Those words are the maintainer's whole text on the card" (N10).
  • E2: stands, to the maintainer through the seat. Open items 8 and 10 each owe a ruling. Item 10 has a card whose start forces it (R1's display). Item 8 has none: every R1 member reaches a unit field through a quantity, so without a carrier the question rests by default at "the declaration stays on the quantity". L2's deferral cites its carrier, units of measure: translate organization-added unit labels (deferred by the units ADR, 2A) #35404; these two cite none. The seat puts both on the handoff or files a decision card for each.
  • E3: closed. The title now reads "records ruling U1–U8 and settles L1–L4", which is what the tree holds.
  • E4, new, to the seat. Comment 7003532733 on the card is still headed a maintainer ruling record and lists the recompute, the delete and 2A under "Picked". The record now reads that comment down, in so many words ("records 2A as picked on the same card; beyond those words it is the seat's settlement"). A later seat searching prior rulings finds the comment first. A dated correction under it on the card, saying which part is the maintainer's, makes the two agree. No head moves.
  • Overlap with docs(adr): ADR-0157 working calendars are organization-editable runtime data, resolved by code or refused #35364 on the index: unchanged. Whichever lands second regenerates it.

④ Design judgment

docs/adr/0158-…md. Every closure below was read in the tree at this head, not taken from the report.

No must-fix, no should-fix.

  • S1: closed. L3's object door now says such a field "is left outside this door", its master_detail bullet says a material's own unit "may have no quantity beside it", and Open item 8 states the gap, the currency contrast (sys_exchange_rate's own currency field) and that a ruling is owed. An Open item is the right close here. The finding was the record's silence, and the answer widens U4, so the record cannot give it. The carrier is E2's.
  • S2: closed. Open item 9 names the three cases, both precedents with their files, the third shape and what it does to R1's rollout, and the Consequences line on delete points to it. Routing it to the membership card is acceptable on this head for a reason the earlier head lacked: "a new save with that code is refused" is now the seat's settlement, so fixing its reach reads no ruled text down. The item still leans ("That needs a third shape") while saying "not settled here"; the card may answer otherwise and say why.
  • S3: closed. Open item 10 states the conflict between U3 and U6, names KGM and H87, names R1's display as first reader and says a ruling is owed; L4 points to it. An Open item is the right close: two ruled clauses meet, and the display card cannot start on a standard code until one is read.
  • S4: closed. L1's part list says immutability "holds for a unit row; it does not hold across a delete and a new create of the same code", Consequences is narrowed to "A unit row's code and dimension cannot change after create", and Open item 11 gives the sys_unit card its two outcomes with the ADR-0148 text quoted exactly. Routing it to the card is acceptable: delete and immutability are both the seat's settlements now, so the seam between them is the seat's lane to close.

N1 to N8 are folded where the PR body says; each was read in the tree. N1: the immutability bullet is marked the seat's technical item. N2: the mirror table has the row for D5's third bullet and D7 parameter 2. N3 and N6: Open item 4. N4: Open item 9. N5: Open item 6. N7: Open item 12, with the pointer from the backfill row. N8: the heading under U3, Open item 2 and the sys_unit line of Consequences.

New at this head, nits only:

  • N9 (nit) — "per the analysis recommendation" appears six times and the record never says which analysis. The only analysis it defines is the card's body (Provenance item 3), which recommends none of these parts. Comment 7003532733 names the one meant; say so once.
  • N10 (nit) — The record now writes "the maintainer's own words" and "the maintainer's whole text on the card" for what its own L1 line calls "option A". A picked option's label is the card's wording, chosen by the maintainer. "The option the maintainer picked reads …" claims no more than is known.
  • N11 (nit) — The Open items lead gives one test for owing a ruling (a card cannot settle it "without reading ruled text down") and then leaves every other item to its card. Item 5 says of itself "Whichever R2's card picks is a reading of 「可改,只影响以后」". By the lead's own test it is of the same kind; either item 5 says R2's card takes it to the maintainer, or the lead's test is stated narrower.
  • N12 (nit) — Open item 4 hands the direction of U1's ratio to R2's card, but Open item 1's card writes the ratio values first. Whichever lands first fixes the direction; item 1 is where it is needed.

Settlement items by name, with their marking on this head:

  • Marked the maintainer's pick: 1A-core (a ratio may be edited at any time and an edit affects later writes only; stored rows keep their quantity and factor).
  • Marked "Settled by the seat, per the analysis recommendation": 1A-recompute; 1A-admin-audit; 1A-ui-sentence; L1-delete; 2A-one-label (one label per org unit, translation deferred to units of measure: translate organization-added unit labels (deferred by the units ADR, 2A) #35404, per-locale labels for standard codes shipped by the platform).
  • Marked "Settled by the seat, as a technical item": L1-immutable, now limited to a unit row.
  • Marked "the owning seat's settlement": L3-keys; L3-number-only; L3-no-marker, now with its gap declared (Open item 8); L3-no-numeric-top-level; L3-no-parent-follow; L4-scale; U3-member-read, now named a new rule; U3-label; OI4-two-names.
  • Open, a ruling owed first: OI8-unit-code-without-quantity; OI10-standard-code-decimals.
  • Open, for a card: OI5-edited-old-row (R2's card; the item says it is a reading of the pick, see N11); OI9-which-writes-u5-judges (membership card); OI11-deleted-code-created-again (sys_unit card); OI2-write-grants (sys_unit card); OI12-backfill-and-raw-aggregates.

docs/adr/README.md. Untouched by the delta and still current: the generator reads the start of the Status line, which did not move. It holds; no finding.

Nits alone end the round. A fix for any of N9 to N12 moves the head and is covered by no record until one names that head.

Implemented-by: claude/issue-35339-uom-adr
Reviewed-by: isolated-l2-35370

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

维护者速读

  • 用户能看到什么变化:暂时没有;这是一份设计记录(ADR-0158 计量单位),定下单位可由组织编辑、换算比只影响以后的写入,后续卡按它施工。
  • 为什么做:把你在 Units of measure on the platform: a standard unit list, quantity fields that carry their unit, and conversion #35339 上选的「可改,只影响以后」写成正式决定,并把实现细节分成已定项和待定项。
  • 出错会怎样:只是文档,合入不改任何行为;有误改 ADR 即可。还有两处待你定(只有单位代码没有数量的字段能否声明单位;标准单位的小数位设在哪里),会另外给你卡片,不阻塞本 PR。
  • 要你做什么:审阅并合入(ADR 由维护者合入)。合同评审两轮记录见下。

席位核对 — ACCEPT · repo:objectstack#5 · head db734f1d91390a35b4d42bc49a4b91a6afd30c61 · 2026-11-19T09:55Z

  • Shape: 2 files (docs/adr/0158-…md, docs/adr/README.md), +586/−4 against the merge base. Fixes-free: card Units of measure on the platform: a standard unit list, quantity fields that carry their unit, and conversion #35339 stays open for the two maintainer questions. skip-changeset, Clause-②: no, Metadata-protocol: none.
  • Contract review: round 1 PASS 7005127062 with S1–S4 and Security-touching: yes; delta PASS at this head (posted just above this record), S1–S4 closed by id, nits N9–N12 only. Every check-run on this head finished: 26 success, 22 skipped, 0 failed.
  • E1 signed: the sentence "Those words are the maintainer's whole text on the card" is true. 「可改,只影响以后」 is the label of the option the maintainer picked on the seat's decision card (2026-11-19 08:11Z); he wrote nothing else on it.
  • Settlements adopted by name as the seat's: 1A-recompute, 1A-admin-audit, 1A-ui-sentence, L1-delete, 2A-one-label, L1-immutable (a unit row only), L3-keys, L3-number-only, L3-no-marker, L3-no-numeric-top-level, L3-no-parent-follow, L4-scale, U3-member-read, U3-label, OI4-two-names. None struck. 1A-core is the maintainer's pick.
  • Owed to the maintainer: OI8-unit-code-without-quantity and OI10-standard-code-decimals, each as its own decision card after one analysis. Until ruled, OI8 rests at "the declaration stays on the quantity".
  • Owed to cards: OI5 (R2), OI9 (membership), OI11 and OI2 (sys_unit), OI12.
  • Accepted deviations: nits N9–N12 not taken; E4 (a dated correction under 7003532733 on Units of measure on the platform: a standard unit list, quantity fields that carry their unit, and conversion #35339) is a card comment, not a head change.
  • Landing clause: Tier H (docs/adr/**). K = 9 first-parent commits on main since merge base adcb9f8e (< 15). Overlap: docs(adr): ADR-0157 working calendars are organization-editable runtime data, resolved by code or refused #35364 (ADR-0157) also regenerates docs/adr/README.md; whichever lands second merges main and re-runs adr:index. This stroke: reviewers os-zhuang, hotlong; pm:awaiting-merge + security. A human merge is the review record.

@objectstack-fleet objectstack-fleet Bot added pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue security labels Nov 19, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 19, 2026 09:57
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 35bd360 Nov 19, 2026
59 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-35339-uom-adr branch November 19, 2026 10:23
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 19, 2026
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 security size/l skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Units of measure on the platform: a standard unit list, quantity fields that carry their unit, and conversion

3 participants