vectors(v4): P0-6 — v4 GA strict cross-impl test vectors (Python + TypeScript)#46
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 — thev4.0.0-preview.1vectors undertests/vectors_v40_preview.jsonare unchanged.profile_kindlearner / team / agent / creator / learner+gaming) plus 1 unifiedencrypted=trueenvelope to pin the envelope-v3 contract retained in v4 (SPEC §33.10 chore: publication hygiene v3.5.1 + RFC-001 media_profile draft #2).media_profile), RFC-002 v1 (verification_gates,human_veto_policy,claim_sources), RFC-004 v1 (migration), and the strict unified envelope.verify_vectors.py: schema-strictjsonschema+ assertions; JSverify_vectors.mjs: structural rule mirror — no Ajv dep required at root).Scope guardrails (preserved)
4.0.0-preview.1.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)
v4.0-ga-neg-invalid-gate-levelpayload_schema_versionrequiredv4.0-ga-neg-missing-payload-schema-versionpayload_schema_versionenumv4.0-ga-neg-unsupported-payload-schema-versionhashv4.0-ga-neg-media-entry-missing-hashmodalityclosed enumv4.0-ga-neg-media-modality-not-in-v1-enumhash.algo === "blake3"v4.0-ga-neg-media-hash-algo-not-blake3human_veto_policy.min_levelenumv4.0-ga-neg-human-veto-min-level-invalidv4.0-ga-neg-encrypted-missing-kdf-cipher-ciphertextklickd_versionmajor in {3,4}v4.0-ga-neg-unified-bad-klickd-versionmigration.migrated_atRFC 3339 Zv4.0-ga-neg-migration-bad-timestampgateEntry.additionalProperties: falsev4.0-ga-neg-gate-entry-extra-fieldhuman_veto_policy.additionalProperties: falsev4.0-ga-neg-human-veto-additional-propertyTest plan
python3 verify_vectors.py— 77/77 passed (was 59/59 before P0-6; +18 GA vectors)node verify_vectors.mjs(root, withhash-wasminstalled) — 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 cleancd packages/@klickd/core && npm test— Jest 96/96 passed (unchanged)tests/vectors_v40_preview.jsonnot touched; preview suite still 7/7 in both runnerspackages/pypi/klickd/pyproject.tomlorpackages/@klickd/core/package.json