Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/39213-data-skill-precision-total-digits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@objectstack/skills': patch
---

docs(skills): the data skill says what `precision` counts

Clause-②: no
Metadata-protocol: none

`skills/objectstack-data/rules/field-types.md` listed `precision` on the `number` and `percent` rows with no explanation, and an author reading it wrote `precision: 0` to mean "no decimal places", which the spec now refuses. Both rows now say what the refusal says: `precision` is the total digit count, at least 1, and decimal places are `scale`. Nothing about `currency` changes: its row names neither key, and `scale` stays untaught there because a currency field refuses it.

Two restatements in the same file are cut to pay for most of it; the file goes from 18262 to 18304 bytes.
15 changes: 14 additions & 1 deletion scripts/check-skills-token-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,20 @@ export const CEILINGS = new Map([
// AT the measurement. Raise path: ruling record 6513306068, letter B; the standing ruling
// (2026-10-27, verbatim and untranslated): 「A:先削重复,余额按实测提高」.
// ceil($(wc -c < skills/objectstack-data/rules/field-types.md) / 4) == ceil(18262 / 4)
['skills/objectstack-data/rules/field-types.md', 4566],
// 4566 -> 4576 (#39213): the `number` and `percent` rows gloss `precision` as the spec's
// refusal does (`PRECISION_LOWER_BOUND_MESSAGE`): total digits, at least 1, decimal places
// are `scale`; +100 bytes, 50 a row. PAID DOWN FIRST by two same-file restatement cuts, 58
// bytes (11 + 47): "equivalent" before the `Field.*` factory (home: "same schema", in
// the same sentence) and "and it implies nothing about the column" under `## Changing a
// field that has data` (home: that paragraph's bold opening, `required` is not the
// `NOT NULL` dial). `wc -c` = 18304 bytes (+42) -> ceil(18304 / 4) = 4576 tokens, zero
// headroom, ceiling +10, the measured remainder, pinned AT the measurement. Raise path: the
// standing ruling (2026-10-27, verbatim and untranslated): 「A:先削重复,余额按实测提高」,
// ruling record 6513306068; and, for a remainder of at most 10 tokens, the standing note
// 7216253348 on the ratchet card, the maintainer's words of 2026-11-27 05:20Z, verbatim and
// untranslated: 「后续遇到这种问题,能适当放宽token 的限制」.
// ceil($(wc -c < skills/objectstack-data/rules/field-types.md) / 4) == ceil(18304 / 4)
['skills/objectstack-data/rules/field-types.md', 4576],
['skills/objectstack-data/rules/indexing.md', 2495], // -746 to the measurement (was 3241)
// 1590 -> 1909 (#32364, 2026-11-11): § Sealing (`seal`) teaches `lifecycle.seal`
// (+1574 B). PAID DOWN FIRST by three same-file restatements (-296 B): the ❌
Expand Down
10 changes: 5 additions & 5 deletions skills/objectstack-data/rules/field-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## Two spellings: `Field.*` factory or object literal

The tables below give the **object-literal** spelling. Real apps mostly
use the equivalent **`Field.*` factory** — same schema, plus
use the **`Field.*` factory** — same schema, plus
per-helper JSDoc and inference (`Field.lookup`'s const generic is what lets
`defineSeed()` type its reference values). A helper exists for every type below
except a few authored as literals (`tags`, `progress`, `repeater`, `vector`).
Expand Down Expand Up @@ -48,9 +48,9 @@ const fields = {

| Type | When to Use | Config |
|:-----|:------------|:-------|
| `number` | Numeric value | `min`, `max`, `precision`, `scale`, `unitConfig` (→ Unit of measure) |
| `number` | Numeric value | `min`, `max`, `precision` (total digits, ≥ 1; decimal places are `scale`), `scale`, `unitConfig` (→ Unit of measure) |
| `currency` | Monetary amounts | `currencyConfig` (→ Currency) |
| `percent` | Percentage; stored as a fraction (0-1) unless the field declares `max` above 1 (`max: 100`), then whole points; seeds, defaults, API values use that scale | `min`, `max`, `precision`, `percentDisplay` — the read-only face: unset or `'bar'` draws a progress bar, `'plain'` the number alone, for a rate or a probability |
| `percent` | Percentage; stored as a fraction (0-1) unless the field declares `max` above 1 (`max: 100`), then whole points; seeds, defaults, API values use that scale | `min`, `max`, `precision` (total digits, ≥ 1; decimal places are `scale`), `percentDisplay` — the read-only face: unset or `'bar'` draws a progress bar, `'plain'` the number alone, for a rate or a probability |

## Date & Time

Expand Down Expand Up @@ -331,8 +331,8 @@ Beyond `SKILL.md` trap 1:
| declared index removed, or its columns changed | `os migrate apply` (`--allow-destructive` when it drops, or rebuilds as `UNIQUE`) |

**`required` is not the `NOT NULL` dial.** `required` is the
**write contract** — the engine refuses an insert that omits the value — and it
implies nothing about the column. The physical constraint is a separate explicit
**write contract**: the engine refuses an insert that omits the value.
The physical constraint is a separate explicit
opt-in, `storage: { notNull: true }`, and it is what drift detection compares
against. So tightening `required` on a deployed object is safe (existing null
rows stay readable), while declaring `storage.notNull` over null rows is a
Expand Down
Loading