Skip to content

Contract test: all 9 basic-case examples fail schema validation - #1

Merged
oddtitoreal merged 2 commits into
mainfrom
fix/example-schema-contract-tests
Aug 13, 2026
Merged

oddtitoreal merged 2 commits into
mainfrom
fix/example-schema-contract-tests

Conversation

@oddtitoreal

Copy link
Copy Markdown
Owner

ISSUE-esempi-non-validano.md (già pronto nella cartella verifica-framework

…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.

@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: ce547117a4

ℹ️ 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 tests/test_examples.py
details = "\n".join(
f" - {'/'.join(map(str, e.path)) or '(root)'}: {e.message}" for e in errors
)
pytest.fail(f"{example_name} fails {schema_name} ({len(errors)} errors):\n{details}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fix the examples before enforcing validation

Every mapped example currently sets meta.validated_by_human to true, while all nine mapped schemas require it to be false, so every parametrized case reaches this unconditional failure. The checked GitHub Actions workflow runs the complete pytest suite, meaning this commit makes CI fail on every push and pull request until the fixtures or schemas are corrected alongside the test.

Useful? React with 👍 / 👎.

Comment thread tests/test_examples.py
assert example_path.exists(), f"missing example: {example_path}"
assert schema_path.exists(), f"missing schema: {schema_path}"

validator = Draft202012Validator(_load(schema_path))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enable format checks in the schema validator

When an example contains an invalid generated_at or refusal date, constructing Draft202012Validator without a FormatChecker ignores the schemas' date-time formats, so this contract test can pass an example that runtime validation rejects. src/specula_agent/schemas.py::validate_artifact explicitly supplies format_checker=FormatChecker(); this test should use the same behavior to guard the shipped examples accurately.

Useful? React with 👍 / 👎.

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.
@oddtitoreal
oddtitoreal merged commit cc990eb into main Aug 13, 2026
2 checks passed
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