100%

intel-reviewed-hash-field

Goal

Add the intel_reviewed_hash Section field (sha256 of the intel package bytes) the review gate keys on, plus the helper that computes it, excluded from the content-hash drift set.

Dependency

Foundational. The S5 gate fires on intel_reviewed_hash mismatch.

Contract

  • intel_reviewed_hash is null when no intel review has been recorded for the section (the default; null = unreviewed-intel state).
  • This section owns ONLY the field, the compute_intel_package_hash helper, the drift-exclusion, and the schema/helper tests. It does NOT write the field.
  • The WRITER is the review-section-skill section (S3, s-94d8f5fa): its state.py records the sha256 on review close, performing the null -> hash transition. The orchestrator-wiring section (S5, s-d1501645) only fires the mismatch gate (the consumer), it does not write the field.
  • Staleness (review gate firing on intel_reviewed_hash != compute_intel_package_hash(...), and which package bytes the gate keys on) is the S5 gate consumer’s concern, not this helper’s.

Implementation Sketch

  • Add intel_reviewed_hash (^[0-9a-f]{64}$ | null) to v7 $defs/Section in schemas/v7/plan-routing.schema.json (additionalProperties:false requires it declared there) AND to the markdown PlanSectionSchema in schemas.py (additive optional, no version bump).
  • Add it to the content_hash exclusion set (WORKFLOW_STATE_SCALAR_FIELDS, content_hash.py:81) so recording it never self-triggers drift.
  • Helper compute_intel_package_hash(intel_json_path) (content_hash.py:424) = sha256 of raw read_bytes, mirroring compute_full_section_hash.

Spec References

scripts/plan_corpus/schemas/v7/plan-routing.schema.json $defs/Section (intel_reviewed_hash at :383, type [string,null], pattern ^[0-9a-f]{64}$); scripts/plan_corpus/schemas.py PlanSectionSchema (:327); scripts/plan_corpus/content_hash.py (WORKFLOW_STATE_SCALAR_FIELDS :81, compute_intel_package_hash :424).

Work Items

  • Add intel_reviewed_hash to v7 $defs/Section (schema) and the markdown PlanSectionSchema.
  • Add intel_reviewed_hash to the content_hash exclusion set so recording it does not trigger drift.
  • Add compute_intel_package_hash(intel_json_path) -> sha256 hexdigest helper.
  • Author schema accept/reject + hash-helper + exclusion-from-drift tests.