Skip to content

feat(schema): add length stamps for provenance and source payloads - #31

Merged
fj-nurok merged 3 commits into
mainfrom
fj-dev
Jul 17, 2026
Merged

feat(schema): add length stamps for provenance and source payloads#31
fj-nurok merged 3 commits into
mainfrom
fj-dev

Conversation

@fj-nurok

Copy link
Copy Markdown
Contributor

Summary

Closes #29.

Every hosted-payload *_hash in v1 now has an optional *_length size-hint
companion. Two were missing:

  • provenance_length on the section — companion to provenance_hash (the
    sidecar bytes).
  • source content_length — companion to the source content_hash (the
    captured-evidence bytes; one length covers both type: file and capture_uri
    bytes, so no separate capture_length).

Both are { "type": "integer", "minimum": 0 }, optional — the same advisory,
untrusted size hint already carried by section content_length and
guide_length, extended to the remaining payloads.

Everything moves together, per the "spec + running code" rule:

  • Schemaschema/v1/openakb.schema.json + both vendored copies
    (byte-identical; check-schema-sync.sh green).
  • Specspecs/v1/spec.md: §4.2 and §4.3 field tables, the §5 serve
    table, and the §5.1 detach procedure. Placement in detach reflects lifetime:
    provenance_length is a publish-time stamp that goes stale after edits (step-4
    keep-list, beside provenance_hash); source content_length describes
    immutable capture bytes (step 1, beside source content_hash).
  • Exampleswidget-platform (authoring) and widget-platform-served
    (served), stamped with the real byte counts of the referenced payloads (537 B
    sidecar, 750 B capture).
  • Validators — no code change (the strict-mode allowlist is derived from the
    schema's properties). Version bumps only: python 0.1.1 → 0.1.2, rust
    0.1.0 → 0.1.1, with lockfiles and the python version-pin test updated.

provenance.schema.json is unaffected — the fields are descriptor-side pointers,
not sidecar contents.

Test coverage: the new fields are exercised end-to-end in both packages —
test_example_validates (Python) and test_examples_validate (Rust) validate
the stamped served + authoring examples in strict mode, asserting the fields
are accepted and not flagged AKB006. This is the round-trip coverage the issue
recommends; the minimum: 0 → AKB011 constraint is already pinned by the
representative test_negative_guide_length.

Type of change

  • Docs / tooling / CI (non-normative)
  • Normative change (schema/spec) — must include validator, conformance, and example updates
  • Enhancement proposal (AKEP)

Checklist

  • Commits are signed off for the DCO (git commit -s).
  • No real product or company names — content is vendor-neutral (see AGENTS.md).
  • Markdown, links, and workflows lint clean locally.
  • For a normative change: spec + schema + validator + conformance + example all land in this PR.
  • CHANGELOG.md updated if the change is notable.

Completes the (hash, length) pairing across every hosted payload: adds
optional `provenance_length` (section, companion to `provenance_hash`) and
source `content_length` (companion to source `content_hash`), mirroring the
existing section `content_length` / `guide_length` size hints. Both are
advisory, untrusted size hints for pull budgeting, never content-verified.

Lands spec, schema, and running code together (AGENTS.md):

- schema/v1/openakb.schema.json plus both byte-identical vendored copies
- specs/v1/spec.md: field tables (§4.2, §4.3), the §5 serve table, and the
  §5.1 detach procedure (provenance_length is a publish-time stamp that goes
  stale after edits -> step 4 keep-list; source content_length describes the
  immutable capture bytes -> step 1, alongside source content_hash)
- widget-platform (authoring) and widget-platform-served examples, stamped
  with the real byte counts of the referenced payloads
- validator version bumps: python 0.1.1 -> 0.1.2, rust 0.1.0 -> 0.1.1. The
  strict-mode known-member allowlist is derived from the schema properties,
  so recognizing the new fields needs no validator code change.

Closes #29

Signed-off-by: Frank Fang <fj@nurok.ai>
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c1968edec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread schema/v1/openakb.schema.json
Comment thread specs/v1/spec.md Outdated
Comment thread specs/v1/spec.md
… scope

Follow-up on the length-stamp review (#29):

- conformance: add a valid fixture exercising all four length stamps
  (strict-clean and agreed across both validators) plus an invalid
  negative-length fixture (AKB011), so the shared cross-validator suite
  covers the new fields — AGENTS.md requires conformance to move with a
  schema/spec change.
- spec §4.2: a redacted source omits `content_length` too, so a withheld
  source's captured size stays undisclosed.
- spec §5 serve table: qualify the publish-time row as section
  `content_length` now that Source also carries a `content_length`.

Refs #29

Signed-off-by: Frank Fang <fj@nurok.ai>
@fj-nurok

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f47b115a80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread specs/v1/spec.md Outdated
Follow-up review (#29): now that Source also has `content_length`, the §5.1
detach step-4 keep-list qualifies the section `content_hash`/`content_length`,
`provenance_*`, and top-level `guide_*` stamps, and states explicitly that
source `content_hash`/`content_length` are excluded — they pin immutable
capture evidence (step 1) and stay truthful across section edits, so a detach
tool must not drop the captured size on the first section edit.

Refs #29

Signed-off-by: Frank Fang <fj@nurok.ai>
@fj-nurok
fj-nurok merged commit abfdad0 into main Jul 17, 2026
11 checks passed
@fj-nurok
fj-nurok deleted the fj-dev branch July 17, 2026 19:30
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.

Add optional length stamps for provenance, file-source, and capture payloads (provenance_length, source content_length)

1 participant