Skip to content

feat: add research input manifest contract - #271

Closed
Pigbibi wants to merge 2 commits into
mainfrom
codex/shared-research-input-foundation-s0-20260730
Closed

feat: add research input manifest contract#271
Pigbibi wants to merge 2 commits into
mainfrom
codex/shared-research-input-foundation-s0-20260730

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Scope

  • Add the S0 research_input_manifest.v1 JSON Schema and pure in-memory validator.
  • Add focused contract tests.

Boundaries

  • No provider access, data capture, materialization, replay, live behavior, exports, dependencies, packaging, workflows, or existing manifest versions changed.
  • Base: origin/main 5a83f508552bb68115123aa378795325094a7b52.

Tests-first evidence

  • RED on the old base: ModuleNotFoundError: No module named 'quant_platform_kit.data.research_input'.
  • Focused: 4 passed.
  • CI-equivalent: 628 passed, 1 skipped, 22 warnings, 3 subtests passed.
  • Ruff, compileall, dependency-reference, diff, and exact-scope gates passed.

Co-Authored-By: Codex <noreply@openai.com>

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

ℹ️ 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".

"kind": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"artifact_uri": { "type": "string", "minLength": 1, "pattern": "^\\S+$" },
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
"as_of": { "$ref": "#/$defs/date_time" }

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 Encode the manifest cutoff for every input

When an interchange consumer validates only against this schema, an input whose as_of is later than the manifest's as_of is accepted because this property has no cross-field ordering constraint. The Python validator rejects the same payload in _validate_input, so schema-validated research can inadvertently include post-cutoff data and produce look-ahead-biased results; encode this invariant in the published contract as well.

Useful? React with 👍 / 👎.

Comment on lines +12 to +15
"inputs": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/input" }

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 Enforce unique input IDs in the schema

When a manifest is validated through the packaged JSON Schema, inputs may contain multiple records with the same input_id—including conflicting URIs or hashes—because the array has no uniqueness-by-ID constraint. validate_research_input_manifest rejects these records, so the two advertised representations of the contract disagree and schema consumers can receive an ambiguous artifact binding; add the corresponding uniqueness invariant to the array.

Useful? React with 👍 / 👎.

if not isinstance(value, str) or not _RFC3339_DATETIME.fullmatch(value):
raise ResearchInputManifestValidationError()
try:
parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))

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 Preserve sub-microsecond precision in cutoff comparisons

When timestamps contain more than six fractional digits—which the schema and _RFC3339_DATETIME explicitly allow—datetime.fromisoformat truncates the excess precision. For example, a manifest cutoff ending in .0000001Z and an input timestamp ending in .0000002Z both become the same Python datetime, so the future input passes the check at _validate_input; either constrain accepted precision to microseconds or compare without discarding the additional digits.

Useful? React with 👍 / 👎.

Co-Authored-By: Codex <noreply@openai.com>

Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

S0 terminal settlement: FAILED_PARKED. Final read-only auditor rechecked head 107f7cc and found material frozen contract/schema/provenance/strict-readback blockers plus unresolved review threads. One authorized consolidated remediation was exhausted; no third patch/review, no successor PR. Durable terminal event: 4bf18939-e665-45e6-bcec-84b8d0beae39 (SHA 5396de848bedf8c9f304e55ff908e9a7bfb1058265666b5282ba93b74460768b).

@Pigbibi Pigbibi closed this Jul 30, 2026

@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: 107f7cc554

ℹ️ 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 on lines +17 to +18
"created_at": { "$ref": "#/$defs/date_time" },
"as_of": { "$ref": "#/$defs/date_time" },

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 Declare the creation-time ordering in the schema

When a consumer validates only against the published schema, a manifest with created_at earlier than its own as_of cutoff is accepted, even though validate_research_input_manifest rejects it at created_at < manifest_as_of. This leaves schema-based ingestion with a weaker provenance contract than the Python validator; declare the same sibling timestamp-ordering invariant at the schema root.

Useful? React with 👍 / 👎.

Comment on lines +77 to +79
manifest = validate_research_input_manifest(parsed)
if _canonical_json(manifest) != value:
raise ResearchInputManifestValidationError()

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 Reject lone surrogates before canonical encoding

When otherwise valid JSON contains an unpaired UTF-16 escape in artifact_uri (for example \ud800), json.loads accepts the resulting string and metadata validation permits it, but _canonical_json(manifest) raises an uncaught UnicodeEncodeError. Callers catching ResearchInputManifestValidationError can therefore crash on malformed manifest bytes instead of receiving the advertised validation failure; reject surrogate code points or translate this encoding failure.

Useful? React with 👍 / 👎.

Comment on lines +29 to +30
"format": "date-time",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|[+-][0-9]{2}:[0-9]{2})$"

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 Make calendar validation assertive in the schema

When a Draft 2020-12 consumer does not explicitly enable the optional format assertion vocabulary, format: date-time is only an annotation and the accompanying pattern accepts impossible values such as 2026-99-99T99:99:99+99:99. The Python validator rejects those values through datetime.fromisoformat, so schema-only interchange validation can admit manifests that the packaged validator refuses; make date-time validity an asserted part of the schema contract rather than relying on the default format annotation.

Useful? React with 👍 / 👎.

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