Skip to content

docs(contract): §4 — add a JSON scalar-typing clause - #29

Merged
DTTerastar merged 1 commit into
mainfrom
docs/scalar-typing
Aug 2, 2026
Merged

docs(contract): §4 — add a JSON scalar-typing clause#29
DTTerastar merged 1 commit into
mainfrom
docs/scalar-typing

Conversation

@DTTerastar

Copy link
Copy Markdown
Contributor

Closes #27.

Problem

§4 pins down which codecs exist and the stdout/stderr split; §2 pins timestamp formatting. Nothing pinned the JSON type of an individual field — so the same class of bug appeared four times across two repos:

Each was fixed or filed as a local wart. They're one unwritten rule violated repeatedly.

Change (docs only)

A Scalar typing subsection under §4, three requirements:

  1. Numeric quantities are JSON numbers, not quoted strings — even when the upstream sends strings.
  2. A logical field has one JSON type across every subcommand, and is null (not ""/0) when absent.
  3. A human-formatted quantity carries a canonical-unit sibling (sessionDurationSeconds), unit in the key name, additive.

Plus the timestamp carve-out: §2 already fixes their shape, so a date MAY be a formatted string — but the same string across every subcommand of a CLI.

Status table gains a JSON scalar typing row:

crono liftoff withings
JSON scalar typing (§4) human

liftoff is human-attested (fixed #33/#36 in v1.3.0); withings has open violations (#27/#20/#42); crono is unaudited.

Not in this PR

The compat/scalars bundle that would make this machine-attestable. It's a larger piece, and it inherits the enforcement-reach gap #27 itself flags — liftoff and withings currently import only compat/formats, so a scalar bundle won't run in their CI until those imports are widened. Better as its own PR than smuggled into a text change. I can pick it up next if you want it.

🤖 Generated with Claude Code

https://claude.ai/code/session_012MvqxTC64Z9EEDewCUbNNo

Closes #27. §4 pinned down which codecs exist and the stdout/stderr
split, and §2 pins timestamp formatting, but nothing pinned the JSON
type of an individual field. That gap produced the same class of bug
four times across two repos (liftoff #33 quoted-string bodyweight,
liftoff #36 duration-only-as-prose, withings #27/#20/#42
key-and-type drift). One unwritten rule violated repeatedly.

Adds a Scalar typing subsection under §4 with three requirements —
numbers are JSON numbers not strings; a logical field has one type
(and null, not ""/0, when absent) across every subcommand; a
human-formatted quantity ships a canonical-unit sibling — plus the
timestamp carve-out (§2 already fixes their shape).

Status table gains a JSON-scalar-typing row: liftoff is human-attested
(fixed its known violations in v1.3.0), withings and crono stay at —
(withings has open violations #27/#20/#42; crono is unaudited).

Not machine-attested yet: a compat/scalars bundle is the follow-up, and
it inherits the enforcement-reach gap #27 flags — liftoff and withings
import only compat/formats, so a new bundle needs their imports widened
to actually run in their CI. Tracked separately rather than bundled into
this text change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MvqxTC64Z9EEDewCUbNNo
@DTTerastar
DTTerastar enabled auto-merge (squash) August 2, 2026 04:37
@DTTerastar
DTTerastar disabled auto-merge August 2, 2026 04:38
@DTTerastar
DTTerastar merged commit cce757b into main Aug 2, 2026
7 checks passed
@DTTerastar
DTTerastar deleted the docs/scalar-typing branch August 2, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CONTRACT §4: add a scalar-typing clause (numbers not strings, one type per logical field, numeric sibling for human-formatted values)

1 participant