Skip to content

vectors(v4): P0-6 — v4 GA strict cross-impl test vectors (Python + TypeScript)#46

Merged
Davincc77 merged 1 commit into
mainfrom
vectors/v4-ga-strict-p0-6
May 24, 2026
Merged

vectors(v4): P0-6 — v4 GA strict cross-impl test vectors (Python + TypeScript)#46
Davincc77 merged 1 commit into
mainfrom
vectors/v4-ga-strict-p0-6

Conversation

@Davincc77
Copy link
Copy Markdown
Owner

Summary

Lands the P0-6 deliverable from docs/roadmap/ROAD-TO-V4-GA.md: a strict v4 GA test-vector suite that runs identically under the Python cross-impl runner (verify_vectors.py) and the JS cross-impl runner (verify_vectors.mjs). Coexists with the preview suite — the v4.0.0-preview.1 vectors under tests/vectors_v40_preview.json are unchanged.

  • 6 positive vectors covering the 5 personas (profile_kind learner / team / agent / creator / learner+gaming) plus 1 unified encrypted=true envelope to pin the envelope-v3 contract retained in v4 (SPEC §33.10 chore: publication hygiene v3.5.1 + RFC-001 media_profile draft #2).
  • 12 negative vectors, one per frozen rule of RFC-001 v1 (media_profile), RFC-002 v1 (verification_gates, human_veto_policy, claim_sources), RFC-004 v1 (migration), and the strict unified envelope.
  • Both runners pass at parity (Python verify_vectors.py: schema-strict jsonschema + assertions; JS verify_vectors.mjs: structural rule mirror — no Ajv dep required at root).

Scope guardrails (preserved)

  • No SDK version bump — Python and TypeScript packages remain at 4.0.0-preview.1.
  • No npm / PyPI / Zenodo publication.
  • No git tag, no GitHub release.
  • Preview vectors (tests/vectors_v40_preview.json) and all v2.5 / v3.0 vectors are unchanged — continuity proof.

Files changed

  • tests/vectors_v40_ga.json (new, 6 positive)
  • tests/negative_vectors_v40_ga.json (new, 12 negative)
  • verify_vectors.py (+113 lines: run_v40_ga_strict_suite)
  • verify_vectors.mjs (+150 lines: runV40GaStrictSuite + rule mirror)
  • docs/roadmap/ROAD-TO-V4-GA.md (§P0-6 marked PR candidate, fixture filenames pinned)
  • SCHEMA_INDEX.md (cross-impl pointer block under v4 GA strict section)

Negative-rule coverage (per RFC)

Rule (frozen) Vector id
RFC-002 v1 §6 — gate level outside 5-enum v4.0-ga-neg-invalid-gate-level
Strict payload — payload_schema_version required v4.0-ga-neg-missing-payload-schema-version
Strict payload — payload_schema_version enum v4.0-ga-neg-unsupported-payload-schema-version
RFC-001 v1 §4 #3 — media entry requires hash v4.0-ga-neg-media-entry-missing-hash
RFC-001 v1 §4 #3modality closed enum v4.0-ga-neg-media-modality-not-in-v1-enum
RFC-001 v1 §4 #2hash.algo === "blake3" v4.0-ga-neg-media-hash-algo-not-blake3
RFC-002 v1 — human_veto_policy.min_level enum v4.0-ga-neg-human-veto-min-level-invalid
SPEC §33.10 #2 — encrypted MUST carry kdf/cipher/ciphertext v4.0-ga-neg-encrypted-missing-kdf-cipher-ciphertext
Unified envelope — klickd_version major in {3,4} v4.0-ga-neg-unified-bad-klickd-version
RFC-004 v1 — migration.migrated_at RFC 3339 Z v4.0-ga-neg-migration-bad-timestamp
gateEntry.additionalProperties: false v4.0-ga-neg-gate-entry-extra-field
human_veto_policy.additionalProperties: false v4.0-ga-neg-human-veto-additional-property

Test plan

  • python3 verify_vectors.py — 77/77 passed (was 59/59 before P0-6; +18 GA vectors)
  • node verify_vectors.mjs (root, with hash-wasm installed) — 60/60 passed (was 42/42 before P0-6; +18 GA vectors; 0 divergence)
  • python3 scripts/validate_v4_schemas.py — strict schemas accept the 5 personas + preview vectors + reject all 5 documented negatives (unchanged)
  • cd packages/pypi/klickd && pytest — 98 passed / 1 skipped (unchanged)
  • cd packages/@klickd/core && npm run build — esm + cjs + dts clean
  • cd packages/@klickd/core && npm test — Jest 96/96 passed (unchanged)
  • Preview vectors unchanged: tests/vectors_v40_preview.json not touched; preview suite still 7/7 in both runners
  • No SDK / package version bump in either packages/pypi/klickd/pyproject.toml or packages/@klickd/core/package.json

…peScript)

Lands the P0-6 deliverable from docs/roadmap/ROAD-TO-V4-GA.md: a strict
v4 GA test-vector suite that runs identically under the Python
cross-impl runner (verify_vectors.py) and the JS cross-impl runner
(verify_vectors.mjs). Coexists with the preview suite — the
v4.0.0-preview.1 vectors under tests/vectors_v40_preview.json are
unchanged.

New fixtures
- tests/vectors_v40_ga.json — 6 positive cases:
    * 5 personas, one per profile_kind covered by examples/v4/personas/
      (learner FR, team FR, agent EN, creator FR, learner+gaming EN);
      exercise verification_gates v1 (structured + flat-map), human_veto_policy,
      claim_sources v1 (prefer / require_citation_for), media_profile v1
      (document + image + voice entries with blake3 hash + consent),
      and migration (RFC-004 v1 frozen fields).
    * 1 unified vector with encrypted=true to lock in the envelope-v3
      contract retained in v4 per SPEC §33.10 #2
      (kdf + cipher + ciphertext MUST be present).
- tests/negative_vectors_v40_ga.json — 12 rejection cases, one per
  strict rule:
    * gate level outside the v1 frozen enum
    * payload_schema_version missing / outside the strict enum
    * media_profile v1 entry missing required hash / modality outside the
      v1 enum / hash.algo != blake3
    * human_veto_policy.min_level outside the v1 enum
    * unified envelope encrypted=true missing kdf / cipher / ciphertext
    * klickd_version with an unsupported major
    * migration.migrated_at not RFC 3339 Z
    * gateEntry / human_veto_policy with an unknown field
      (additionalProperties: false)

Runners
- verify_vectors.py: new run_v40_ga_strict_suite() validates each
  document with jsonschema (Draft 2020-12) against either the strict
  payload schema (schemas/klickd-payload-v4.schema.json) or the strict
  unified schema (schema/klickd-v4.schema.json), then checks the
  structural assertions block. Negative vectors MUST raise at least one
  schema error. Skips cleanly with a clear message if jsonschema is
  not installed.
- verify_vectors.mjs: new runV40GaStrictSuite() mirrors the Python
  runner. Positive vectors are checked structurally via the same
  assertions block; negative vectors are checked against a small set of
  hand-rolled rules keyed by failure_reason that reflect the strict
  schema (gate-level enum, media-modality enum, blake3 algo, RFC 3339 Z
  timestamp pattern, additionalProperties: false on frozen sub-objects,
  encrypted-envelope completeness). Ajv is not required at root: the
  canonical jsonschema validation is run by scripts/validate_v4_schemas.py
  and by the Python half of this runner; the JS half locks in the same
  shape via the rule mirror so both implementations fail the same
  negatives.

Docs
- docs/roadmap/ROAD-TO-V4-GA.md §P0-6: marked as PR candidate, with the
  exact fixture filenames and the list of frozen rules pinned.
- SCHEMA_INDEX.md: pointer block under the v4 GA strict schemas
  section linking the new fixtures and runners and reaffirming that the
  preview vectors remain intact.

Scope guardrails
- No SDK version bump (Python and TypeScript packages remain at
  4.0.0-preview.1).
- No npm / PyPI / Zenodo publication.
- No git tag, no GitHub release.
- Preview vectors (tests/vectors_v40_preview.json) and all v2.5 / v3.0
  vectors are unchanged.
@Davincc77 Davincc77 merged commit 8e85c2f into main May 24, 2026
3 checks passed
@Davincc77 Davincc77 deleted the vectors/v4-ga-strict-p0-6 branch May 24, 2026 23:21
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.

1 participant