Fix/example schema contract tests - #2
Conversation
…ples Adds tests/test_examples.py which validates every examples/basic-case/*.json against its phase schema, plus a guard that fails on unmapped examples. Currently fails 9/9, exposing the examples<->schema drift.
Regenerates all 9 examples/basic-case/*.json to conform to schemas/: - meta.validated_by_human -> false (draft state) - canonical meta.mode per phase (convergence, brand_archaeology, refusal_register, narrative_synthesis, community_cocreation, ...) - payload restructured to schema shape (brand_dna, competitive_map/ white_spaces, prototypes, refusals, narrative_system, co_creation, guardian_report), removing fields barred by additionalProperties:false All 9 now pass tests/test_examples.py; full suite 30 passed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d872f5009f
ℹ️ 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".
| "how_tested": "6-month pilot with voting mechanism for 20 contested titles", | ||
| "expected_insight": "What level of community participation can we sustain without overwhelm?", | ||
| "governance_question": "Does participatory curation strengthen community ownership or create conflict?" | ||
| "prototype_id": "proto-civic-hub", |
There was a problem hiding this comment.
Update the walkthrough to match the rewritten examples
When readers follow the companion examples/basic-case/README.md, its Phase 3 section still describes three delegated/participatory/algorithmic governance prototypes, while this artifact now contains two civic-hub/federated-network service prototypes; the Phase 2 and 4–6 descriptions are similarly based on the removed payloads. Because the README presents these files as a complete worked example and template, it now teaches content and structures that users will not find in the JSON, so it should be updated alongside the rewrite.
Useful? React with 👍 / 👎.
| assert example_path.exists(), f"missing example: {example_path}" | ||
| assert schema_path.exists(), f"missing schema: {schema_path}" | ||
|
|
||
| validator = Draft202012Validator(_load(schema_path)) |
There was a problem hiding this comment.
Enforce schema formats in the contract test
When an example contains a malformed generated_at or refusal date, this test still passes because jsonschema treats format as annotation unless a format checker is supplied. The runtime validator in src/specula_agent/schemas.py uses FormatChecker(), so the new contract test does not actually enforce the same schema contract and can allow an example that production validation rejects.
Useful? React with 👍 / 👎.
No description provided.