Repository navigation
fix(spec)!: a field's precision: 0 is refused at save and publish, naming scale - #39211
Conversation
…scale (red) Claude-Session: https://claude.ai/code/session_01Utp6CZrpGx11Siz7rMLiFi Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZrpGx11Siz7rMLiFi Co-authored-by: Claude <noreply@anthropic.com>
…e precision: 0 out of the legal pin Claude-Session: https://claude.ai/code/session_01Utp6CZrpGx11Siz7rMLiFi Co-authored-by: Claude <noreply@anthropic.com>
…ade guide Claude-Session: https://claude.ai/code/session_01Utp6CZrpGx11Siz7rMLiFi Co-authored-by: Claude <noreply@anthropic.com>
…ld's precision: 0 Claude-Session: https://claude.ai/code/session_01Utp6CZrpGx11Siz7rMLiFi Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZrpGx11Siz7rMLiFi Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 8 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 183 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
…lest legal count Claude-Session: https://claude.ai/code/session_01Utp6CZrpGx11Siz7rMLiFi Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr Contract reviewServed-tier: Narrowing face ( ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing itself, against the published spec on S1 (should-fix) — the prescription is wrong on N1 (nit) — the entry's N2 (nit) — the second door pin (pre-change draft refused at publish) asserts that an issue sits at
One should-fix (S1), no must-fix. S1's fix moves the head on Implemented-by: 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>
|
repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr Contract reviewServed-tier: Delta review of the fix round, by the reviewer of record 7363940829 (head S1: closed N1: closed N2: closed ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentS1, the currency arm: true to the schema, and the prescription works.
N2: the publish pin now asserts that the issue's message contains " N1: the entry's N3 (nit) — the The floor's untouched files ( No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr 维护者速读
席位核对ACCEPT — head
|
|
repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr 维护者速读
席位意见:ACCEPT。这次收窄是有意的、已声明的,迁移只要改一行。剩下一条 nit(N3:迁移条目说独立的 |
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
维护者速读
What changes
precisionis a field's TOTAL digit count (thepof a DECIMAL(p, s)), enforced on every write asmax_precision. Soprecision: 0admits 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.precisiongoes fromz.number().int().min(0)toz.number().int().min(1, { message: PRECISION_LOWER_BOUND_MESSAGE }). The message is module-private, beside the existingSCALE_UPPER_BOUND_MESSAGEprecedent, and reads: "precisionmust be a positive integer: it is the total digit count of the value (thepof a DECIMAL(p, s), integer and decimal digits together), soprecision: 0would admit only the value 0 and refuse every other write. Decimal places are not declared withprecision: on anumber,percent,ratingorsliderfield they arescale(a whole number declaresscale: 0, notprecision: 0); on acurrencyfield they are the currency's own andscaleis refused there, so deleteprecision. Declare the total digits (precision: 10, scale: 2holds up to 99999999.99; on a currency,precision: 12), or omitprecisionfor no digit limit." The.describe()now says "positive integer;precision: 0is refused". This follows theminLengthlower-bound precedent in the same file: "no limit" is written by omitting the key.ObjectSchema(protocol-save.ts,resolveOverlaySchema), and the publish re-parses a stored object draft (promotedObjectDraftSpecRefusal). Both reachFieldSchema, so the bound alone refuses the declaration at save and at publish, and also atos validateanddefineStack.19.field-precision-zero-refused.ts(relevantWhencoversobjectsandobjectExtensions), with its rows insemantic-relevance.test.tsand in the FIELD list ofsemantic-relevance-coverage-38929.test.ts. No D2 conversion: dropping the key would make every value writable, and whether the author meantscale: 0or a real digit bound is theirs to decide.content/docs/references/data/{field,object}.mdxandpackages/spec/docs/references/system/migration{,.part-2}.md(check:generated --fix, only the one stale artifact).@objectstack/specminor, BREAKING banner, FROM → TO, the one-line fix, and the stored-row behaviour.Stored metadata, measured from the code (not booted end to end):
422 INVALID_METADATAatfields.FIELD.precision. This is pinned below.SchemaRegistryregistration 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.os validate/defineStack.Tests
packages/spec/src/data/field.test.ts, new top-level describe: the measured body is refusedtoo_smallat[precision], with a message naming the total digit count and`scale: 0`. Also refused:precision: 0on each ofnumber/currency/percent/rating/slider, andObjectSchemaatfields.employees.precision.precision1, 1+2, 18+2 and 10+0, andscale: 0alone, all parse byte-identically. Oncurrency, the sentence carries the currency arm ("scaleis refused there, so deleteprecision"), and the currency field withoutprecision, or withprecision: 12, parses.packages/spec/src/data/field.test.ts, existing spec:Field.scaleaccepts 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 forprecision: -1reads "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:422 INVALID_METADATAatfields.headcount.precision, with the sentence naming`scale: 0`, and nothing is stored;`scale: 0`, and stays a draft;precision: 1saves and publishes.cf44d851(the test commit, before the fix).ablation-replace.mjs:.min(1, { message })→.min(0, …), rebuilt, marker proved indist/. Result: 8 spec cases red (the 7 new ones plusprecision: -1) and the 2 door refusals red, with CONTROL green. Restored with blob == HEAD and the marker proved absent fromdist/. After the restore: specfield.test.ts+src/migrations581 passed, door file 12 passed.Review round (
0f0dae4f, after review 7363940829): the currency arm in the sentence and in the entry'sreplacement(S1), a standalonefielditem in the entry'ssurface(N1), the publish pin asserting the sentence (N2). Re-run locally: spec build,field.test.ts+currency-precision-iso4217.test.ts+src/migrations603 passed, door file 12 passed,check:generated,check:upgrade-guide,check:spec-changes,check:liveness,check:adr-0087-registrationgreen.Acceptance notes
FormFieldSchema.precision(packages/spec/src/ui/view.zod.ts, the form row's override) keeps.min(0), andview.test.tspinsprecision: 0legal there. A form row'sprecisionis 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'sprecision).packages/objectql/src/validation/record-validator.precision.test.tsstill pins the runtime behaviour of a rawprecision: 0definition (only 0 fits). That stays true for an active stored row, so the pin is kept.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 namingscale: 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 --commandsderived 120 families. They ran at3d7870f3. Theorigin/mainmerge9eb9de93brought no change underpackages/specorpackages/metadata-protocol. At9eb9de93: spec build,check:generated(14 of 14 up to date) and the targeted spec tests were re-run green.--ranreconciliation: 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-erasuretimed out at the local 300 s cap,check:type-check-debtwas killed by a container restart). One family recorded red:check:dts-closureexit 1. It lists missing.d.tsincore,formula,lint,driver-sqlanddriver-sqlite-wasm, which this checkout built withOS_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-protocoltypecheck is NOT MEASURED locally; CI runs it.climigrate-meta-engine-guidance.test.ts: 3 passed.Generated by Claude Code