Skip to content

fix(spec)!: a field's precision: 0 is refused at save and publish, naming scale - #39211

Merged
os-zhuang merged 9 commits into
mainfrom
claude/project-thread-wxsz4m
Dec 3, 2026
Merged

os-zhuang merged 9 commits into
mainfrom
claude/project-thread-wxsz4m

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

repo:objectstack@os-bill · os-bill · session_01Utp6CZrpGx11Siz7rMLiFi

Fixes #39173

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #39213

维护者速读

  • 用户能看到什么变化:管理员或应用内助手给数字字段写「精度为 0」时,保存和发布当场被拒,提示说明「精度是总位数,小数位请用 scale」;以前是发布成功、之后录数据才全被拒。
  • 为什么做:替云端验收里应用内助手建应用的场景解决「发布成功、演示数据八条丢七条」的问题,让错误在写元数据时就暴露。
  • 出错会怎样:只多拒一种本来就无法使用的写法;已上线的旧对象照常加载,下次保存时才要求改正;有问题可直接撤回本次改动。
  • 要你做什么:无。

What changes

precision is a field's TOTAL digit count (the p of a DECIMAL(p, s)), enforced on every write as max_precision. So precision: 0 admits only the value 0. The card measured it once: an in-app build agent saved { type: 'number', min: 0, precision: 0 } (it meant zero decimal places), the draft save answered publishable with no refusal, the publish answered published, and the seed load then refused 7 of 8 rows.

  • packages/spec/src/data/field.zod.ts: FieldSchema.precision goes from z.number().int().min(0) to z.number().int().min(1, { message: PRECISION_LOWER_BOUND_MESSAGE }). The message is module-private, beside the existing SCALE_UPPER_BOUND_MESSAGE precedent, and reads: "precision must be a positive integer: it is the total digit count of the value (the p of a DECIMAL(p, s), integer and decimal digits together), so precision: 0 would admit only the value 0 and refuse every other write. Decimal places are not declared with precision: on a number, percent, rating or slider field they are scale (a whole number declares scale: 0, not precision: 0); on a currency field they are the currency's own and scale is refused there, so delete precision. Declare the total digits (precision: 10, scale: 2 holds up to 99999999.99; on a currency, precision: 12), or omit precision for no digit limit." The .describe() now says "positive integer; precision: 0 is refused". This follows the minLength lower-bound precedent in the same file: "no limit" is written by omitting the key.
  • No verdict-path code changed. It was measured, not assumed: the metadata save door parses every object body against ObjectSchema (protocol-save.ts, resolveOverlaySchema), and the publish re-parses a stored object draft (promotedObjectDraftSpecRefusal). Both reach FieldSchema, so the bound alone refuses the declaration at save and at publish, and also at os validate and defineStack.
  • ADR-0087 registration: a new semantic entry, 19.field-precision-zero-refused.ts (relevantWhen covers objects and objectExtensions), with its rows in semantic-relevance.test.ts and in the FIELD list of semantic-relevance-coverage-38929.test.ts. No D2 conversion: dropping the key would make every value writable, and whether the author meant scale: 0 or a real digit bound is theirs to decide.
  • Regenerated: content/docs/references/data/{field,object}.mdx and packages/spec/docs/references/system/migration{,.part-2}.md (check:generated --fix, only the one stale artifact).
  • Changeset: @objectstack/spec minor, BREAKING banner, FROM → TO, the one-line fix, and the stored-row behaviour.

Stored metadata, measured from the code (not booted end to end):

  • An object draft stored before this release is refused at publish: 422 INVALID_METADATA at fields.FIELD.precision. This is pinned below.
  • An active object row still loads. SchemaRegistry registration parses as a diagnostic only (registry.ts, metadata_spec_invalid, "registered anyway"), and the database loader does not parse. The engine therefore keeps refusing non-zero writes exactly as today, metadata reads mark the row in _diagnostics, and the next save of that object is refused until the field is fixed.
  • A code-authored stack is refused at os validate / defineStack.

Tests

  • packages/spec/src/data/field.test.ts, new top-level describe: the measured body is refused too_small at [precision], with a message naming the total digit count and `scale: 0`. Also refused: precision: 0 on each of number / currency / percent / rating / slider, and ObjectSchema at fields.employees.precision. precision 1, 1+2, 18+2 and 10+0, and scale: 0 alone, all parse byte-identically. On currency, the sentence carries the currency arm ("scale is refused there, so delete precision"), and the currency field without precision, or with precision: 12, parses.
  • packages/spec/src/data/field.test.ts, existing spec: Field.scale accepts meaningless declarations (2.5, -1) — now that scale is enforced, malformed declarations should be refused at authoring time #8321 describe: { precision: 0 } leaves the legal list (now { precision: 1 }), and the message check for precision: -1 reads "positive integer" (formerly >=0).
  • packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts, new top-level describe, on the file's real save/publish harness:
    • the draft save refuses 422 INVALID_METADATA at fields.headcount.precision, with the sentence naming `scale: 0`, and nothing is stored;
    • a draft stored before the change is refused at per-item publish with the same sentence naming `scale: 0`, and stays a draft;
    • CONTROL: precision: 1 saves and publishes.
  • Red first: the new spec describe ran 7 failed on cf44d851 (the test commit, before the fix).
  • Ablation, once, through ablation-replace.mjs: .min(1, { message }) → .min(0, …), rebuilt, marker proved in dist/. Result: 8 spec cases red (the 7 new ones plus precision: -1) and the 2 door refusals red, with CONTROL green. Restored with blob == HEAD and the marker proved absent from dist/. After the restore: spec field.test.ts + src/migrations 581 passed, door file 12 passed.

Review round (0f0dae4f, after review 7363940829): the currency arm in the sentence and in the entry's replacement (S1), a standalone field item in the entry's surface (N1), the publish pin asserting the sentence (N2). Re-run locally: spec build, field.test.ts + currency-precision-iso4217.test.ts + src/migrations 603 passed, door file 12 passed, check:generated, check:upgrade-guide, check:spec-changes, check:liveness, check:adr-0087-registration green.

Acceptance notes

  • FormFieldSchema.precision (packages/spec/src/ui/view.zod.ts, the form row's override) keeps .min(0), and view.test.ts pins precision: 0 legal there. A form row's precision is copied onto the runtime field by plugin-form, but no write path enforces it, so this card leaves it alone. The seat filed it as spec(view): FormFieldSchema.precision still accepts 0 and has no write-side reader (declared, not enforced) #39214 (enforce-or-remove on the form row's precision).
  • packages/objectql/src/validation/record-validator.precision.test.ts still pins the runtime behaviour of a raw precision: 0 definition (only 0 fits). That stays true for an active stored row, so the pin is kept.
  • Studio's field inspector input for precision is not changed. A Studio save of 0 now gets the 422 sentence.

Verification

Two-minute check: pnpm --filter @objectstack/spec exec vitest run src/data/field.test.ts -t "precision: 0". Expect 9 passed, and the refusal message naming scale: 0.

Files to read first: packages/spec/src/data/field.zod.ts (the bound and its message), packages/spec/src/migrations/entries/semantic/19.field-precision-zero-refused.ts, then .changeset/39173-field-precision-zero-refused.md.

Local gates

dispatch-gates.mjs --commands derived 120 families. They ran at 3d7870f3. The origin/main merge 9eb9de93 brought no change under packages/spec or packages/metadata-protocol. At 9eb9de93: spec build, check:generated (14 of 14 up to date) and the targeted spec tests were re-run green. --ran reconciliation: 120 accounted, 114 run, 6 NOT-MEASURED (4 exit 3 PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test (shallow clone), check:skill-examples, check:dual-build-cjs-loads, check:lean-entry-closure, which need a full workspace build; 2 claimed: check:query-options-erasure timed out at the local 300 s cap, check:type-check-debt was killed by a container restart). One family recorded red: check:dts-closure exit 1. It lists missing .d.ts in core, formula, lint, driver-sql and driver-sqlite-wasm, which this checkout built with OS_SKIP_DTS=1. None of them is in this diff, and CI builds with declarations. pnpm --filter @objectstack/spec typecheck (tsc + scripts + test layer) passed. The full spec suite exceeds the 10-minute foreground cap locally, so it is NOT MEASURED here; Test Core runs it. metadata-protocol typecheck is NOT MEASURED locally; CI runs it. cli migrate-meta-engine-guidance.test.ts: 3 passed.


Generated by Claude Code

@github-actions github-actions Bot added the size/m label Dec 3, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 5 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/spec/docs/references/system/migration.md, packages/spec/docs/references/system/migration.part-2.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 440331f1dd40ae99bc59412c026c52035a8f2e78.

⛔ 8 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/spec/docs/references/system/migration.md, packages/spec/docs/references/system/migration.part-2.md) — pages documenting those are invisible to this run
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 183 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 440331f1dd40ae99bc59412c026c52035a8f2e78 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from be969b331278b65deeb6c88e20efafcd9adef8db — the merge of head 0f0dae4fac6d46b8a2b63fa7f4531d82d05e34e5 into base 440331f1dd40ae99bc59412c026c52035a8f2e78, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin be969b331278b65deeb6c88e20efafcd9adef8db && git checkout be969b331278b65deeb6c88e20efafcd9adef8db
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 440331f1dd40ae99bc59412c026c52035a8f2e78 0f0dae4fac6d46b8a2b63fa7f4531d82d05e34e5 && git checkout -B drift-repro 440331f1dd40ae99bc59412c026c52035a8f2e78 && git merge --no-ff 0f0dae4fac6d46b8a2b63fa7f4531d82d05e34e5

node scripts/docs-audit/affected-docs.mjs --json 440331f1dd40ae99bc59412c026c52035a8f2e78

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 440331f1dd40ae99bc59412c026c52035a8f2e78 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…lest legal count

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 545b751498e168f939a1cbcdd1f19bffa4e8e912
Local-runs: none
Scope: packages/spec/src/data/field.zod.ts, packages/spec/src/migrations/entries/semantic/19.field-precision-zero-refused.ts, packages/spec/src/data/field.test.ts, packages/spec/src/data/currency-precision-iso4217.test.ts, packages/spec/src/migrations/semantic-relevance.test.ts, packages/spec/src/migrations/semantic-relevance-coverage-38929.test.ts, packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts, packages/spec/docs/references/system/migration.md, packages/spec/docs/references/system/migration.part-2.md + packages/objectql/src/validation/record-validator.ts, packages/objectql/src/registry.ts, packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-diff-delete-load.ts, packages/spec/src/kernel/metadata-type-schemas.ts, packages/spec/src/conversions/entries/18/field-malformed-scale-precision-removed.ts, packages/spec/src/ui/view.zod.ts (cited code outside the diff, read only)
Security-touching: no
Rule-change-verified: none

Narrowing face (Clause-②: no (narrowing), Metadata-protocol: narrowed on the PR body and the changeset): the floor is every path of the diff outside the prose faces, listed above; the changeset and content/docs/** are the seat's ACCEPT. Inputs read: card #39173 (body and its 7 comments; no earlier record on this head), the PR body and file list (12 files), the net diff against the merge base with main, and the check-runs on the head.

① Derived judgments

  • FieldSchema.precision accept-set: integers from 0 become integers from 1. Right, and declared as what it is. The one value removed is the never-usable one: digitCountAt in record-validator.ts counts zero as 0 digits and every other finite value as 1 or more, and the write branch refuses actual above def.precision on number, currency, percent, rating and slider, so precision: 0 admitted the value 0 alone. The diff widens nothing.
  • Reach of the narrowing beyond the two surfaces the entry names. FieldSchema is also the schema of the standalone field metadata type (kernel/metadata-type-schemas.ts), of system/migration.zod.ts's add-field operation and of ui/widget.zod.ts's field; all three refuse precision: 0 with the same sentence from this head on. Right (one schema, one refusal; the changeset says "on any field"), and noted as nit N1 on the entry's surface text.
  • Refusal envelope. Code stays too_small at path precision; the message of every sub-1 value, precision: -1 included, changes from zod's default to the new sentence. Right: the spec: Field.scale accepts meaningless declarations (2.5, -1) — now that scale is enforced, malformed declarations should be refused at authoring time #8321 pin was moved to match, in the diff.
  • Describe text and emitted JSON Schema. The .describe() change regenerates four reference tables (two under content/docs, two under packages/spec/docs), all in the diff and all the same row; the emitted minimum moves from 0 to 1. No TypeScript surface moves (the inferred type is still an optional number). Right.
  • os migrate meta gains the TODO 19:field-precision-zero-refused for stacks declaring objects or objectExtensions, the same relevance keys every FIELD-family precedent carries; both relevance tables carry the row. Right.
  • Not changed, on purpose. The engine's guard stays def.precision at or above 0, so an active stored row keeps its 0-only write behaviour; FormFieldSchema.precision (ui/view.zod.ts) keeps .min(0), so the form row and the object field now differ at 0. Both are stated by the PR and the second is routed to spec(view): FormFieldSchema.precision still accepts 0 and has no write-side reader (declared, not enforced) #39214. Right as a scope decision for this card.

② Semver level

@objectstack/spec minor: matches. The kind is narrowed, which takes at least minor on the package the diff moves; packages/metadata-protocol changes a test file only and publishes nothing. The changeset carries the BREAKING banner, the FROM → TO mapping, the one-line fix, both declaration lines and exactly one ADR-0087 marker (registered field-precision-zero-refused), whose id is the new entry's. Clause-②: no (narrowing) is the right arm: no accepted value, key or type is added anywhere in the diff. Check Changeset: success.

③ Boundary flags

  • open_questions in the dev report (comment 7362773199): empty. security_findings: none; the diff has no permission, sharing or credential hunk.
  • Out-of-scope finding 1, FormFieldSchema.precision keeps .min(0): answered by the PR body as filed spec(view): FormFieldSchema.precision still accepts 0 and has no write-side reader (declared, not enforced) #39214. Out-of-scope finding 2, the skills page field-types.md: answered as Skills-docs: follow-up #39213. Neither issue is in this review's input set; their numbers are taken from the PR body, not read.
  • Claim amendment 7363188059 asks whether the ['JPY', 0] → ['JPY', 1] fixture still pins its intent. It does: the case list still parses a count on each fraction-digit class (JPY at 1 and 12, USD at 2 and 18, KWD at 3, 2 and 15), and "a count is never judged against the currency's fraction digits" stays pinned by the neighbouring cases. What is lost is only the pair "count equals JPY's fraction digits", which is the value this PR refuses.
  • Flags the dev left NOT MEASURED locally, answered by the head's check-runs: full spec suite and the door file (Test Core 1/12 to 12/12 success), metadata-protocol typecheck (Type Check · workspace success), check:dts-closure and the consumer gates (Type Check · consumer gates success), check:query-options-erasure (Lint · scoped · query-options erasure success), check:type-check-debt (Type Check · debt ledger success), the four prerequisite-blocked self-tests (Lint & Repo Gates, Lint · scoped · tooling self-tests success). Governed Surface Queue Guard, Spec property liveness, Dogfood battery and its three shards: success. No check-run on the head concluded failure.
  • "Stored metadata, measured from the code (not booted end to end)": read and confirmed in the cited code. registry.ts parses as a diagnostic and registers anyway under [metadata_spec_invalid]; protocol-diff-delete-load.ts warns and registers; promotedObjectDraftSpecRefusal is called from the promotion both the per-item and the batch publish go through, before the draft is written active.
  • No D2 conversion: holds. The 18 precedent (field-malformed-scale-precision-removed) deleted values the engine never enforced, a lossless delete; precision: 0 IS enforced, so deleting it would change what the field accepts.
  • SQL push-down: no query, id materialisation or in-app join anywhere in the diff.
  • PR author is objectstack-fleet[bot]; the PR is a draft with no auto-merge armed.

④ Design judgment

The narrowing itself, against the published spec on main: holds. It makes the spec's own contract real rather than taking a capability away. The describe on main already defines precision as total digits and sends decimal places to scale; the UI reads decimals from scale on every face read here, so precision: 0 had no display meaning to lose; the engine made it a 0-only field. No declaration of precision: 0 exists in the head's tree outside tests. Refusing at the producer, "no limit" spelled by omitting the key, follows the minLength and maxLength lower bounds in the same file. The card's measured body { type: 'number', min: 0, precision: 0 } is refused at the draft save (nothing stored) and a pre-change draft is refused at publish, both pinned on the real protocol paths with a precision: 1 control.

S1 (should-fix) — the prescription is wrong on currency, one of the five types the refusal and the entry name. PRECISION_LOWER_BOUND_MESSAGE (field.zod.ts 1331-1336) says, for every type, "Decimal places are scale — a whole number declares scale: 0, not precision: 0. Declare the total digits (precision: 10, scale: 2 …)". The same schema refuses scale on a currency field (field.zod.ts 4097-4108: "scale is not valid on a currency field — delete the key. A currency amount's decimal places are its currency's, not a field setting", ruling 5805782503), and the comment directly above the changed line says not to conflate this count with a currency's decimal places. So on a currency field both spellings the sentence offers are refused; only its last clause (omit precision) is legal there. Currency is where the misreading is most natural (zero decimals for JPY): this diff's own ['JPY', 0] fixture was that reading, and Studio offers precision on currency while offering no scale. The entry repeats it: surface lists currency, replacement gives "scale: 0 and no precision" for a whole number, with no currency arm. The message's own docblock claims the author "can fix the declaration from the refusal alone"; on currency the author takes a second 422. Fix: one type-neutral clause in the message and one arm in the entry's replacement saying that on a currency field decimal places are the currency's own, scale is refused there, and the fix is to delete precision (or declare a positive total); the changeset's one-line fix can say the same. A pin on { type: 'currency', precision: 0 } asserting that clause would hold it.

N1 (nit) — the entry's surface names defineStack({ objects }), object-extension fields and the object metadata item, and omits the standalone field metadata type, which parses the same FieldSchema at the save door. No effect on the refusal or on relevantWhen; accepted deviation, or folded into the S1 edit.

N2 (nit) — the second door pin (pre-change draft refused at publish) asserts that an issue sits at fields.headcount.precision and not that its message names scale, which the first pin does assert. Accepted deviation.

field.test.ts, currency-precision-iso4217.test.ts, the two relevance tables and the door test agree with the contract sentence by sentence apart from S1's missing currency case; packages/spec/docs/references/system/migration{,.part-2}.md carry the regenerated describe row and nothing else.

One should-fix (S1), no must-fix. S1's fix moves the head on field.zod.ts and the entry, so it owes a delta review.

Implemented-by: claude/project-thread-wxsz4m
Reviewed-by: session_01Utp6CYUove7YBXgHy4iEsr

VERDICT: PASS

…precision` (#39173)

Review round on PR #39211:
- S1: `scale` is refused on `currency`, so the refusal sentence and the
  ADR-0087 entry's replacement now carry a currency arm (delete
  `precision`; the currency decides the decimal places). Pinned on
  `{ type: 'currency', precision: 0 }`.
- N1: the entry's surface names a standalone `field` metadata item.
- N2: the publish-door pin asserts the refusal sentence names `scale: 0`.
- Changeset: Skills-docs follow-up #39213; quoted message updated.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0f0dae4fac6d46b8a2b63fa7f4531d82d05e34e5
Local-runs: none
Scope: packages/spec/src/data/field.zod.ts, packages/spec/src/migrations/entries/semantic/19.field-precision-zero-refused.ts, packages/spec/src/data/field.test.ts, packages/spec/src/data/currency-precision-iso4217.test.ts, packages/spec/src/migrations/semantic-relevance.test.ts, packages/spec/src/migrations/semantic-relevance-coverage-38929.test.ts, packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts, packages/spec/docs/references/system/migration.md, packages/spec/docs/references/system/migration.part-2.md + packages/objectql/src/validation/record-validator.ts, packages/objectql/src/registry.ts, packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-diff-delete-load.ts, packages/metadata-protocol/src/protocol-save.ts, packages/spec/src/kernel/metadata-type-schemas.ts, packages/spec/src/kernel/metadata-plugin.zod.ts, packages/spec/src/conversions/entries/18/field-malformed-scale-precision-removed.ts, packages/spec/src/ui/view.zod.ts (cited code outside the diff, read only)
Security-touching: no
Rule-change-verified: none

Delta review of the fix round, by the reviewer of record 7363940829 (head 545b7514). The new head is one commit on top of that head (0f0dae4f, parent 545b7514, no merge of main). It moves five files: the changeset (prose face) and four files already in the reviewed floor — field.zod.ts, the entry, field.test.ts and the door test. Nothing outside the reviewed scope entered; the net diff against main is the same 12 files. Inputs read: the delta between the two heads, the net diff, the PR body, card #39173 and its comments (none added since the first record), and the check-runs on this head. Every judgment of record 7363940829 on a hunk this delta does not touch stands unchanged.

S1: closed

N1: closed

N2: closed

① Derived judgments

  • Accept-set: unchanged by the delta. FieldSchema.precision is still z.number().int().min(1, …); the narrowing is the one judged right in record 7363940829 (integers from 0 become integers from 1; the removed value admitted only 0 at the write seam). No accepted value, key or type is added.
  • Refusal sentence: text changed, envelope unchanged. Code too_small at path precision; the sentence still contains "positive integer", "total digit count" and "scale: 0", so the spec: Field.scale accepts meaningless declarations (2.5, -1) — now that scale is enforced, malformed declarations should be refused at authoring time #8321 pin, the first-round spec pins and both door pins read the same message they assert.
  • .describe() untouched, so the four regenerated reference tables stay current and no regeneration is owed.
  • Upgrade guide. The entry keeps its id, relevantWhen and acceptance criteria; surface and replacement text changed. The two relevance tables are untouched and still match.
  • Correction to record 7363940829, ①, second bullet. It said the standalone field metadata type refuses precision: 0 "with the same sentence" at the save door. The schema is FieldSchema there (kernel/metadata-type-schemas.ts), but the door does not reach the parse for that type: field is code-only (allowRuntimeCreate: false and allowEnvironmentOverlay: false in kernel/metadata-plugin.zod.ts, ruling on meta-field-write-inert: an accepted field PUT never reaches the object — a runtime-created field is stored valid=true and is absent from fields forever #7893), so protocol-save.ts answers NOT_CREATABLE or NOT_OVERRIDABLE first; only the operator hatch OS_METADATA_WRITABLE=field carries a field write to the parse. See N3.

② Semver level

@objectstack/spec minor: still matches narrowed. The changeset keeps the BREAKING banner, both declaration lines, FROM → TO, the one-line fix and the one ADR-0087 marker (registered field-precision-zero-refused). Its Skills-docs: line now reads follow-up #39213, the same value as the PR body. The refusal it quotes is the source's sentence, word for word. Check Changeset: success on this head.

③ Boundary flags

  • No new dev flag or open_questions entry arrived with the delta; the flags answered in record 7363940829 stay answered.
  • Check-runs on this head: 67 success, 12 skipped, 1 cancelled. The cancelled run is PR-body guards (claim · duplicate · Part-of · single-writer path); the same check has a later run on this head that concluded success. Test Core, the four Type Check families, Governed Surface Queue Guard, Spec property liveness, and Dogfood battery with its three shards: success. No run concluded failure.
  • SQL push-down: no query, id materialisation or in-app join in the delta.
  • PR author objectstack-fleet[bot]; the PR is a draft with no auto-merge armed.

④ Design judgment

S1, the currency arm: true to the schema, and the prescription works.

  • PRECISION_LOWER_BOUND_MESSAGE (field.zod.ts from 1334) now reads: decimal places "are not declared with precision: on a number, percent, rating or slider field they are scale (a whole number declares scale: 0, not precision: 0); on a currency field they are the currency's own and scale is refused there, so delete precision", then the total-digit examples with a currency one (precision: 12).
  • scale is refused on currency: field.zod.ts 4102 adds a custom issue at scale for any authored value ("scale is not valid on a currency field — delete the key"). It is the only type refusal of scale on FieldSchema; the four types the sentence sends to scale are the four the scale describe names and the write seam enforces.
  • Deleting precision is a working fix there: the new spec case parses { type: 'currency' } and { type: 'currency', precision: 12 }, and Test Core is green on this head. So every spelling the sentence now offers a currency author is one the schema accepts, and the sentence agrees with the comment above the key (do not conflate this count with a currency's decimal places) and with ruling 5805782503's wording.
  • The entry's replacement carries the same arm ("on a currency field, delete precision: its decimal places are the currency's own and scale is refused there"), and the new case pins the clause on { type: 'currency', precision: 0 }.

N2: the publish pin now asserts that the issue's message contains "scale: 0", as the save pin does.

N1: the entry's surface now names "a standalone field metadata item". That closes N1 as written, and N1 as written was partly wrong, which leaves:

N3 (nit) — the surface clause "an object metadata item or a standalone field metadata item saved through the metadata save door" over-includes. The save door refuses every field write as code-only before the parse (see ①), so the precision sentence answers a field save only under OS_METADATA_WRITABLE=field. The clause came from this reviewer's N1, whose claim about the door was mistaken; the dev implemented it faithfully. No effect on what is refused, on relevantWhen or on any author's fix: a field save carrying precision: 0 is refused on both routes. Accepted deviation; if the entry is ever edited for another reason, the clause can drop "saved through the metadata save door" for the field item or drop the item.

The floor's untouched files (currency-precision-iso4217.test.ts, the two relevance tables, the two packages/spec/docs tables) are byte-identical to the head record 7363940829 judged.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-wxsz4m
Reviewed-by: session_01Utp6CYUove7YBXgHy4iEsr

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr

维护者速读

  • 做了什么:字段写 precision: 0(本意多半是「不要小数」,实际只能存 0)现在在保存和发布时被拒,报错直接告诉作者改成 scale: 0;货币字段则提示删掉 precision。
  • 范围:收紧契约(narrowing),已登记迁移条目 field-precision-zero-refused;已存对象不改写,下次保存时才要求修正。
  • 要你做什么:无,区内落地。
  • 风险:低;precision ≥ 1 的行为完全不变,dogfood 电池全绿。

席位核对

ACCEPT — head 0f0dae4fac6d46b8a2b63fa7f4531d82d05e34e5 (#39173, zone data-p2).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 3, 2026 01:43
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 3, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr

维护者速读

  • 改了什么:字段写 precision: 0 时(作者本意多半是「不要小数」,结果是除 0 以外的值都存不进去),现在在 os validate、defineStack、元数据保存和对象草稿发布时都会被拒。报错会直接告诉作者怎么改:数字类字段改成 scale: 0,货币字段删掉 precision。已登记 ADR-0087 语义迁移条目 field-precision-zero-refused。已存对象不会被改写,下次保存时才要求修正。
  • 为什么:39173 数字字段 precision: 0 能发布,之后每条非零数据都被拒:发布判定应先拦下 #39173。precision 是总位数,写 0 时字段只能存 0。
  • 风险:这是一次收窄(Clause-②: no (narrowing),Metadata-protocol: narrowed),标题 fix(spec)!,带 BREAKING 横幅(FROM → TO)。precision ≥ 1 的行为完全不变。dogfood 电池在本 head 全绿。
  • 为什么交给你:按 2026-11-19 在 governance: the guard scripts join the governed register, .claude/** lands by declared rule-change, and a narrowed spec change lands only by the maintainer #35321 上的 narrowed-spec 裁定,声明收窄的 PR 按 Tier H 落地。Governed Surface Guard(run 47013975269)在 02:02Z 把它移出了队列。check-governed-merges 只看路径,判成了不受管,区域落地时漏看了这一点。区域在 01:43Z 的落地(7364661931 里的落地条款)作废,区域不会重新入队。
  • 要你做什么:批准,并由授权账号入队。席位 ACCEPT 7364661931;契约复核 PASS 7363940829,delta PASS 7364635898(S1: closed);Head-sha 0f0dae4fac6d46b8a2b63fa7f4531d82d05e34e5。

席位意见:ACCEPT。这次收窄是有意的、已声明的,迁移只要改一行。剩下一条 nit(N3:迁移条目说独立的 field 元数据也走保存口,实际上保存口把 field 当作只能写在代码里)只是措辞问题。skills 文案由 #39213 跟进。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 3, 2026
@objectstack-fleet
objectstack-fleet Bot requested a review from os-zhuang December 3, 2026 02:04
@os-zhuang
os-zhuang added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 2b06762 Dec 3, 2026
87 of 88 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-wxsz4m branch December 3, 2026 02:35
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 needs:dogfood-battery pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue protocol:data size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

39173 数字字段 precision: 0 能发布,之后每条非零数据都被拒:发布判定应先拦下

2 participants