Skip to content

RFC 008 slice 0b: registries, report schema, and severity policy - #1045

Open
zkwentz wants to merge 5 commits into
rfc-008/pr2a-manifestfrom
rfc-008/pr2-contracts
Open

RFC 008 slice 0b: registries, report schema, and severity policy#1045
zkwentz wants to merge 5 commits into
rfc-008/pr2a-manifestfrom
rfc-008/pr2-contracts

Conversation

@zkwentz

@zkwentz zkwentz commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Checkpoint

Stacked on #1044 (slice 0a: types + manifest + fixtures), which stacks on #1041 (RFC). Second half of the slice-0 contracts — the original slice-0 PR (#1042) was split in two for reviewability.

PYTHONPATH=src:envs uv run pytest tests/test_validation/ -v   # 59 passed
python scripts/sync_validation_schemas.py --check              # schemas in sync

Every contract is exercised by a test the day it lands — the "mock API" exists before any implementation.

How to review (~550 lines)

Read in this order:

  1. src/openenv/validation/signature.py — well-known-file detection table, SignatureError / UnsupportedPackageError, and the unsupported-categories list (exit-code-2 contract). GPU is not a category: GPU packages validate on providers with the GPU capability.
  2. parsers/__init__.py, providers/__init__.py, graders/__init__.py — protocols plus working ParserRegistry and GraderRegistry. The load-bearing rule: grader selection reads the manifest only (a conformance test proves two manifests differing only by signature select identically). Third-party graders register via the openenv.validation.graders entry-point group. Providers start subjects under the manifest's declared network policy (default public); enforcing no-network/allowlist needs the NETWORK_POLICY capability.
  3. report.py + policy.py — report models and severity-policy application: hub-lane entries filtered out entirely for local runs (an author never sees a check they can't red-to-green); ERROR fails closed; unknown ids are an internal error.
  4. tests/test_validation/test_policy.py — the verdict semantics, one behavior per test.

Skim only:

  • policies/severity-v1.json — the data table: all 45 check ids (33 local + 12 reserved hub/statistical); tests/test_validation/conftest.py holds the same table as a literal so the file can't drift silently.
  • schemas/report.schema.jsongenerated, CI-checked.
  • test_protocols.py / test_report.py / test_checkpoints.py — fakes and mechanical assertions; test_checkpoints.py is the accretion point every later slice appends to.

Flagged judgment calls (not in the approved design docs)

  1. severity-v1.json bounds are placeholders: max_oracle_tolerance 0.1 · min_floor_margin 0.1 · max_variance_tolerance 0.2 · max_episode_timeout_s 3600.
  2. Reserved hub-lane severities taken from the RFC table; cosign kept warn.
  3. A judge pin declared while llm_judged: false is rejected as a contradiction (strict iff).

Refs #778, #898.

🤖 Generated with Claude Code


Note

Low Risk
Contract and test-only slice with no runtime CLI wiring yet; policy bounds are documented placeholders and verdict logic is heavily unit-tested.

Overview
Adds the second half of RFC 008 slice 0: executable contracts for parsers, graders, providers, structured reports, and versioned severity policy—ahead of a full openenv validate pipeline implementation.

Protocols and registries define Parser/ParserRegistry (signature → manifest), Grader/GraderRegistry (manifest-only selection, entry-point group openenv.validation.graders), and ValidationProvider/RunningSubject for sandbox exec and network policy. Signature module ships detection tables, SignatureError / UnsupportedPackageError, and unsupported categories (GPU is a provider capability, not a reject category).

ValidationReport and CheckResult models embed the normalized manifest; severity-v1.json maps all 45 check ids (local + reserved hub/statistical) with apply_policy as the sole verdict path (ERROR fails closed; local lane hides hub-only ids). Packaging includes policy JSON; schema sync adds report.schema.json.

Tests lock policy completeness against EXPECTED_POLICY, verdict semantics, protocol fakes, checkpoint 0, and CI schema sync.

Reviewed by Cursor Bugbot for commit af44c21. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

bot-ci-comment Bot commented Aug 4, 2026

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@burtenshaw burtenshaw added feature size: large Large pull request labels Aug 4, 2026 — with Cursor
Comment thread src/openenv/validation/graders/__init__.py
Comment thread src/openenv/validation/parsers/__init__.py Dismissed
Comment thread src/openenv/validation/graders/__init__.py Dismissed
Comment thread src/openenv/validation/graders/__init__.py Dismissed
Comment thread src/openenv/validation/providers/__init__.py Dismissed
Comment thread src/openenv/validation/providers/__init__.py Dismissed
Comment thread src/openenv/validation/providers/__init__.py Dismissed
Comment thread src/openenv/validation/policies/severity-v1.json
Comment thread src/openenv/validation/report.py Outdated
@zkwentz
zkwentz force-pushed the rfc-008/pr2-contracts branch from 51c6d01 to 85e9b73 Compare August 4, 2026 19:30
Comment thread src/openenv/validation/graders/__init__.py Outdated
Comment thread src/openenv/validation/graders/__init__.py
zkwentz added a commit that referenced this pull request Aug 4, 2026
…ign warn

Review finding on #1045: the rollup sentence said "30 fail, 9 warn, 1
advisory" but the committed policy carries 34/10/1 over 45 check ids. Both
countings are now stated explicitly, and the per-test tally is corrected to
32 fail (the prior 30 was an arithmetic slip — 30+9+1+2 != 44). Test #8's
row now pins hub.cosign_signature at warn.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
zkwentz added a commit that referenced this pull request Aug 4, 2026
… pinned report version

Bugbot finding: a grader CLASS loaded from an entry point already satisfies
the runtime-checkable Grader protocol (class attributes exist on the class
object), so the isinstance guard skipped instantiation and registered the
class itself — instantiation now keys off isinstance(candidate, type).
Registration also validates requires_capabilities names against
CapabilitiesSpec fields so a typo'd capability errors clearly at register
time instead of crashing at selection. report_schema_version is pinned to
Literal["1"] for parity with the manifest. Regression tests for all three.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zkwentz
zkwentz force-pushed the rfc-008/pr2-contracts branch from 85e9b73 to 81ab9ab Compare August 4, 2026 19:37
zkwentz added a commit that referenced this pull request Aug 4, 2026
Review direction from Zach on #1045: WELL_KNOWN_FILES must not list formats
whose parsers are not implemented in the build. Detection recognizes only
supported formats (entries graduate in with their parsers: openenv.yaml at
the walking skeleton, task.toml with the Harbor parser, task.md with the
PostTrain parser); anything else is refused as unrecognized, exit 2.
parser-not-implemented remains as a defensive registry contract only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
zkwentz and others added 2 commits August 4, 2026 15:47
… 0b (#778, #898)

Second half of the slice-0 contracts: signature detection rules and the
unsupported-categories error contract; Parser/Provider/Grader protocols with
working Parser and Grader registries (third-party graders via the
openenv.validation.graders entry-point group); CheckResult/ValidationReport
models with the committed report JSON Schema; the versioned severity policy
(severity-v1.json, all 45 check ids including reserved hub/statistical ids)
with lane filtering and fail-closed verdict application; and the
conformance tests: policy completeness against the RFC table, protocol
conformance against test-only fakes, report round-trips, and the accreting
checkpoint suite.

No runner, no CLI change, no real grader — those land per vertical slice.

Checkpoint: PYTHONPATH=src:envs pytest tests/test_validation/ -v   # 59 passed
            python scripts/sync_validation_schemas.py --check

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… pinned report version

Bugbot finding: a grader CLASS loaded from an entry point already satisfies
the runtime-checkable Grader protocol (class attributes exist on the class
object), so the isinstance guard skipped instantiation and registered the
class itself — instantiation now keys off isinstance(candidate, type).
Registration also validates requires_capabilities names against
CapabilitiesSpec fields so a typo'd capability errors clearly at register
time instead of crashing at selection. report_schema_version is pinned to
Literal["1"] for parity with the manifest. Regression tests for all three.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
WELL_KNOWN_FILES no longer pre-declares formats whose parsers do not exist
in the build — entries are added alongside their parsers (openenv.yaml at
the walking skeleton, task.toml with the Harbor parser, task.md with the
PostTrain parser). The parser-not-implemented category is retained as a
defensive registry contract only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e1a5f68. Configure here.

Comment thread src/openenv/validation/policy.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature size: large Large pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants