intent-eval-core 0.9.0__tar.gz → 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/.gitignore +4 -2
  2. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/PKG-INFO +2 -2
  3. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/pyproject.toml +1 -1
  4. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/__init__.py +1 -1
  5. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/skill_version_schema.py +47 -2
  6. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/models.py +52 -1
  7. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/tests/test_parity.py +53 -1
  8. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/LICENSE +0 -0
  9. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/NOTICE +0 -0
  10. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/README.md +0 -0
  11. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/README.md +0 -0
  12. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/__init__.py +0 -0
  13. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/_common_schema.py +0 -0
  14. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/cost_record_schema.py +0 -0
  15. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/dashboard_render_schema.py +0 -0
  16. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/eval_run_schema.py +0 -0
  17. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/eval_spec_schema.py +0 -0
  18. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/evidence_bundle_schema.py +0 -0
  19. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/failure_taxonomy_schema.py +0 -0
  20. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/gate_result_schema.py +0 -0
  21. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/human_review_schema.py +0 -0
  22. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/judge_decision_schema.py +0 -0
  23. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/matcher_map_schema.py +0 -0
  24. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/regression_pack_schema.py +0 -0
  25. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/retraction_schema.py +0 -0
  26. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/rollout_gate_schema.py +0 -0
  27. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/runtime_receipt_schema.py +0 -0
  28. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/session_trace_schema.py +0 -0
  29. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/skill_refiner_pass_schema.py +0 -0
  30. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/skill_snapshot_schema.py +0 -0
  31. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/tool_invocation_schema.py +0 -0
  32. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/_generated/usage_event_schema.py +0 -0
  33. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/src/intent_eval_core/py.typed +0 -0
  34. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/tests/test_codegen_idempotent.py +0 -0
  35. {intent_eval_core-0.9.0 → intent_eval_core-0.11.0}/tests/test_version_lockstep.py +0 -0
@@ -37,8 +37,10 @@ yarn-error.log*
37
37
  # OS
38
38
  Thumbs.db
39
39
 
40
- # Beads workspace (kernel is task-tracked at umbrella ~/000-projects/.beads/)
41
- .beads/
40
+ # Beads workspace (kernel is task-tracked at umbrella ~/000-projects/.beads/).
41
+ # Keep only the tracked redirect so this checkout cannot open a second store.
42
+ .beads/*
43
+ !.beads/redirect
42
44
 
43
45
  # api-extractor temp output (golden snapshot at api/intentsolutions-core.api.md IS committed)
44
46
  api/temp/
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: intent-eval-core
3
- Version: 0.9.0
3
+ Version: 0.11.0
4
4
  Summary: Python (Pydantic v2) distribution of @intentsolutions/core — the canonical contracts kernel for the Intent Eval Platform. The same entity + predicate contracts the TypeScript package exposes as Zod validators + JSON Schemas, as Pydantic v2 models.
5
5
  Project-URL: Homepage, https://github.com/jeremylongshore/intent-eval-core
6
6
  Project-URL: Repository, https://github.com/jeremylongshore/intent-eval-core
@@ -8,7 +8,7 @@ name = "intent-eval-core"
8
8
  # Schemas under schemas/v1/ are the shared source of truth for both
9
9
  # distributions, so the versions move together. CI gate:
10
10
  # scripts/check_version_lockstep.py.
11
- version = "0.9.0"
11
+ version = "0.11.0"
12
12
  description = "Python (Pydantic v2) distribution of @intentsolutions/core — the canonical contracts kernel for the Intent Eval Platform. The same entity + predicate contracts the TypeScript package exposes as Zod validators + JSON Schemas, as Pydantic v2 models."
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.10"
@@ -48,7 +48,7 @@ from .models import (
48
48
 
49
49
  # Kept in lockstep with npm package.json#version by scripts/check_version_lockstep.py
50
50
  # (CI-gated). The JSON Schemas under schemas/v1/ are the shared source of truth.
51
- __version__ = "0.9.0"
51
+ __version__ = "0.11.0"
52
52
 
53
53
  __all__ = [
54
54
  "__version__",
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
 
6
6
  from enum import Enum
7
7
 
8
- from pydantic import BaseModel, ConfigDict, constr
8
+ from pydantic import BaseModel, ConfigDict, conint, constr
9
9
 
10
10
  from . import _common_schema as schema
11
11
 
@@ -20,11 +20,32 @@ class VersionKind(Enum):
20
20
  restore = "restore"
21
21
 
22
22
 
23
+ class Status(Enum):
24
+ """
25
+ AT-DECR 011 (DR-028 T1 / DR-085 D1 DEFERRED signing state machine). OPTIONAL + ADDITIVE — an absent `status` is the staging-first `sigstore_staging` default, so every previously-signed row stays valid. CLOSED enum (widening after a signed publish is a /v2 trigger, mirroring version_kind). Signing lifecycle: `sigstore_staging` (staging-first default; local creation ALWAYS lands here, never blocks on Rekor per P0-RATIFY-2/Kleppmann F-MK-2 CISO hard-line) → `pending_production` (production signing requested but Rekor unreachable; reconciler retries with `retry_after`; the bead's `pending_production` is resolved HERE as a status value, not a redundant boolean flag) → `active` (production signature landed; `rekor_log_index` non-null) | `signing_failed` (bounded retry exhausted at max_retries=5, CISO binding; surfaces to human review). STAGING-FIRST — this activates nothing; production signing stays AND-gated on DR-082 Q3 triggers in the audit-harness reconciler, NOT this kernel.
26
+ """
27
+
28
+ sigstore_staging = "sigstore_staging"
29
+ pending_production = "pending_production"
30
+ active = "active"
31
+ signing_failed = "signing_failed"
32
+
33
+
34
+ class SigningMode(Enum):
35
+ """
36
+ AT-DECR 011. OPTIONAL + ADDITIVE — absent ≡ the staging-first `sigstore_staging` default. SAME enum as EvidenceBundle.signing_mode / RolloutGate.signing_mode (the bead's `'production'` wording maps to the kernel enum value `rekor_production`). Cross-field invariant with `rekor_log_index` + `status` (allOf below).
37
+ """
38
+
39
+ sigstore_staging = "sigstore_staging"
40
+ rekor_production = "rekor_production"
41
+ unsigned_experimental = "unsigned_experimental"
42
+
43
+
23
44
  class SkillversionRefinementLineageRecordOfASkill14ThCanonicalEntityDr028T1Discriminator(
24
45
  BaseModel
25
46
  ):
26
47
  """
27
- The 14th canonical entity. SEPARATE from SkillSnapshot (which content-addressed-pins a skill's source state); SkillVersion captures the REFINEMENT LINEAGE produced by the Skill Refiner. DR-028 T1 DISCRIMINATOR resolution: `version_kind` is a load-bearing signable discriminator; `parent_version_id` references the prior SkillVersion (lineage internal, SkillVersion -> SkillVersion, NOT an FK to SkillSnapshot); `source_snapshot_hash` is a READ-ONLY REFERENCE (content hash) to the PRE-EDIT SkillSnapshot at the moment of refinement — explicitly NOT a relational foreign key (no enforced relational integrity; it is a content-hash reference). DR-085 D3 lineage-integrity correction: this entity now carries a self `content_hash` (its own post-edit content) + a `parent_content_hash` (the parent's `content_hash`, the tamper-evident lineage anchor); all three hash fields use the BARE 64-hex `sha256` alphabet, ALIGNED to `SkillSnapshot.combined_sha` (one hash alphabet platform-wide — no sha256:-prefixed vs bare mismatch). `parent_content_hash` is null iff `parent_version_id` is null (a root version forges no parent). ADDITIVE / one-way-door: this shape ships in signed @intentsolutions/core entries, so widening or merging it post-publish is irreversible — additive only. The state-machine formalism + status/signing cross-field invariants (P0-RATIFY-2 `pending_production`/`active`, `rekor_log_index iff signing_mode='production' AND status='active'`) are DEFERRED to a follow-up v0.4.0 Decision Record per DR-028 T1 binding minority constraint (lines 105/108) reconciled by DR-085 D1: "Phase C ships entity + discriminator + parent_version_id only." Predicate URI: skill-refiner-pass/v1 references this entity by id/hash (already shipped); SkillVersion does NOT define that predicate.
48
+ The 14th canonical entity. SEPARATE from SkillSnapshot (which content-addressed-pins a skill's source state); SkillVersion captures the REFINEMENT LINEAGE produced by the Skill Refiner. DR-028 T1 DISCRIMINATOR resolution: `version_kind` is a load-bearing signable discriminator; `parent_version_id` references the prior SkillVersion (lineage internal, SkillVersion -> SkillVersion, NOT an FK to SkillSnapshot); `source_snapshot_hash` is a READ-ONLY REFERENCE (content hash) to the PRE-EDIT SkillSnapshot at the moment of refinement — explicitly NOT a relational foreign key (no enforced relational integrity; it is a content-hash reference). DR-085 D3 lineage-integrity correction: this entity now carries a self `content_hash` (its own post-edit content) + a `parent_content_hash` (the parent's `content_hash`, the tamper-evident lineage anchor); all three hash fields use the BARE 64-hex `sha256` alphabet, ALIGNED to `SkillSnapshot.combined_sha` (one hash alphabet platform-wide — no sha256:-prefixed vs bare mismatch). `parent_content_hash` is null iff `parent_version_id` is null (a root version forges no parent). ADDITIVE / one-way-door: this shape ships in signed @intentsolutions/core entries, so widening or merging it post-publish is irreversible — additive only. SIGNING STATE MACHINE (AT-DECR 011, the DR-028 T1 / DR-085 D1 DEFERRED work, landed ADDITIVELY): the six OPTIONAL fields `status` / `signing_mode` / `rekor_log_index` / `retry_after` / `retry_count` / `signing_downgrade_reason` fold in the P0-RATIFY-2 signing lifecycle — NONE joins `required`, so every previously-signed row stays valid (absent `status` ≡ the staging-first `sigstore_staging` default). STAGING-FIRST: this ACTIVATES NOTHING — local creation never blocks on Rekor (Kleppmann F-MK-2 CISO hard-line), production signing stays AND-gated on DR-082 Q3 triggers in the audit-harness reconciler runtime (the append-only Rekor OUTBOX + bounded-retry reconciler that DRIVES these transitions, AC-2, is a SEPARATE follow-on in audit-harness, NOT this kernel). Cross-field invariant (both directions, all-three-layer enforced): `rekor_log_index` non-null IFF (`signing_mode='rekor_production'` AND `status='active'`). The bead's `pending_production` is resolved as a `status` enum value, not a redundant boolean flag. Predicate URI: skill-refiner-pass/v1 references this entity by id/hash (already shipped); SkillVersion does NOT define that predicate.
28
49
  """
29
50
 
30
51
  model_config = ConfigDict(
@@ -68,3 +89,27 @@ class SkillversionRefinementLineageRecordOfASkill14ThCanonicalEntityDr028T1Discr
68
89
  """
69
90
  RESERVED multi-tenancy slot (deferral-G, bd_000-projects-k0fj), mirroring SkillSnapshot. OPTIONAL + additive per Blueprint B § 7.2; tenant-isolation semantics deferred to a future DR. v1 single-tenant versions omit it.
70
91
  """
92
+ status: Status | None = None
93
+ """
94
+ AT-DECR 011 (DR-028 T1 / DR-085 D1 DEFERRED signing state machine). OPTIONAL + ADDITIVE — an absent `status` is the staging-first `sigstore_staging` default, so every previously-signed row stays valid. CLOSED enum (widening after a signed publish is a /v2 trigger, mirroring version_kind). Signing lifecycle: `sigstore_staging` (staging-first default; local creation ALWAYS lands here, never blocks on Rekor per P0-RATIFY-2/Kleppmann F-MK-2 CISO hard-line) → `pending_production` (production signing requested but Rekor unreachable; reconciler retries with `retry_after`; the bead's `pending_production` is resolved HERE as a status value, not a redundant boolean flag) → `active` (production signature landed; `rekor_log_index` non-null) | `signing_failed` (bounded retry exhausted at max_retries=5, CISO binding; surfaces to human review). STAGING-FIRST — this activates nothing; production signing stays AND-gated on DR-082 Q3 triggers in the audit-harness reconciler, NOT this kernel.
95
+ """
96
+ signing_mode: SigningMode | None = None
97
+ """
98
+ AT-DECR 011. OPTIONAL + ADDITIVE — absent ≡ the staging-first `sigstore_staging` default. SAME enum as EvidenceBundle.signing_mode / RolloutGate.signing_mode (the bead's `'production'` wording maps to the kernel enum value `rekor_production`). Cross-field invariant with `rekor_log_index` + `status` (allOf below).
99
+ """
100
+ rekor_log_index: conint(ge=0) | None = None
101
+ """
102
+ AT-DECR 011 § D3. OPTIONAL + ADDITIVE — absent/null for every staging row. Rekor transparency-log index, populated ONLY on a production-signed active row. CROSS-FIELD INVARIANT (both directions, machine-enforced at all three layers): `rekor_log_index` is non-null IFF (`signing_mode='rekor_production'` AND `status='active'`). A rekor index without active+production is forged provenance → REFUSED; an active+production row without a rekor index is an unverifiable production claim → REFUSED.
103
+ """
104
+ retry_after: schema.Rfc3339 | None = None
105
+ """
106
+ AT-DECR 011. OPTIONAL + ADDITIVE. RFC 3339 UTC timestamp the reconciler MUST NOT retry a `pending_production` row before (exponential-backoff floor — the reconciler computes it, the kernel only types it). Set only while `status='pending_production'`.
107
+ """
108
+ retry_count: conint(ge=0) | None = None
109
+ """
110
+ AT-DECR 011. OPTIONAL + ADDITIVE — absent ≡ 0 (no attempt yet). Count of production-signing attempts; the reconciler increments it, and once it reaches SKILL_VERSION_MAX_SIGNING_RETRIES (=5, CISO bounded-retry binding) the next failure drives `pending_production → signing_failed`. The retry LOOP is runtime (audit-harness); the kernel owns only the BOUND.
111
+ """
112
+ signing_downgrade_reason: str | None = None
113
+ """
114
+ AT-DECR 011. OPTIONAL + ADDITIVE. Structured reason recorded ONLY when this row's signing posture was DOWNGRADED (requested `rekor_production` fell back to `sigstore_staging`, or retries exhausted). Absent on a normally-signed or plain staging row. Mirrors the skill-refiner-pass/v1 predicate's `signing_downgrade_reason` intent.
115
+ """
@@ -33,7 +33,7 @@ from typing import Literal
33
33
 
34
34
  from typing_extensions import Self
35
35
 
36
- from pydantic import model_validator
36
+ from pydantic import conint, model_validator
37
37
 
38
38
  from ._generated import _common_schema as _schema
39
39
 
@@ -106,6 +106,12 @@ from ._generated.usage_event_schema import (
106
106
  from ._generated.skill_version_schema import (
107
107
  SkillversionRefinementLineageRecordOfASkill14ThCanonicalEntityDr028T1Discriminator as _SkillVersionGenerated, # noqa: E501
108
108
  )
109
+ from ._generated.skill_version_schema import (
110
+ SigningMode as _SkillVersionSigningMode,
111
+ )
112
+ from ._generated.skill_version_schema import (
113
+ Status as _SkillVersionStatus,
114
+ )
109
115
  from ._generated.tool_invocation_schema import (
110
116
  ToolinvocationSingleToolProviderCallRecordedUnderASessiontraceBlueprintB211 as ToolInvocation,
111
117
  )
@@ -191,6 +197,12 @@ class SkillVersion(_SkillVersionGenerated):
191
197
  2. **DR-085 D5** — ``version_kind`` ∈ {``revert``, ``restore``} ⇒
192
198
  ``parent_version_id`` ≠ null (a revert/restore must point at the version
193
199
  it reverts/restores to).
200
+ 3. **AT-DECR 011 § D3 signing cross-field invariant (both directions)** —
201
+ ``rekor_log_index`` is non-null IFF (``signing_mode == 'rekor_production'``
202
+ AND ``status == 'active'``). An active + production row without a rekor
203
+ index is an unverifiable production claim; a rekor index on a
204
+ non-active/non-production row is forged provenance — both REFUSED. An
205
+ absent/null ``rekor_log_index`` is unconstrained (every staging row).
194
206
 
195
207
  The generated parent already enforces ``extra="forbid"`` (closed-world), the
196
208
  ``version_kind`` enum, and the BARE ``Sha256`` patterns on ``content_hash`` /
@@ -218,6 +230,24 @@ class SkillVersion(_SkillVersionGenerated):
218
230
  parent_version_id: _schema.Uuidv7 | None
219
231
  parent_content_hash: _schema.Sha256 | None
220
232
 
233
+ # AT-DECR 011 OPTIONAL-NOT-NULLABLE parity for the five staging signing
234
+ # fields. In the JSON Schema + Zod these are OPTIONAL but NOT NULLABLE
235
+ # (`status`/`signing_mode` are bare enums; `retry_after` $refs rfc3339;
236
+ # `retry_count` is a bare integer; `signing_downgrade_reason` a bare string —
237
+ # none carries a `null` branch, and Zod uses `.optional()` not `.nullable()`).
238
+ # datamodel-code-generator renders each `... | None = None` (nullable), which
239
+ # would WRONGLY accept an explicit `null`. Re-declare each with an annotation
240
+ # that EXCLUDES None (absence allowed via the `= None` default; explicit
241
+ # `null` rejected) — the `models.py`-wrapper idiom, never edit `_generated/`.
242
+ status: _SkillVersionStatus = None # type: ignore[assignment]
243
+ signing_mode: _SkillVersionSigningMode = None # type: ignore[assignment]
244
+ retry_after: _schema.Rfc3339 = None # type: ignore[assignment]
245
+ retry_count: conint(ge=0) = None # type: ignore[assignment,valid-type] # keep the generated ge=0 bound; strip only nullability
246
+ signing_downgrade_reason: str = None # type: ignore[assignment]
247
+ # `rekor_log_index` is genuinely OPTIONAL-AND-NULLABLE (schema
248
+ # `oneOf[integer,null]`, Zod `.nullable().optional()`) — the generated
249
+ # `conint(ge=0) | None = None` is already correct, so it is NOT overridden.
250
+
221
251
  @model_validator(mode="after")
222
252
  def _enforce_dr085_lineage_invariants(self) -> Self:
223
253
  # Rule 1 (DR-085 D3): parent_content_hash null iff parent_version_id null.
@@ -240,6 +270,27 @@ class SkillVersion(_SkillVersionGenerated):
240
270
  "parent_version_id (a revert/restore must point at a prior version)"
241
271
  )
242
272
 
273
+ # Rule 3 (AT-DECR 011 § D3): rekor_log_index non-null IFF
274
+ # (signing_mode='rekor_production' AND status='active') — both directions.
275
+ status = self.status.value if hasattr(self.status, "value") else self.status
276
+ signing_mode = (
277
+ self.signing_mode.value if hasattr(self.signing_mode, "value") else self.signing_mode
278
+ )
279
+ rekor_present = self.rekor_log_index is not None
280
+ is_active_production = signing_mode == "rekor_production" and status == "active"
281
+ if is_active_production and not rekor_present:
282
+ raise ValueError(
283
+ "AT-DECR 011 § D3: an active + rekor_production SkillVersion MUST "
284
+ "carry a non-null rekor_log_index (an active production row without "
285
+ "a transparency-log index is an unverifiable production claim)"
286
+ )
287
+ if rekor_present and not is_active_production:
288
+ raise ValueError(
289
+ "AT-DECR 011 § D3: rekor_log_index may be non-null ONLY when "
290
+ "signing_mode='rekor_production' AND status='active' (a rekor index "
291
+ "on a non-active/non-production row is forged provenance)"
292
+ )
293
+
243
294
  return self
244
295
 
245
296
 
@@ -235,6 +235,56 @@ class TestNegativeFixtures:
235
235
  without = {k: v for k, v in child.items() if k != key}
236
236
  assert not accepts(iec.SkillVersion, without), f"omitting {key} must be rejected"
237
237
 
238
+ # ── AT-DECR 011 signing state machine (additive, staging-first) ──────────
239
+
240
+ def test_skill_version_legacy_no_signing_fields_accepted(self) -> None:
241
+ # Additive proof: the pre-existing fixture (no signing fields) stays valid.
242
+ assert accepts(iec.SkillVersion, load("skill-version.valid.json"))
243
+
244
+ def test_skill_version_signing_states_validate(self) -> None:
245
+ # staging / pending_production / active+rekor / signing_failed all validate.
246
+ for stem in (
247
+ "skill-version.signing-staging.valid.json",
248
+ "skill-version.signing-pending-production.valid.json",
249
+ "skill-version.signing-active.valid.json",
250
+ "skill-version.signing-failed.valid.json",
251
+ ):
252
+ assert accepts(iec.SkillVersion, load(stem)), stem
253
+
254
+ def test_skill_version_rekor_index_without_active_production_rejected(self) -> None:
255
+ # AT-DECR 011 § D3 direction B: a rekor index on a non-active/non-production
256
+ # row is forged provenance.
257
+ assert not accepts(
258
+ iec.SkillVersion,
259
+ load("skill-version.invalid-rekor-index-without-active-production.json"),
260
+ )
261
+
262
+ def test_skill_version_active_production_without_rekor_index_rejected(self) -> None:
263
+ # AT-DECR 011 § D3 direction A: an active+production row without a rekor
264
+ # index is an unverifiable production claim.
265
+ assert not accepts(
266
+ iec.SkillVersion,
267
+ load("skill-version.invalid-active-production-without-rekor-index.json"),
268
+ )
269
+
270
+ def test_skill_version_active_staging_mode_rekor_index_rejected(self) -> None:
271
+ # A rekor index requires signing_mode='rekor_production', not sigstore_staging.
272
+ active = load("skill-version.signing-active.valid.json")
273
+ assert not accepts(
274
+ iec.SkillVersion, {**active, "signing_mode": "sigstore_staging"}
275
+ )
276
+
277
+ def test_skill_version_bad_status_rejected(self) -> None:
278
+ # status is a CLOSED enum (AT-DECR 011); widening is a /v2 trigger.
279
+ staging = load("skill-version.signing-staging.valid.json")
280
+ assert not accepts(iec.SkillVersion, {**staging, "status": "archived_forever"})
281
+
282
+ def test_skill_version_status_explicit_null_rejected(self) -> None:
283
+ # AT-DECR 011 optional-NOT-nullable parity: absent ≡ staging default;
284
+ # explicit null rejected exactly as AJV + Zod reject it.
285
+ staging = load("skill-version.signing-staging.valid.json")
286
+ assert not accepts(iec.SkillVersion, {**staging, "status": None})
287
+
238
288
  # ── DR-103 D1 anti-gaming + D2 tenant + C3 on UsageEvent (15th canonical) ────
239
289
 
240
290
  def test_usage_event_api_call_exempt_accepted(self) -> None:
@@ -435,8 +485,10 @@ class TestClosedWorld:
435
485
  assert not accepts(iec.EvalSpec, {**base, "surprise": True})
436
486
 
437
487
  def test_skill_version_extra_unknown_key_rejected(self) -> None:
488
+ # `status` is now a KNOWN field (AT-DECR 011 signing state machine); use a
489
+ # genuinely-unknown key to prove the closed-world (extra="forbid") posture.
438
490
  base = load("skill-version.valid.json")
439
- assert not accepts(iec.SkillVersion, {**base, "status": "active"})
491
+ assert not accepts(iec.SkillVersion, {**base, "not_a_real_field": True})
440
492
 
441
493
  def test_eval_spec_scoring_extra_key_accepted(self) -> None:
442
494
  # scoring is the OPEN object (additionalProperties default) — a