You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Units of measure R1: a number field declares its unit (unitConfig) and the write path checks the unit code #35489
Units of measure, release R1 (ADR-0158 U7). Parent: #35339. The ADR is the governing text: ADR-0158 (merged PR #35370, 35bd360). Filed on seat 5's word, 2026-11-19.
What to build
U4 / L3:unitConfig: { unitMode, unit, unitField, unitDimension } on a number field. fixed is checked at build against U1. record points at a sibling text field holding each row's code: exact uppercase, a code and never an id, with no master_detail follow. The value stays a bare number.
U5: an asynchronous write-path check admits a code that is in U1 or in the organization's sys_unit rows. It is not the valueDomain predicate, which stays pure.
unitConfig is declared and pinned (fixed checked at build; record pointer to a sibling text field). U5 refuses a non-member code with the OI3 code and admits a U1 code and an org code. OI9's three cases are pinned. ADR-0158 is amended.
Carried to this card from PR #35581 (#35488) · 2026-11-19T17:29Z
Seat 5's contract review of PR #35581 (7016785755, PASS) defers two refusals to this card, the first reader of sys_unit. It requires them written here before #35581 lands. Add them to this card's done-when:
Also from that review, for the first reader: N4 — ask membership of STANDARD_UNITS through one exported own-property lookup, so that an inherited name never reads as a member.
Both readings behind items 1 and 2 (retire as L1's delete; the engine refusal carried here) are for the maintainer to confirm when approving #35581. If he rules otherwise, this comment is amended.
Design requirements carried in before claim · 2026-11-20T04:04Z
Area: d7-D. Seat 5's split notice 7016816929 (mailbox #35558) leaves these to this card; they extend 7016814814 above and join this card's done-when. They are conditions of PR #35581's reading 2 (contract review 7016785755), so they are not optional.
The engine refuses to delete a sys_unit row in every context: user, system and automation.enable.apiMethods and Setup close only the data API and the UI; a delete issued to the engine frees the unique code, which could then be re-created with another dimension, and ADR-0158 Open item 11 (settled: "a deleted code stays retired") forbids exactly that. Candidate mechanism, not verified: an explicit sys_unit row on organization_admin with allowDelete: false, as sys_audit_log has, plus a beforeDelete refusal that also holds under a system context. Pin: a real-stack cell showing the refused delete, single and batched.
A row with retired: true is not a member. U5's membership check reads only the organization's non-retired sys_unit rows, so a retired code is refused on a new save (L1's delete bullet). This makes precise the words "the organization's sys_unit rows" in the OI9 settlement on Units of measure: decide which writes the unit membership check judges (ADR-0158 Open item 9) #35467 (7013996288), which stands otherwise unchanged.
Nit N4: membership of a standard code is answered through one exported own-property lookup on STANDARD_UNITS (a plain object frozen one level deep), so an inherited name such as toString never reads as a member.
Claim: PM loop round 2 · card thread d7-D · 2026-11-20T07:20Z
Ordered by: seat 7, 2026-11-20T04:07Z: claim #35489 in d7-D once #35739 is with L1-a, one xhigh dev at a time
Area: d7-D
Session: session_01L9qibvMi1U7R2kBd3JbTPu
Account: os-tesla
Branch: claude/project-thread-dr6px1 (the one branch this thread can push; it is pushed only after PR #35739, now in the merge queue, has merged, and it restarts from main then)
Worktree: objectstack-issue-35489
Domain: domain:server
Seat: repo:objectstack#7
File surface: packages/spec/src/data/field.zod.ts and its neighbours (the unitConfig key and the OI8 unit-marker key on a field, its build-time checks against STANDARD_UNITS, standard-units.ts for the N4 own-property lookup), packages/spec error-code ledger rows for the OI3 refusals, packages/objectql/src/** (the U5 asynchronous write-path membership check and the engine-side sys_unit delete refusal), packages/platform-objects/src/system/sys-unit.object.ts and the organization_admin permission rows, their tests, the generated spec artefacts the generators rewrite, the liveness ledger row, and root .changeset/. ⛔ No docs/adr/** in this PR: the ADR-0158 amendment (U4, OI3, OI6 first half, OI8, OI9) follows as its own Tier H PR after this one lands. Stop on breach and report.
Container & model: L, mode:subagent, model: default — dispatch-gates --tier at d1ebe86dd3: "no path-derived mandate"; contract (L2) review at CONTRACT_REVIEW_TIER per contract-review.md, effort: xhigh (contract surface plus engine write path; seat 7's word, 2026-11-20T04:07Z)
Clause-②: yes
Metadata-protocol: added
Responsibility: n/a — not a defect card
Thread-read: 7030061316
Premise: holds — at d1ebe86, git grep unitConfig -- 'packages/*/src/**' has 0 hits; STANDARD_UNITS (packages/spec/src/data/standard-units.ts:123) and sys_unit with its retired flag (packages/platform-objects/src/system/sys-unit.object.ts) are on main from #35488 (PR #35581, 7411f9b)
Serial constraints cleared: none. The unit sibling cards #35490#35491#35492#35498 and the settled open items #35467#35468#35469 are all pm:blocked with no assignee; no open PR names units of measure. The file surface's last change is 7411f9b (merged); same-day churn: none.
Scope-review: exempt — the route is ruled: ADR-0158 accepted (ruling records 7001193034 and 7003532733 on #35339), OI8 ruled A on #35339 (「可以单独声明」), OI9 settled on #35467 (7013996288)
Pre-claim lane: area:data seat 7 (#35557), which holds every area:data card outside seat 5's in-hand set (maintainer, 2026-11-19T15:33Z: 「5号只处理在手任务」)
Pre-claim deps: Blocked-by: #35488 is closed (PR #35581 merged 7411f9b)
Prior rulings read: ADR-0158 → 7001193034 (「先不考虑 hotsrm,先处理平台任务,你的意见我同意」), 7003532733 (L1 「可改,只影响以后」), OI8 A 「可以单独声明」; the design requirements on this card, 7016814814 (seat 5) and 7030061316, join the done-when
{
"issue": 35489,
"status": "done",
"branch": "claude/project-thread-dr6px1",
"pr": "https://github.com/objectstack-ai/objectstack/pull/35805",
"session": "session_01L9qibvMi1U7R2kBd3JbTPu",
"premise_still_valid": true,
"summary": "Built ADR-0158 R1's membership card as draft PR #35805 (Part of #35489, head 91a4947352): `unitConfig` on a field as a discriminated union of three closed shapes (`fixed` / `record` on a `number`, the Open item 8 `code` marker on a `text`), the object door's pointer refusals, and N4's one own-property lookup `standardUnitOf`. The engine judges every stored unit code at insert, by-id update, predicate update and the validate() preview (Open item 9's three cases, a retired row no member, the dimension restriction), with four 400 codes in the ledger. The engine refuses a `sys_unit` delete in every context before any middleware (405 ERR_UNIT_DELETE_REFUSED), and organization_admin names sys_unit explicitly with no delete. No docs/adr/**, ui/**, backfill door, aggregate refusal or decimal-places setting is touched; I wrote no card assignee (the PR carries the claim's Account, os-tesla).",
"tests": "Final tree a37e623808 (gates and reruns at 168c65a692; 91a4947352 is the same tree with the commit messages reworded). New: spec field-unit-config.test.ts 62/62; objectql unit-code-membership.test.ts + engine-unit-code-membership.test.ts + federated-injected-column-readers.test.ts 65/65; plugin-security default-permission-sets.unit-of-measure.integration.test.ts 23/23 (real stack), VERDICT command-exit 0. Package runs under the lock: spec 866 files / 27781 passed / 1 todo (exit 0); objectql 620 of 621 files, the one red the federated census missing this PR's new seam row, added and green on rerun 5/5, typecheck exit 0; plugin-security 284 files / 7068 passed / 45 skipped, typecheck exit 0; metadata-core 27 files / 1045 passed + typecheck exit 0; driver-sql 266 files (13 skipped) / 4438 passed + typecheck exit 0; platform-objects 125 files / 2092 passed, typecheck exit 0; metadata-protocol degenerate-derivation 18/18. Ablations, both committed first, via scripts/ablation-replace.mjs, the engine suite importing src/ (no dist leg): (1) delete the `refuseOrganizationUnitDelete(object);` line in engine-delete-and-aggregate.ts, anchor 1 to 0, blob 0f0fd66a5919 to d1a6c4760fff, engine-unit-code-membership.test.ts 3 failed / 15 passed (system, user, no-context cells; other-object control green), restored blob == HEAD, git diff HEAD empty; (2) short-circuit the insert path's assertUnitCodes call in engine-insert.ts, blob 58ab1cbe7870 to e037c24b57a0, 7 failed / 11 passed (every insert refusal and the insertMany cull), restored blob == HEAD. Direction observed: red, as predicted, both legs.",
"gates": "Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` (130 commands, unchanged on re-derivation at 168c65a692), all run on the final tree with exit codes captured before any pipe: 130 of 130 exit 0. Reconciliation: `Run reconciliation — 130 derived, 130 run, 0 NOT-MEASURED, 0 UNRUN.` / `✓ dispatch-gates --ran: 130 derived famil(ies) accounted for — 130 run, 0 NOT-MEASURED (a DERIVED zero — all 130 recorded an exit code and none of them is 3).` First sweep (tree before the last three commits): check:variant-docs exit 1 (undeclared unitMode union, then declared in variant-docs.json, rerun exit 0) and exit 3 prerequisites for check:skill-examples, check:dual-build-cjs-loads, check:i18n, all exit 0 in the final run. check-changeset-no-major --base origin/main --event (this PR body) exit 0, LEVEL AXIS green. Local-only: check:skill-frame-freshness exit 0; check:dev-prereqs exit 1 (35 of 108 packages unbuilt, named ones under ui/: container state, not the diff). test:repo not run (no test added to that project). CI check-runs on #35805: in_progress at report time, not awaited (the seat reads them).",
"dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
"mcp_calls": "2 — mcp__github__pull_request_read (method get, PR #35739), twice, read-only; no write tool",
"api_writes": "3 REST writes, all through the fleet-write relay (each stroke a POST /repos/objectstack-ai/objectstack/dispatches): POST /repos/objectstack-ai/objectstack/pulls (draft #35805), POST /repos/objectstack-ai/objectstack/issues/35805/assignees (os-tesla, the claim's Account), POST /repos/objectstack-ai/objectstack/issues/35489/comments (this os-dev-report, via post-stamped.mjs). Plus one git push (not REST).",
"open_questions": [
{
"question": "An organization that holds any sys_unit row can now never be deleted: refuseOrganizationDeleteWhileOwned counts sys_unit (DELETE_RESTRICTED), and the engine refuses every unit delete. Which way should units meet the organization delete?",
"options": [
"A: sys_unit outlives its organization (join the outlivesOrganization set). Cost: orphaned unit rows of a deleted organization stay at rest; effort small (one row plus a pin).",
"B: the organization delete removes its units as the one exemption to the refusal (the cascade claim, never a caller flag). Cost: one narrow engine exemption beside a refusal that otherwise holds in every context; effort small to medium (exemption, real-stack cell).",
"C: keep: an organization with units is refused loudly until a card asks. Cost: none now; tenant offboarding with units is blocked."
],
"recommendation": "B, on a follow-up card: business need, an organization delete is a real offboarding door and today it is refused with no remedy; soundness, Open item 11 forbids re-creating a code with another meaning inside an organization, which a deleted organization can never do, so the invariant holds; AI-safety, the exemption is the engine's own cascade, not a consumer tolerance; startup scope, C is the honest default if no deletion with units is pulled yet."
},
{
"question": "Open item 9 point 7 left to this card: should the metadata save that declares unitConfig over stored free text answer a destructive-change finding, as currency_mode_to_record does?",
"options": [
"A: yes, shipped with #35492 (the backfill door), naming that door as its remedy, in the same Version Packages release point 7 already requires.",
"B: yes, in this PR, with no remedy to name yet (the door does not exist), and reworded when #35492 lands.",
"C: no finding: the write refusal alone teaches it."
],
"recommendation": "A, because the precedent finding's substance is the remedy it names (recordCurrencyCodeBackfillRemedy), it sits in metadata-protocol outside this claim's file surface, and point 7 already ties both cards to one release, so no release carries the tightened write without both."
}
],
"security_findings": "none",
"out_of_scope_findings": [
"carrier: #35492 · Open item 9 point 7: the unit refusal names no backfill door yet, and the destructive-change finding over stored free text (open question 2) belongs with that door · noted, not filed",
"carrier: objectstack seat (repo:objectstack#7) · the ADR-0158 amendment text (field adr_amendment), shipped as its own PR after #35805 lands · noted, not filed",
"carrier: seat (the Skills-docs line on #35805) · skills/objectstack-data/rules/field-types.md, skills/objectstack-data/evals/objects-fields-relationships.json, skills/objectstack-project/references/platform-catalog.md teach no unitConfig yet · noted, not filed",
"carrier: none · a record pointer declared by an object extension is not judged by the object door, the same reach as currencyField's; observation only, no public-door reproduction measured · noted, not filed"
],
"deviations": [
"Commit trailers first carried the model name (Co-Authored-By: Claude Opus 5.5); the pre-push check:commit-card-trailers refused the push, and the eight unpublished commits were re-created with git commit-tree under the model-free pair, trees and parents preserved (tree a37e623808 before and after, git diff empty), before the first push.",
"No empty branch was pushed first: the dispatch's push gate held every push until #35739 merged. The push target claude/project-thread-dr6px1 no longer existed on the remote (deleted on merge), so a plain push created it; no --force-with-lease was used.",
"Files outside the dispatch's expected landing zone, each forced by the new key's own gates or tests and carrying no behaviour: metadata-core object-schema-fls-references.ts (unitConfig: keep), driver-sql builtin-column-collision.ts (unitConfig: presentation), the metadata-protocol degenerate-derivation count, packages/spec/variant-docs.json, and generated content/docs/references/** and docs/audits/** counts.",
"The pin sweep renamed one test title in platform-objects (sys-unit.object.test.ts) that named the wildcard grant the explicit sys_unit line replaced."
],
"adr_amendment": "ADR-0158 amendment proposed by #35489 (for the seat's own PR; every note dated the day it lands)\n\n[1] L3, replace the settled code block and add three bullets after \"Cross-refusals\":\n\n unitConfig:\n | { unitMode: 'fixed'; unit: 'KGM' } // on `number`: one U1 code, exact uppercase, checked at build\n | { unitMode: 'record'; unitField: 'unit_code'; unitDimension?: 'mass' } // on `number`: one segment, a sibling `text` field\n | { unitMode: 'code'; unitDimension?: 'count' } // on `text`: Open item 8, the field holds a unit code itself\n\n- **Shipped as a discriminated union of three closed shapes** (`packages/spec/src/data/field.zod.ts#UnitConfigSchema`).\n The discriminator is required, so each mode's keys are its variant's and the rule reaches the published JSON\n Schema as a `oneOf`; `currencyConfig` cannot take this form because its discriminator has a default. A key of\n another mode is refused with guidance naming the mode it belongs to; `mode`, `defaultUnit`, `unitCode`, `code`,\n `uom`, `field`, `codeField` and `dimension` inside the config are answered with their spelling here.\n- **Which type carries which mode**: `fixed` and `record` on a `number`, `code` on a `text`; every other type is\n refused, `currency`, `formula` and `summary` included (U8: no reader). A bare `unit`, `uom`, `unitCode` or\n `dimension` key on a field is refused with guidance naming `unitConfig`.\n- **The object door** (`packages/spec/src/data/object.zod.ts#refuseDishonestRecordUnitField`, beside the currency\n one) refuses a `record` pointer that names no declared field, names its own field, names a field that is not\n `text`, names a field that carries its own `unitConfig` (\"the pointer is the declaration\"), or holds a dot (the\n `master_detail` path this record does not admit; \"a child cannot follow its parent's unit yet\"), and refuses two\n quantities that share one unit field with different `unitDimension` values.\n\n[2] Open item 3, add:\n\n*Note (DATE):* settled on the membership card (#35489), one code per remedy as `ERR_HOME_CURRENCY_UNSET` beside\n`ERR_CURRENCY_CODE_REQUIRED` is, each registered in the ADR-0112 ledger under `@objectstack/objectql`:\n`ERR_UNIT_CODE_REQUIRED` (a quantity beside a blank code), `ERR_UNIT_CODE_UNKNOWN` (a code that is neither a U1 code\nnor one of the organization's units, the exact-uppercase spelling named when only the case differs),\n`ERR_UNIT_CODE_RETIRED` (L1's \"a new save with that code is refused\"), `ERR_UNIT_DIMENSION_MISMATCH` (a member of\nanother dimension than the declared `unitDimension`), all 400; and `ERR_UNIT_DELETE_REFUSED`, 405, the status the\ndata door already answers for the same verb on `sys_unit`, the suffix following `EXTERNAL_WRITE_REFUSED`. U7 R1's\naggregate refusal and U7 R2's no-ratio refusal stay with their cards (#35491, R2).\n\n[3] Open item 6, add:\n\n*Note (DATE), first half:* settled on the membership card (#35489). A number field that declares `unitConfig` needs\nno `scale`, and may keep one. ADR-0144's precedent is that a currency's decimal places are the currency's, not a\nfield setting (ruling 5805782503, `field-currency-scale-refused.test.ts`); it never required a scale. A unit's own\ndecimal places are U6, which R1 does not ship (#35498), so R1 has nothing a required scale would serve; a declared\n`scale` stays what L4 names it, the ceiling. The display half stays with R1's display card.\n\n[4] Open item 8, add:\n\n*Note (DATE):* ruled A on #35339 (「可以单独声明」, 7008524997) and built on the membership card (#35489). The marker\nis `unitConfig: { unitMode: 'code', unitDimension? }` on a `text` field: the third member of the one unit key, not\na fourth value domain (U1 keeps `ValueDomainSchema` at three members), because the membership it asks is\nasynchronous and reads `sys_unit` rows, which no pure value-domain predicate can. Precedent: the L3 key family\n(`unitConfig` / `unitMode` mirroring `currencyConfig` / `currencyMode`), and the word \"code\" from U4 (\"the row\nstores the code\") and `sys_unit.code`. It is refused beside a `valueDomain`, and on a field a quantity's\n`unitField` names (L3: \"the pointer is the declaration\"). U5 judges it whenever it is written (Open item 9 point 6);\nthe picker (#35490) and the backfill (#35492) reach it.\n\n[5] Open item 9, add:\n\n*Note (DATE):* settled by the seat on #35467 (7013996288) and built on the membership card (#35489,\n`packages/objectql/src/validation/unit-code-membership.ts#assertUnitCodes`), at insert, by-id update, predicate\nupdate and the `validate()` preview, after the currency-code check:\n- the row image is judged whenever the write carries the quantity or its unit field; a write touching neither is\n not judged (ADR-0113 D1);\n- case 1: a written code is a member only if it is a U1 code (one own-property lookup, `standardUnitOf`) or a\n non-retired `sys_unit` row of the row's organization, in exact uppercase, never folded;\n- case 2: a non-blank quantity written beside a resting code that is no longer a member is refused, and the message\n names the field, never the stored value;\n- case 3: a quantity beside a blank code is refused (`ERR_UNIT_CODE_REQUIRED`, ADR-0144 D8 rule 4); a blank\n quantity needs no code;\n- point 5: under `unitDimension` a member of another dimension is refused; a unit field shared by two quantities\n is judged by the restriction either declares (L3 refuses two different ones);\n- point 6: a standalone `code` field is judged as a unit field with no quantity, under its own `unitDimension`;\n- point 7: the refusal's guidance does not yet name the backfill door, which #35492 adds; whether the metadata save\n that declares `unitConfig` over stored free text answers a destructive-change finding the way\n `currency_mode_to_record` does is carried with that door (the precedent finding's substance is the remedy it\n names), so both land in one Version Packages release.\nThe organization's units are read once per organization per write, with an explicit `organization_id` predicate\nunder a minimal system context that keeps only the caller's transaction and trace id, and never for a write whose codes are all\nstandard.\n\n[6] Open item 11, add (optional, the delete half the card carried):\n\n*Note (DATE):* the engine refuses a delete of a `sys_unit` row in every context, a system writer and an automation\nrun included, by id and batched (405 `ERR_UNIT_DELETE_REFUSED`, before any middleware or hook), and\n`organization_admin` names `sys_unit` explicitly with no delete bit, as `sys_audit_log` is named (#35489).\n",
"precedents": [
"unitConfig, unitMode, unitField: currencyConfig, currencyMode, currencyField (ADR-0144; L3 settled by the owning seat)",
"unit (not defaultUnit), unitDimension (not dimension): L3's own settlement",
"values fixed and record: currencyMode's values, same meaning (L3)",
"value code, the Open item 8 marker: the L3 key family, the word code from U4 (the row stores the code) and sys_unit.code; a marker, not a fourth value domain (U1)",
"standardUnitOf: N4 (7016814814, 7030061316), the spec's NAME-Of lookup naming (recordCurrencyFieldOf, fixedInnerReadOf)",
"ERR_UNIT_CODE_REQUIRED: ERR_CURRENCY_CODE_REQUIRED (ADR-0144 D8 rule 4)",
"one code per remedy: ERR_HOME_CURRENCY_UNSET beside ERR_CURRENCY_CODE_REQUIRED",
"ERR_UNIT_CODE_UNKNOWN: the SUBJECT_UNKNOWN form of FILTER_TOKEN_UNKNOWN, STACK_CAPABILITY_UNKNOWN",
"ERR_UNIT_CODE_RETIRED: sys_unit's one-way retired flag (Open item 11, L1)",
"ERR_UNIT_DIMENSION_MISMATCH: the SUBJECT_MISMATCH form of ERR_BULK_RESULT_MISMATCH, EXTERNAL_SCHEMA_MISMATCH",
"ERR_UNIT_DELETE_REFUSED, 405: the data door's 405 for the same verb on sys_unit (apiMethods without delete); the REFUSED suffix of EXTERNAL_WRITE_REFUSED",
"organization_admin's explicit sys_unit line with allowDelete false: sys_audit_log's explicit line",
"Open item 6 first half (no scale required): ruling 5805782503 and field-currency-scale-refused.test.ts (a currency's decimals are the currency's, never a required scale); L4 (scale is the ceiling)"
],
"oi9_pins": [
"packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 1: refuses a code that is no member, ERR_UNIT_CODE_UNKNOWN / 400 on the code field",
"packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 1: refuses %j, never folded, naming the exact spelling",
"packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 2: refuses the quantity edit beside a retired code, naming the field and never the stored value",
"packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 3: refuses a quantity beside the code %j, ERR_UNIT_CODE_REQUIRED / 400",
"engine seams: engine-unit-code-membership.test.ts :: a quantity edit beside a resting non-member code is refused (case 2), the row unchanged; clearing the code beside a resting quantity is refused (case 3)",
"real stack: default-permission-sets.unit-of-measure.integration.test.ts :: refuses a retired unit (Requirement 2), a mis-cased code, a code of another dimension and a quantity with no code: 400, nothing stored"
],
"delete_refusal": {
"mechanism": "refuseOrganizationUnitDelete(object) in packages/objectql/src/engine-delete-and-aggregate.ts, right after assertWriteAllowed and before any middleware, hook or driver call, throws UnitDeleteRefusedError (code ERR_UNIT_DELETE_REFUSED, status 405) for object sys_unit, whatever the context and whether by id or multi. Plus organization_admin names sys_unit explicitly (allowRead, allowCreate, allowEdit true, allowDelete false, no modifyAllRecords), so the effective permissions offer no delete. The candidate beforeDelete hook was not used: the security middleware and hooks are bypassed or skippable under a system context, the engine-level check is not.",
"real_stack_cell": [
"an organization administrator: refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored",
"an organization owner: refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored",
"a member: refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored",
"a system writer ({ isSystem: true }): refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored",
"a system automation run (svc:flow, runAs system): refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored",
"the administrator's effective permissions offer no delete on units, and keep create and edit"
]
},
"gate_reconciliation": "Run reconciliation — 130 derived, 130 run, 0 NOT-MEASURED, 0 UNRUN.",
"head_sha": "91a494735288e000a7259b2009567ef498473d5d",
"owed_reviews": "L1 and L2 (contract review at CONTRACT_REVIEW_TIER) are owed; not run by me."
}
Claim amendment: claim 7033168211, the file surface only · 2026-11-20T09:46Z
Branch: claude/project-thread-dr6px1 (PR #35805, head 91a4947)
File surface (added): the ripple files a new field key forces, each a classification with no behaviour of its own (L1 ACCEPT 7036343182):
packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts (the count)
packages/plugins/plugin-security/src/objects/default-permission-sets.ts (the explicit organization_adminsys_unit line the claim names) and packages/plugins/plugin-security/src/default-permission-sets.unit-of-measure.integration.test.ts (the real-stack cell)
the generated content/docs/references/** pages and docs/audits/2026-07-unknown-key-strictness-ledger.counts/data.md
Everything else in the claim stands unchanged.
{
"issue": 35489,
"status": "done",
"branch": "claude/project-thread-dr6px1",
"pr": "https://github.com/objectstack-ai/objectstack/pull/35805",
"session": "session_01L9qibvMi1U7R2kBd3JbTPu",
"premise_still_valid": true,
"round": "fix round on the L2 contract review 7036451051 (PASS, S1 and S2 should-fix; N1 and N2 folded in; N3 and N4 left as accepted deviations, unchanged)",
"summary": "One fix commit 44bf630f1e on top of 91a4947352, pushed as a fast-forward (no force). S1: on a quantity-only edit beside a resting code, the ERR_UNIT_CODE_UNKNOWN refusal no longer offers the stored code's corrected spelling or the piece, and ERR_UNIT_DIMENSION_MISMATCH no longer prints the stored code's dimension; the field is named, as the retired path does, and a written code is still answered with both. S2: the object door refuses a record quantity's unitField naming a text field that declares a valueDomain, at fields.QUANTITY.unitConfig.unitField, and no longer offers such a field as a candidate. N1 fixes the field.zod.ts docblock's test-file name; N2 rewords the code-beside-valueDomain message to say why the pairing is refused (two vocabularies for one column; MMK is in both), not that no value satisfies both.",
"fix_commit": "44bf630f1e4704727471be06f8f0e3108c964194",
"fix_files": [
"packages/objectql/src/validation/unit-code-membership.ts",
"packages/objectql/src/validation/unit-code-membership.test.ts",
"packages/spec/src/data/field.zod.ts",
"packages/spec/src/data/object.zod.ts",
"packages/spec/src/data/field-unit-config.test.ts"
],
"head_sha": "44bf630f1e4704727471be06f8f0e3108c964194",
"new_tests": [
"objectql unit-code-membership.test.ts :: OI9 case 2: refuses the quantity edit beside a resting %j, ERR_UNIT_CODE_UNKNOWN / 400, printing neither the stored code nor its corrected spelling (kgm, ' KGM', ea, c62; each with a written-code control that still gets the correction)",
"objectql unit-code-membership.test.ts :: OI9 case 2: refuses the quantity edit beside a resting %s of another dimension, ERR_UNIT_DIMENSION_MISMATCH / 400, printing neither the code nor its dimension (MTR length, BOX_12 package; each with a written-code control naming the dimension)",
"spec field-unit-config.test.ts :: refuses a pointer into a `text` field that declares `valueDomain: %s`, at `fields.weight.unitConfig.unitField`, and offers no such field as a candidate (iso_4217_currency, iso_3166_alpha2, iana_time_zone; each with a parse-green control pointing at the plain sibling)",
"spec field-unit-config.test.ts :: renamed and strengthened: refuses a unit code field that also declares a `valueDomain`: two vocabularies for one column, not an empty one (was: no value satisfies both)"
],
"tests": "At 44bf630f1e, under the lock: focused suites objectql unit-code-membership + engine-unit-code-membership 66/66 (was 60), spec field-unit-config 65/65 (was 62); package runs spec test 866 files / 27784 passed / 1 todo, spec typecheck, objectql test 621/621 files / 14044 passed, objectql typecheck, plugin-security real-stack cell default-permission-sets.unit-of-measure.integration.test.ts 23/23, each VERDICT command-exit 0. Dependency closure built first (objectql^... and plugin-security^..., VERDICT command-exit 0). Ablations after the commit, via scripts/ablation-replace.mjs (suites import src/, no dist leg), each restored blob == HEAD and git diff HEAD empty: (1) the unknown-code hint guard `codeWritten && verdict.hint` back to `verdict.hint`: 4 failed / 44 passed, exactly the four resting-code cases; (2) the dimension guard `ofDimension = codeWritten ?` to `true ?`: 2 failed / 46 passed, exactly the two resting-dimension cases; (3) the S2 door refusal `if (map[target]?.valueDomain !== undefined)` to `if (false as boolean)`: 3 failed / 62 passed, exactly the three valueDomain pointer cases. Direction observed: red, as predicted.",
"gates": "Derived for the fix commit's five paths with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack PATHS` (89 families; the whole-PR derivation is still 130, last run 130/130 exit 0 on tree a37e623808 at 91a4947352). All 89 run on 44bf630f1e, exit codes captured before any pipe: 88 exit 0 on the first pass; check:dual-build-cjs-loads exit 3 (PREREQUISITE NOT MET, the fresh worktree had no workspace dists) and exit 0 on its rerun after the other gates had built them (124 entries across 72 packages load). Reconciliation: `Run reconciliation — 89 derived, 89 run, 0 NOT-MEASURED, 0 UNRUN.` CI on the new head: not awaited (the seat reads it). Not rerun this round: the local-only check:dev-prereqs and check:skill-frame-freshness.",
"dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
"mcp_calls": "0 this round (the three comments were read with single-comment REST GETs)",
"api_writes": "1 this round — POST /repos/objectstack-ai/objectstack/issues/35489/comments (this addendum, via post-stamped.mjs and the fleet-write relay). Plus one git push (fast-forward, not REST). The PR body was not patched.",
"open_questions": [],
"security_findings": "none",
"out_of_scope_findings": [],
"adr_amendment_delta": "Two edits to the amendment text handed back with the first report. [1] L3, the object-door bullet: after 'names a field that carries its own `unitConfig` (\"the pointer is the declaration\"),' add 'names a `text` field that declares a `valueDomain` (a second vocabulary for the same column, the pairing FieldSchema refuses beside the `code` marker),'. [5] Open item 9, case 2: replace 'and the message names the field, never the stored value;' with 'and the message names the field, never the stored value nor anything derived from it (no corrected spelling, no dimension);'. [4] Open item 8: replace 'It is refused beside a `valueDomain`' with 'It is refused beside a `valueDomain`, which would make one column two vocabularies'.",
"deviations": [
"The gate run is narrowed to the fix commit's paths (89 of the PR's 130 derived families), as the coordinator asked; the other 41 families read none of the five files.",
"N3 and N4 are unchanged, as instructed."
]
}
Progress · 2026-11-20T11:44Z · PR #35805 merged at 11:41Z as e1143241de (Part of #35489). The unitConfig union, the object door's record-pointer refusals, U5 (assertUnitCodes), the four 400 codes and the 405 sys_unit delete refusal are on main. This card stays open for one remaining piece: the ADR-0158 amendment (L3 bullets, and notes on Open items 3, 6, 8, 9 and 11, with the #35812 exemption on 11), which ships as its own Tier H PR and closes this card. #35492 is claimed (7038675232) and building on a fresh branch from main; its own amendment text joins the same ADR PR.
Activity
objectstack-fleet commentedon Nov 19, 2026
repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB
Carried to this card from PR #35581 (#35488) · 2026-11-19T17:29Z
Seat 5's contract review of PR #35581 (7016785755, PASS) defers two refusals to this card, the first reader of
sys_unit. It requires them written here before #35581 lands. Add them to this card's done-when:sys_unit. feat(spec, platform-objects): the standard unit table and the organization unit object sys_unit (ADR-0158 U1-U3) #35581 closes delete at the data API (apiMethodswithoutdelete) and in Setup. A delete issued to the engine below that door is not refused yet (ADR-0158 Open item 11 note). This card adds that refusal, for example abeforeDeleterefusal onsys_unit. Its pin is a real-stack cell showing a refused delete, single and batched (L1-a's note on feat(spec, platform-objects): the standard unit table and the organization unit object sys_unit (ADR-0158 U1-U3) #35581).retiredflag, and the row keeps its organization-scoped unique key. The membership check this card adds must read a row withretired: trueas NOT a member of the organization's units, so a retired code is refused on a new save. Without this, L1's refusal does not hold.Also from that review, for the first reader: N4 — ask membership of
STANDARD_UNITSthrough one exported own-property lookup, so that an inherited name never reads as a member.Both readings behind items 1 and 2 (retire as L1's delete; the engine refusal carried here) are for the maintainer to confirm when approving #35581. If he rules otherwise, this comment is amended.
objectstack-fleet commentedon Nov 20, 2026
repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu
Design requirements carried in before claim · 2026-11-20T04:04Z
Area: d7-D. Seat 5's split notice 7016816929 (mailbox #35558) leaves these to this card; they extend 7016814814 above and join this card's done-when. They are conditions of PR #35581's reading 2 (contract review 7016785755), so they are not optional.
sys_unitrow in every context: user, system and automation.enable.apiMethodsand Setup close only the data API and the UI; a delete issued to the engine frees the unique code, which could then be re-created with another dimension, and ADR-0158 Open item 11 (settled: "a deleted code stays retired") forbids exactly that. Candidate mechanism, not verified: an explicitsys_unitrow onorganization_adminwithallowDelete: false, assys_audit_loghas, plus abeforeDeleterefusal that also holds under a system context. Pin: a real-stack cell showing the refused delete, single and batched.retired: trueis not a member. U5's membership check reads only the organization's non-retiredsys_unitrows, so a retired code is refused on a new save (L1's delete bullet). This makes precise the words "the organization'ssys_unitrows" in the OI9 settlement on Units of measure: decide which writes the unit membership check judges (ADR-0158 Open item 9) #35467 (7013996288), which stands otherwise unchanged.STANDARD_UNITS(a plain object frozen one level deep), so an inherited name such astoStringnever reads as a member.objectstack-fleet commentedon Nov 20, 2026
repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu
Claim: PM loop round 2 · card thread d7-D · 2026-11-20T07:20Z
Ordered by: seat 7, 2026-11-20T04:07Z: claim #35489 in d7-D once #35739 is with L1-a, one xhigh dev at a time
Area: d7-D
Session:
session_01L9qibvMi1U7R2kBd3JbTPuAccount:
os-teslaBranch:
claude/project-thread-dr6px1(the one branch this thread can push; it is pushed only after PR #35739, now in the merge queue, has merged, and it restarts from main then)Worktree:
objectstack-issue-35489Domain:
domain:serverSeat:
repo:objectstack#7File surface:
packages/spec/src/data/field.zod.tsand its neighbours (theunitConfigkey and the OI8 unit-marker key on a field, its build-time checks againstSTANDARD_UNITS,standard-units.tsfor the N4 own-property lookup),packages/specerror-code ledger rows for the OI3 refusals,packages/objectql/src/**(the U5 asynchronous write-path membership check and the engine-sidesys_unitdelete refusal),packages/platform-objects/src/system/sys-unit.object.tsand theorganization_adminpermission rows, their tests, the generated spec artefacts the generators rewrite, the liveness ledger row, and root.changeset/. ⛔ Nodocs/adr/**in this PR: the ADR-0158 amendment (U4, OI3, OI6 first half, OI8, OI9) follows as its own Tier H PR after this one lands. Stop on breach and report.Container & model:
L,mode:subagent,model: default — dispatch-gates --tier at d1ebe86dd3: "no path-derived mandate"; contract (L2) review at CONTRACT_REVIEW_TIER per contract-review.md,effort: xhigh(contract surface plus engine write path; seat 7's word, 2026-11-20T04:07Z)Clause-②: yes
Metadata-protocol: added
Responsibility:
n/a — not a defect cardThread-read: 7030061316
Premise: holds — at d1ebe86,
git grep unitConfig -- 'packages/*/src/**'has 0 hits;STANDARD_UNITS(packages/spec/src/data/standard-units.ts:123) andsys_unitwith itsretiredflag (packages/platform-objects/src/system/sys-unit.object.ts) are on main from #35488 (PR #35581, 7411f9b)Serial constraints cleared: none. The unit sibling cards #35490 #35491 #35492 #35498 and the settled open items #35467 #35468 #35469 are all
pm:blockedwith no assignee; no open PR names units of measure. The file surface's last change is 7411f9b (merged); same-day churn: none.Scope-review: exempt — the route is ruled: ADR-0158 accepted (ruling records 7001193034 and 7003532733 on #35339), OI8 ruled A on #35339 (「可以单独声明」), OI9 settled on #35467 (7013996288)
Pre-claim lane:
area:dataseat 7 (#35557), which holds everyarea:datacard outside seat 5's in-hand set (maintainer, 2026-11-19T15:33Z: 「5号只处理在手任务」)Pre-claim deps:
Blocked-by: #35488is closed (PR #35581 merged 7411f9b)Prior rulings read: ADR-0158 → 7001193034 (「先不考虑 hotsrm,先处理平台任务,你的意见我同意」), 7003532733 (L1 「可改,只影响以后」), OI8 A 「可以单独声明」; the design requirements on this card, 7016814814 (seat 5) and 7030061316, join the done-when
objectstack-fleet commentedon Nov 20, 2026
repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu
os-dev-report
{ "issue": 35489, "status": "done", "branch": "claude/project-thread-dr6px1", "pr": "https://github.com/objectstack-ai/objectstack/pull/35805", "session": "session_01L9qibvMi1U7R2kBd3JbTPu", "premise_still_valid": true, "summary": "Built ADR-0158 R1's membership card as draft PR #35805 (Part of #35489, head 91a4947352): `unitConfig` on a field as a discriminated union of three closed shapes (`fixed` / `record` on a `number`, the Open item 8 `code` marker on a `text`), the object door's pointer refusals, and N4's one own-property lookup `standardUnitOf`. The engine judges every stored unit code at insert, by-id update, predicate update and the validate() preview (Open item 9's three cases, a retired row no member, the dimension restriction), with four 400 codes in the ledger. The engine refuses a `sys_unit` delete in every context before any middleware (405 ERR_UNIT_DELETE_REFUSED), and organization_admin names sys_unit explicitly with no delete. No docs/adr/**, ui/**, backfill door, aggregate refusal or decimal-places setting is touched; I wrote no card assignee (the PR carries the claim's Account, os-tesla).", "tests": "Final tree a37e623808 (gates and reruns at 168c65a692; 91a4947352 is the same tree with the commit messages reworded). New: spec field-unit-config.test.ts 62/62; objectql unit-code-membership.test.ts + engine-unit-code-membership.test.ts + federated-injected-column-readers.test.ts 65/65; plugin-security default-permission-sets.unit-of-measure.integration.test.ts 23/23 (real stack), VERDICT command-exit 0. Package runs under the lock: spec 866 files / 27781 passed / 1 todo (exit 0); objectql 620 of 621 files, the one red the federated census missing this PR's new seam row, added and green on rerun 5/5, typecheck exit 0; plugin-security 284 files / 7068 passed / 45 skipped, typecheck exit 0; metadata-core 27 files / 1045 passed + typecheck exit 0; driver-sql 266 files (13 skipped) / 4438 passed + typecheck exit 0; platform-objects 125 files / 2092 passed, typecheck exit 0; metadata-protocol degenerate-derivation 18/18. Ablations, both committed first, via scripts/ablation-replace.mjs, the engine suite importing src/ (no dist leg): (1) delete the `refuseOrganizationUnitDelete(object);` line in engine-delete-and-aggregate.ts, anchor 1 to 0, blob 0f0fd66a5919 to d1a6c4760fff, engine-unit-code-membership.test.ts 3 failed / 15 passed (system, user, no-context cells; other-object control green), restored blob == HEAD, git diff HEAD empty; (2) short-circuit the insert path's assertUnitCodes call in engine-insert.ts, blob 58ab1cbe7870 to e037c24b57a0, 7 failed / 11 passed (every insert refusal and the insertMany cull), restored blob == HEAD. Direction observed: red, as predicted, both legs.", "gates": "Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` (130 commands, unchanged on re-derivation at 168c65a692), all run on the final tree with exit codes captured before any pipe: 130 of 130 exit 0. Reconciliation: `Run reconciliation — 130 derived, 130 run, 0 NOT-MEASURED, 0 UNRUN.` / `✓ dispatch-gates --ran: 130 derived famil(ies) accounted for — 130 run, 0 NOT-MEASURED (a DERIVED zero — all 130 recorded an exit code and none of them is 3).` First sweep (tree before the last three commits): check:variant-docs exit 1 (undeclared unitMode union, then declared in variant-docs.json, rerun exit 0) and exit 3 prerequisites for check:skill-examples, check:dual-build-cjs-loads, check:i18n, all exit 0 in the final run. check-changeset-no-major --base origin/main --event (this PR body) exit 0, LEVEL AXIS green. Local-only: check:skill-frame-freshness exit 0; check:dev-prereqs exit 1 (35 of 108 packages unbuilt, named ones under ui/: container state, not the diff). test:repo not run (no test added to that project). CI check-runs on #35805: in_progress at report time, not awaited (the seat reads them).", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "2 — mcp__github__pull_request_read (method get, PR #35739), twice, read-only; no write tool", "api_writes": "3 REST writes, all through the fleet-write relay (each stroke a POST /repos/objectstack-ai/objectstack/dispatches): POST /repos/objectstack-ai/objectstack/pulls (draft #35805), POST /repos/objectstack-ai/objectstack/issues/35805/assignees (os-tesla, the claim's Account), POST /repos/objectstack-ai/objectstack/issues/35489/comments (this os-dev-report, via post-stamped.mjs). Plus one git push (not REST).", "open_questions": [ { "question": "An organization that holds any sys_unit row can now never be deleted: refuseOrganizationDeleteWhileOwned counts sys_unit (DELETE_RESTRICTED), and the engine refuses every unit delete. Which way should units meet the organization delete?", "options": [ "A: sys_unit outlives its organization (join the outlivesOrganization set). Cost: orphaned unit rows of a deleted organization stay at rest; effort small (one row plus a pin).", "B: the organization delete removes its units as the one exemption to the refusal (the cascade claim, never a caller flag). Cost: one narrow engine exemption beside a refusal that otherwise holds in every context; effort small to medium (exemption, real-stack cell).", "C: keep: an organization with units is refused loudly until a card asks. Cost: none now; tenant offboarding with units is blocked." ], "recommendation": "B, on a follow-up card: business need, an organization delete is a real offboarding door and today it is refused with no remedy; soundness, Open item 11 forbids re-creating a code with another meaning inside an organization, which a deleted organization can never do, so the invariant holds; AI-safety, the exemption is the engine's own cascade, not a consumer tolerance; startup scope, C is the honest default if no deletion with units is pulled yet." }, { "question": "Open item 9 point 7 left to this card: should the metadata save that declares unitConfig over stored free text answer a destructive-change finding, as currency_mode_to_record does?", "options": [ "A: yes, shipped with #35492 (the backfill door), naming that door as its remedy, in the same Version Packages release point 7 already requires.", "B: yes, in this PR, with no remedy to name yet (the door does not exist), and reworded when #35492 lands.", "C: no finding: the write refusal alone teaches it." ], "recommendation": "A, because the precedent finding's substance is the remedy it names (recordCurrencyCodeBackfillRemedy), it sits in metadata-protocol outside this claim's file surface, and point 7 already ties both cards to one release, so no release carries the tightened write without both." } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: #35492 · Open item 9 point 7: the unit refusal names no backfill door yet, and the destructive-change finding over stored free text (open question 2) belongs with that door · noted, not filed", "carrier: objectstack seat (repo:objectstack#7) · the ADR-0158 amendment text (field adr_amendment), shipped as its own PR after #35805 lands · noted, not filed", "carrier: seat (the Skills-docs line on #35805) · skills/objectstack-data/rules/field-types.md, skills/objectstack-data/evals/objects-fields-relationships.json, skills/objectstack-project/references/platform-catalog.md teach no unitConfig yet · noted, not filed", "carrier: none · a record pointer declared by an object extension is not judged by the object door, the same reach as currencyField's; observation only, no public-door reproduction measured · noted, not filed" ], "deviations": [ "Commit trailers first carried the model name (Co-Authored-By: Claude Opus 5.5); the pre-push check:commit-card-trailers refused the push, and the eight unpublished commits were re-created with git commit-tree under the model-free pair, trees and parents preserved (tree a37e623808 before and after, git diff empty), before the first push.", "No empty branch was pushed first: the dispatch's push gate held every push until #35739 merged. The push target claude/project-thread-dr6px1 no longer existed on the remote (deleted on merge), so a plain push created it; no --force-with-lease was used.", "Files outside the dispatch's expected landing zone, each forced by the new key's own gates or tests and carrying no behaviour: metadata-core object-schema-fls-references.ts (unitConfig: keep), driver-sql builtin-column-collision.ts (unitConfig: presentation), the metadata-protocol degenerate-derivation count, packages/spec/variant-docs.json, and generated content/docs/references/** and docs/audits/** counts.", "The pin sweep renamed one test title in platform-objects (sys-unit.object.test.ts) that named the wildcard grant the explicit sys_unit line replaced." ], "adr_amendment": "ADR-0158 amendment proposed by #35489 (for the seat's own PR; every note dated the day it lands)\n\n[1] L3, replace the settled code block and add three bullets after \"Cross-refusals\":\n\n unitConfig:\n | { unitMode: 'fixed'; unit: 'KGM' } // on `number`: one U1 code, exact uppercase, checked at build\n | { unitMode: 'record'; unitField: 'unit_code'; unitDimension?: 'mass' } // on `number`: one segment, a sibling `text` field\n | { unitMode: 'code'; unitDimension?: 'count' } // on `text`: Open item 8, the field holds a unit code itself\n\n- **Shipped as a discriminated union of three closed shapes** (`packages/spec/src/data/field.zod.ts#UnitConfigSchema`).\n The discriminator is required, so each mode's keys are its variant's and the rule reaches the published JSON\n Schema as a `oneOf`; `currencyConfig` cannot take this form because its discriminator has a default. A key of\n another mode is refused with guidance naming the mode it belongs to; `mode`, `defaultUnit`, `unitCode`, `code`,\n `uom`, `field`, `codeField` and `dimension` inside the config are answered with their spelling here.\n- **Which type carries which mode**: `fixed` and `record` on a `number`, `code` on a `text`; every other type is\n refused, `currency`, `formula` and `summary` included (U8: no reader). A bare `unit`, `uom`, `unitCode` or\n `dimension` key on a field is refused with guidance naming `unitConfig`.\n- **The object door** (`packages/spec/src/data/object.zod.ts#refuseDishonestRecordUnitField`, beside the currency\n one) refuses a `record` pointer that names no declared field, names its own field, names a field that is not\n `text`, names a field that carries its own `unitConfig` (\"the pointer is the declaration\"), or holds a dot (the\n `master_detail` path this record does not admit; \"a child cannot follow its parent's unit yet\"), and refuses two\n quantities that share one unit field with different `unitDimension` values.\n\n[2] Open item 3, add:\n\n*Note (DATE):* settled on the membership card (#35489), one code per remedy as `ERR_HOME_CURRENCY_UNSET` beside\n`ERR_CURRENCY_CODE_REQUIRED` is, each registered in the ADR-0112 ledger under `@objectstack/objectql`:\n`ERR_UNIT_CODE_REQUIRED` (a quantity beside a blank code), `ERR_UNIT_CODE_UNKNOWN` (a code that is neither a U1 code\nnor one of the organization's units, the exact-uppercase spelling named when only the case differs),\n`ERR_UNIT_CODE_RETIRED` (L1's \"a new save with that code is refused\"), `ERR_UNIT_DIMENSION_MISMATCH` (a member of\nanother dimension than the declared `unitDimension`), all 400; and `ERR_UNIT_DELETE_REFUSED`, 405, the status the\ndata door already answers for the same verb on `sys_unit`, the suffix following `EXTERNAL_WRITE_REFUSED`. U7 R1's\naggregate refusal and U7 R2's no-ratio refusal stay with their cards (#35491, R2).\n\n[3] Open item 6, add:\n\n*Note (DATE), first half:* settled on the membership card (#35489). A number field that declares `unitConfig` needs\nno `scale`, and may keep one. ADR-0144's precedent is that a currency's decimal places are the currency's, not a\nfield setting (ruling 5805782503, `field-currency-scale-refused.test.ts`); it never required a scale. A unit's own\ndecimal places are U6, which R1 does not ship (#35498), so R1 has nothing a required scale would serve; a declared\n`scale` stays what L4 names it, the ceiling. The display half stays with R1's display card.\n\n[4] Open item 8, add:\n\n*Note (DATE):* ruled A on #35339 (「可以单独声明」, 7008524997) and built on the membership card (#35489). The marker\nis `unitConfig: { unitMode: 'code', unitDimension? }` on a `text` field: the third member of the one unit key, not\na fourth value domain (U1 keeps `ValueDomainSchema` at three members), because the membership it asks is\nasynchronous and reads `sys_unit` rows, which no pure value-domain predicate can. Precedent: the L3 key family\n(`unitConfig` / `unitMode` mirroring `currencyConfig` / `currencyMode`), and the word \"code\" from U4 (\"the row\nstores the code\") and `sys_unit.code`. It is refused beside a `valueDomain`, and on a field a quantity's\n`unitField` names (L3: \"the pointer is the declaration\"). U5 judges it whenever it is written (Open item 9 point 6);\nthe picker (#35490) and the backfill (#35492) reach it.\n\n[5] Open item 9, add:\n\n*Note (DATE):* settled by the seat on #35467 (7013996288) and built on the membership card (#35489,\n`packages/objectql/src/validation/unit-code-membership.ts#assertUnitCodes`), at insert, by-id update, predicate\nupdate and the `validate()` preview, after the currency-code check:\n- the row image is judged whenever the write carries the quantity or its unit field; a write touching neither is\n not judged (ADR-0113 D1);\n- case 1: a written code is a member only if it is a U1 code (one own-property lookup, `standardUnitOf`) or a\n non-retired `sys_unit` row of the row's organization, in exact uppercase, never folded;\n- case 2: a non-blank quantity written beside a resting code that is no longer a member is refused, and the message\n names the field, never the stored value;\n- case 3: a quantity beside a blank code is refused (`ERR_UNIT_CODE_REQUIRED`, ADR-0144 D8 rule 4); a blank\n quantity needs no code;\n- point 5: under `unitDimension` a member of another dimension is refused; a unit field shared by two quantities\n is judged by the restriction either declares (L3 refuses two different ones);\n- point 6: a standalone `code` field is judged as a unit field with no quantity, under its own `unitDimension`;\n- point 7: the refusal's guidance does not yet name the backfill door, which #35492 adds; whether the metadata save\n that declares `unitConfig` over stored free text answers a destructive-change finding the way\n `currency_mode_to_record` does is carried with that door (the precedent finding's substance is the remedy it\n names), so both land in one Version Packages release.\nThe organization's units are read once per organization per write, with an explicit `organization_id` predicate\nunder a minimal system context that keeps only the caller's transaction and trace id, and never for a write whose codes are all\nstandard.\n\n[6] Open item 11, add (optional, the delete half the card carried):\n\n*Note (DATE):* the engine refuses a delete of a `sys_unit` row in every context, a system writer and an automation\nrun included, by id and batched (405 `ERR_UNIT_DELETE_REFUSED`, before any middleware or hook), and\n`organization_admin` names `sys_unit` explicitly with no delete bit, as `sys_audit_log` is named (#35489).\n", "precedents": [ "unitConfig, unitMode, unitField: currencyConfig, currencyMode, currencyField (ADR-0144; L3 settled by the owning seat)", "unit (not defaultUnit), unitDimension (not dimension): L3's own settlement", "values fixed and record: currencyMode's values, same meaning (L3)", "value code, the Open item 8 marker: the L3 key family, the word code from U4 (the row stores the code) and sys_unit.code; a marker, not a fourth value domain (U1)", "standardUnitOf: N4 (7016814814, 7030061316), the spec's NAME-Of lookup naming (recordCurrencyFieldOf, fixedInnerReadOf)", "ERR_UNIT_CODE_REQUIRED: ERR_CURRENCY_CODE_REQUIRED (ADR-0144 D8 rule 4)", "one code per remedy: ERR_HOME_CURRENCY_UNSET beside ERR_CURRENCY_CODE_REQUIRED", "ERR_UNIT_CODE_UNKNOWN: the SUBJECT_UNKNOWN form of FILTER_TOKEN_UNKNOWN, STACK_CAPABILITY_UNKNOWN", "ERR_UNIT_CODE_RETIRED: sys_unit's one-way retired flag (Open item 11, L1)", "ERR_UNIT_DIMENSION_MISMATCH: the SUBJECT_MISMATCH form of ERR_BULK_RESULT_MISMATCH, EXTERNAL_SCHEMA_MISMATCH", "ERR_UNIT_DELETE_REFUSED, 405: the data door's 405 for the same verb on sys_unit (apiMethods without delete); the REFUSED suffix of EXTERNAL_WRITE_REFUSED", "organization_admin's explicit sys_unit line with allowDelete false: sys_audit_log's explicit line", "Open item 6 first half (no scale required): ruling 5805782503 and field-currency-scale-refused.test.ts (a currency's decimals are the currency's, never a required scale); L4 (scale is the ceiling)" ], "oi9_pins": [ "packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 1: refuses a code that is no member, ERR_UNIT_CODE_UNKNOWN / 400 on the code field", "packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 1: refuses %j, never folded, naming the exact spelling", "packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 2: refuses the quantity edit beside a retired code, naming the field and never the stored value", "packages/objectql/src/validation/unit-code-membership.test.ts :: OI9 case 3: refuses a quantity beside the code %j, ERR_UNIT_CODE_REQUIRED / 400", "engine seams: engine-unit-code-membership.test.ts :: a quantity edit beside a resting non-member code is refused (case 2), the row unchanged; clearing the code beside a resting quantity is refused (case 3)", "real stack: default-permission-sets.unit-of-measure.integration.test.ts :: refuses a retired unit (Requirement 2), a mis-cased code, a code of another dimension and a quantity with no code: 400, nothing stored" ], "delete_refusal": { "mechanism": "refuseOrganizationUnitDelete(object) in packages/objectql/src/engine-delete-and-aggregate.ts, right after assertWriteAllowed and before any middleware, hook or driver call, throws UnitDeleteRefusedError (code ERR_UNIT_DELETE_REFUSED, status 405) for object sys_unit, whatever the context and whether by id or multi. Plus organization_admin names sys_unit explicitly (allowRead, allowCreate, allowEdit true, allowDelete false, no modifyAllRecords), so the effective permissions offer no delete. The candidate beforeDelete hook was not used: the security middleware and hooks are bypassed or skippable under a system context, the engine-level check is not.", "real_stack_cell": [ "an organization administrator: refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored", "an organization owner: refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored", "a member: refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored", "a system writer ({ isSystem: true }): refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored", "a system automation run (svc:flow, runAs system): refused by id and batched, 405 ERR_UNIT_DELETE_REFUSED, every unit still stored", "the administrator's effective permissions offer no delete on units, and keep create and edit" ] }, "gate_reconciliation": "Run reconciliation — 130 derived, 130 run, 0 NOT-MEASURED, 0 UNRUN.", "head_sha": "91a494735288e000a7259b2009567ef498473d5d", "owed_reviews": "L1 and L2 (contract review at CONTRACT_REVIEW_TIER) are owed; not run by me." }Generated by Claude Code
objectstack-fleet commentedon Nov 20, 2026
repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu
Claim amendment: claim 7033168211, the file surface only · 2026-11-20T09:46Z
Branch:
claude/project-thread-dr6px1(PR #35805, head 91a4947)File surface (added): the ripple files a new field key forces, each a classification with no behaviour of its own (L1 ACCEPT 7036343182):
packages/drivers/driver-sql/src/builtin-column-collision.ts(unitConfig: 'presentation')packages/metadata-core/src/object-schema-fls-references.ts(unitConfig: keep)packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts(the count)packages/plugins/plugin-security/src/objects/default-permission-sets.ts(the explicitorganization_adminsys_unitline the claim names) andpackages/plugins/plugin-security/src/default-permission-sets.unit-of-measure.integration.test.ts(the real-stack cell)packages/spec/variant-docs.json,packages/spec/src/system/metadata-form-zod-reconciliation.test.tscontent/docs/references/**pages anddocs/audits/2026-07-unknown-key-strictness-ledger.counts/data.mdEverything else in the claim stands unchanged.
objectstack-fleet commentedon Nov 20, 2026
repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu
os-dev-report
{ "issue": 35489, "status": "done", "branch": "claude/project-thread-dr6px1", "pr": "https://github.com/objectstack-ai/objectstack/pull/35805", "session": "session_01L9qibvMi1U7R2kBd3JbTPu", "premise_still_valid": true, "round": "fix round on the L2 contract review 7036451051 (PASS, S1 and S2 should-fix; N1 and N2 folded in; N3 and N4 left as accepted deviations, unchanged)", "summary": "One fix commit 44bf630f1e on top of 91a4947352, pushed as a fast-forward (no force). S1: on a quantity-only edit beside a resting code, the ERR_UNIT_CODE_UNKNOWN refusal no longer offers the stored code's corrected spelling or the piece, and ERR_UNIT_DIMENSION_MISMATCH no longer prints the stored code's dimension; the field is named, as the retired path does, and a written code is still answered with both. S2: the object door refuses a record quantity's unitField naming a text field that declares a valueDomain, at fields.QUANTITY.unitConfig.unitField, and no longer offers such a field as a candidate. N1 fixes the field.zod.ts docblock's test-file name; N2 rewords the code-beside-valueDomain message to say why the pairing is refused (two vocabularies for one column; MMK is in both), not that no value satisfies both.", "fix_commit": "44bf630f1e4704727471be06f8f0e3108c964194", "fix_files": [ "packages/objectql/src/validation/unit-code-membership.ts", "packages/objectql/src/validation/unit-code-membership.test.ts", "packages/spec/src/data/field.zod.ts", "packages/spec/src/data/object.zod.ts", "packages/spec/src/data/field-unit-config.test.ts" ], "head_sha": "44bf630f1e4704727471be06f8f0e3108c964194", "new_tests": [ "objectql unit-code-membership.test.ts :: OI9 case 2: refuses the quantity edit beside a resting %j, ERR_UNIT_CODE_UNKNOWN / 400, printing neither the stored code nor its corrected spelling (kgm, ' KGM', ea, c62; each with a written-code control that still gets the correction)", "objectql unit-code-membership.test.ts :: OI9 case 2: refuses the quantity edit beside a resting %s of another dimension, ERR_UNIT_DIMENSION_MISMATCH / 400, printing neither the code nor its dimension (MTR length, BOX_12 package; each with a written-code control naming the dimension)", "spec field-unit-config.test.ts :: refuses a pointer into a `text` field that declares `valueDomain: %s`, at `fields.weight.unitConfig.unitField`, and offers no such field as a candidate (iso_4217_currency, iso_3166_alpha2, iana_time_zone; each with a parse-green control pointing at the plain sibling)", "spec field-unit-config.test.ts :: renamed and strengthened: refuses a unit code field that also declares a `valueDomain`: two vocabularies for one column, not an empty one (was: no value satisfies both)" ], "tests": "At 44bf630f1e, under the lock: focused suites objectql unit-code-membership + engine-unit-code-membership 66/66 (was 60), spec field-unit-config 65/65 (was 62); package runs spec test 866 files / 27784 passed / 1 todo, spec typecheck, objectql test 621/621 files / 14044 passed, objectql typecheck, plugin-security real-stack cell default-permission-sets.unit-of-measure.integration.test.ts 23/23, each VERDICT command-exit 0. Dependency closure built first (objectql^... and plugin-security^..., VERDICT command-exit 0). Ablations after the commit, via scripts/ablation-replace.mjs (suites import src/, no dist leg), each restored blob == HEAD and git diff HEAD empty: (1) the unknown-code hint guard `codeWritten && verdict.hint` back to `verdict.hint`: 4 failed / 44 passed, exactly the four resting-code cases; (2) the dimension guard `ofDimension = codeWritten ?` to `true ?`: 2 failed / 46 passed, exactly the two resting-dimension cases; (3) the S2 door refusal `if (map[target]?.valueDomain !== undefined)` to `if (false as boolean)`: 3 failed / 62 passed, exactly the three valueDomain pointer cases. Direction observed: red, as predicted.", "gates": "Derived for the fix commit's five paths with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack PATHS` (89 families; the whole-PR derivation is still 130, last run 130/130 exit 0 on tree a37e623808 at 91a4947352). All 89 run on 44bf630f1e, exit codes captured before any pipe: 88 exit 0 on the first pass; check:dual-build-cjs-loads exit 3 (PREREQUISITE NOT MET, the fresh worktree had no workspace dists) and exit 0 on its rerun after the other gates had built them (124 entries across 72 packages load). Reconciliation: `Run reconciliation — 89 derived, 89 run, 0 NOT-MEASURED, 0 UNRUN.` CI on the new head: not awaited (the seat reads it). Not rerun this round: the local-only check:dev-prereqs and check:skill-frame-freshness.", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "0 this round (the three comments were read with single-comment REST GETs)", "api_writes": "1 this round — POST /repos/objectstack-ai/objectstack/issues/35489/comments (this addendum, via post-stamped.mjs and the fleet-write relay). Plus one git push (fast-forward, not REST). The PR body was not patched.", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [], "adr_amendment_delta": "Two edits to the amendment text handed back with the first report. [1] L3, the object-door bullet: after 'names a field that carries its own `unitConfig` (\"the pointer is the declaration\"),' add 'names a `text` field that declares a `valueDomain` (a second vocabulary for the same column, the pairing FieldSchema refuses beside the `code` marker),'. [5] Open item 9, case 2: replace 'and the message names the field, never the stored value;' with 'and the message names the field, never the stored value nor anything derived from it (no corrected spelling, no dimension);'. [4] Open item 8: replace 'It is refused beside a `valueDomain`' with 'It is refused beside a `valueDomain`, which would make one column two vocabularies'.", "deviations": [ "The gate run is narrowed to the fix commit's paths (89 of the PR's 130 derived families), as the coordinator asked; the other 41 families read none of the five files.", "N3 and N4 are unchanged, as instructed." ] }Generated by Claude Code
objectstack-fleet commentedon Nov 20, 2026
repo:objectstack#7 · os-tesla · session_01L9qibvMi1U7R2kBd3JbTPu
Progress · 2026-11-20T11:44Z · PR #35805 merged at 11:41Z as
e1143241de(Part of #35489). TheunitConfigunion, the object door's record-pointer refusals, U5 (assertUnitCodes), the four 400 codes and the 405sys_unitdelete refusal are on main. This card stays open for one remaining piece: the ADR-0158 amendment (L3 bullets, and notes on Open items 3, 6, 8, 9 and 11, with the #35812 exemption on 11), which ships as its own Tier H PR and closes this card. #35492 is claimed (7038675232) and building on a fresh branch from main; its own amendment text joins the same ADR PR.