Skip to content

fix: JSON output can violate the v1 schema for non-integer transcript ordinals #56

Closed

Description

@abruption

What happened

--json output can fail validation against the published schemas/codex-unlock-v1.schema.json when the last transcript record carries a non-integer or negative ordinal.

The parser accepts any JavaScript number, while the schema requires integer | null with minimum: 0. With ordinal: 1.5 or ordinal: -1 in the last rollout record, both inspect --json (exit 0) and unlock --json (exit 2) produce documents that ajv rejects (/transcript/lastRecord/ordinal must be integer,null / must be >= 0). ordinal: 3 validates.

What you expected

Every JSON v1 document emitted by the CLI validates against the published schema, because docs/json-v1.md recommends that consumers validate. A single malformed transcript should not make a whole list result, or the result of a completed unlock, fail validation.

Environment

  • codex-unlock 0.4.0 at 6227e6c
  • macOS 27.0 arm64, Node.js 22.14.0, ajv 8 (devDependency)

Source evidence

Acceptance criteria

  • ordinal is emitted only when Number.isSafeInteger(value) && value >= 0; otherwise null.
  • A schema-validation test covers non-integer, negative, and very large ordinals for inspect, list, and unlock outputs.

Scope and limitations

  • ordinal does not influence the safety decision; this is a JSON contract issue.

Checked

Activity

  1. added
    bug
    on Sep 28, 2026
  2. added this to the v0.4.1 milestone on Sep 28, 2026
  3. added a commit that references this issue on Sep 29, 2026
    d533981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions