8000 feat(data): add negative-example and repair-trajectory child records · Issue #4 · Mnehmos/mathcorpus · GitHub
[go: up one dir, main page]

Skip to content

feat(data): add negative-example and repair-trajectory child records #4

Closed

Description

@Mnehmos

Problem

MathCorpus currently has a minimal packet-level failure summary and almost no negative examples, while Proof Search generates organic failed attempts, diagnostics, rejected actions, interactive tactic failures, and successful repairs.

Scope

Add versioned child records for:

  • organic failed attempts
  • controlled proof mutations
  • repair links from failed attempt to successful variant
  • complete repair trajectories
  • diagnostic categories and structured Lean diagnostics
  • attempt-level token, cost, timing, model, prompt, context, and artifact hashes

Negative records must never be able to confer proof authority on the parent packet.

Acceptance criteria

  • A failed attempt can retain candidate source by governed artifact reference.
  • Diagnostics preserve category, message, source span, goals, local context, and unsolved goals when available.
  • Organic and mutation-generated negatives are clearly distinguished.
  • Repair chains are ordered, hash-linked, and terminate in either a verified proof or explicit failure.
  • Training/export policy can independently allow metadata, proof text, diagnostics, and model identity.
  • Fixtures cover parse failure, unknown declaration, type mismatch, unsolved goals, and a successful repair.

Activity

  1. Mnehmos commented on Jul 12, 2026

    @Mnehmos
    OwnerAuthor

    Implemented (local commit b3bfa63, stacked on bcdb683/8c74201/7f1ac10 — not yet pushed, see notes on #1-#3):

    • packet.schema.json gains attempts[], negative_examples[], repair_trajectories[], additive to the existing packet-level failure object, mirroring MCIP's AttemptRecord/NegativeExample/RepairTrajectory from feat(schema): define MathCorpus Interchange Protocol v1 for Proof Search enrichment #1. Any packet — not just a standalone kind: negative_example one — can now carry its own attempt history.
    • Never proof-bearing: negative_example_record.proof_authority is fixed to "none" at the schema level (a JSON Schema const), not just a convention.
    • Genuinely hash-linked repair chains: repair_trajectories[].steps[].step_hash is a real SHA-256 over {step_index, from_attempt_id, repair_action, diagnostic_category_addressed, to_ref} (tools/mathcorpus/hashing.repair_step_hash) — a step can't be silently reworded without changing its hash. policy.check_attempts_and_repairs catches dangling attempt/variant references, out-of-order steps, stale step hashes, and negative-example/attempt diagnostic-category disagreement (warning). New corpus-wide policy.check_repair_trajectory_refs catches a dangling cross-packet terminal_ref for when the successful proof was filed as its own packet.
    • A candidate can retain source by governed artifact reference: negative_example_record.candidate_source_ref.
    • Diagnostics preserve category/message/source_span/goals/local_context/unsolved_goals: $defs.diagnostic.
    • Organic vs. mutation-generated stay distinct: negative_example_record.origin (organic | controlled_mutation).
    • Export permissions are independent: can_export_metadata / can_export_proof_text / can_export_diagnostics / can_export_model_identity, each its own boolean.
    • Fixtures cover all 5 required scenarios, honestly sourced: packets/negative/number_theory/gcd_dvd_omega_no_gcd_theory.v1.json was enriched with a real unsolved_goals attempt and a real successful repair — its terminal_ref points at the actual companion packet (elementary.number_theory.gcd_dvd_left.v1) where that second proof-search step already lives, reconstructed from the packet's own pre-existing notes, not invented. The 3 diagnostic categories with no real corpus precedent (parse_failure, unknown_declaration, type_mismatch) are covered by a new, explicitly synthetic packets/negative/_fixtures/diagnostic_categories_conformance.v1.json — kind: concept + training.eligibility: private_audit_only so it's excluded from every export lane, confirmed by grepping a full export run for its packet_id.
    • 8 failure modes smoke-tested directly against scratch copies (dangling attempt ref, stale step hash, dangling from/to attempt refs, dangling cross-packet terminal_ref, unordered steps, category-mismatch warning, malformed terminal_ref).
    • Full corpus (356 packets) + full CI-equivalent pipeline (manifests, split, dedupe, export, redaction audit) run locally end-to-end: 0 errors.

    Tracked in agents/github_issues/DONE.md, FEATURES.md, HANDOFF.md.

  2. added a commit that references this issue on Jul 12, 2026
    b3bfa63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0