Skip to content

Handoff seeds: issue/hypothesis schemas, templates, round-trip corpus - #519

Merged
aarontrowbridge merged 2 commits into
mainfrom
499-handoff-seeds
Aug 23, 2026
Merged

Handoff seeds: issue/hypothesis schemas, templates, round-trip corpus#519
aarontrowbridge merged 2 commits into
mainfrom
499-handoff-seeds

Conversation

@aarontrowbridge

@aarontrowbridge aarontrowbridge commented Aug 23, 2026

Copy link
Copy Markdown
Member

Closes #499.

Typed cross-campaign handoffs per the spec's D3: issue-seed and hypothesis-seed JSON Schemas + rendering templates (write-an-issue decision surface; hypothesis card) committed at packages/extension/handoff-seeds/, render/extract functions in src/handoff_seeds.ts (self-contained mini validator — sibling #496 not on this branch), 4 valid + 4 adversarial fixtures (dead evidence pointers, both masquerade directions, missing required) — 19 tests green, typecheck clean, zero new dependencies. Committed-contract sync asserted (schemas/templates are load-bearing, not decorative).

Part of #497.

Summary by CodeRabbit

  • New Features

    • Added support for validating, rendering, and extracting issue and hypothesis handoff seeds.
    • Added templates and schemas for both handoff-seed types.
    • Enforced required metadata, valid evidence references, unique evidence, and supported fields.
    • Added safeguards against invalid paths, directories, missing evidence, empty content, and cross-type fields.
  • Tests

    • Added comprehensive coverage for valid and adversarial handoff-seed scenarios.
    • Added round-trip checks to ensure rendered seeds preserve their declared information.

…dversarial corpus (#499)

Typed cross-campaign handoff seeds per spec-20260822 D3 / handoff_roundtrip_pass:

- committed JSON Schemas (handoff-seeds/): issue seed (title, motivation,
  evidence pointers that must resolve, suggested_repo, suggested_tier; kind
  const "issue") and hypothesis seed (observation, evidence,
  suggested_experiment; kind const "hypothesis"), both additionalProperties:false
  so a kind/field-set masquerade is refused mechanically
- committed render templates + src render/extract: issue seed renders the
  write-an-issue decision surface, hypothesis seed renders the vault hypothesis
  card; extractors re-extract the full declared field set (field-equal
  round-trip over the committed corpus)
- evidence pointers resolve at validation time against a root — dead pointers
  are refused, not warned, with the violated JSON-Pointer path named
- fixture corpus: 4 valid (2 per kind) + 4 adversarial (dead pointer, both
  masquerade directions, missing required field) + fixture-local evidence root
- zero new dependencies (yaml + node builtins); zero blocklisted proper nouns
  in committed slice files (grep-tested)
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8113d314-83dc-45b1-9fb1-e3954d8784b2

📥 Commits

Reviewing files that changed from the base of the PR and between e217adc and 2a2e283.

📒 Files selected for processing (27)
  • packages/extension/handoff-seeds/hypothesis-seed.schema.json
  • packages/extension/handoff-seeds/hypothesis-seed.template.md
  • packages/extension/handoff-seeds/issue-seed.schema.json
  • packages/extension/handoff-seeds/issue-seed.template.md
  • packages/extension/src/handoff_seeds.ts
  • packages/extension/test/fixtures/handoff-seeds/ATTESTATION.md
  • packages/extension/test/fixtures/handoff-seeds/adversarial/hypothesis-directory-evidence.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/hypothesis-duplicate-evidence.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/hypothesis-empty-experiment.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/hypothesis-masquerade-no-experiment.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/hypothesis-missing-evidence.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/issue-absolute-path-evidence.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/issue-dead-evidence-pointer.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/issue-foreign-field.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/issue-masquerade-no-repo.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/issue-root-self-evidence.json
  • packages/extension/test/fixtures/handoff-seeds/adversarial/issue-traversal-wikilink.json
  • packages/extension/test/fixtures/handoff-seeds/root/experiments/experiment-20260821-120000-blockade-sector-rank.md
  • packages/extension/test/fixtures/handoff-seeds/root/experiments/experiment-20260822-193053-rwa-breakdown.md
  • packages/extension/test/fixtures/handoff-seeds/root/insights/insight-20260822-063401-drift-detector-threshold.md
  • packages/extension/test/fixtures/handoff-seeds/root/insights/insight-20260822-063402-noise-normalized-detectors.md
  • packages/extension/test/fixtures/handoff-seeds/root/insights/insight-20260822-063403-bending-energy-rwa.md
  • packages/extension/test/fixtures/handoff-seeds/valid/hypothesis-blockade-rank.json
  • packages/extension/test/fixtures/handoff-seeds/valid/hypothesis-implicit-drag.json
  • packages/extension/test/fixtures/handoff-seeds/valid/issue-detector-thresholds.json
  • packages/extension/test/fixtures/handoff-seeds/valid/issue-rwa-bending-energy.json
  • packages/extension/test/handoff_seeds.test.ts

📝 Walkthrough

Walkthrough

Added typed issue and hypothesis handoff seeds with schemas, templates, validation, rendering, extraction, committed fixtures, and comprehensive round-trip and adversarial tests.

Changes

Handoff seed protocol

Layer / File(s) Summary
Seed contracts and committed templates
packages/extension/src/handoff_seeds.ts, packages/extension/handoff-seeds/*.json, packages/extension/handoff-seeds/*.md
Defines issue and hypothesis seed contracts, schemas, metadata, required fields, and Markdown templates.
Schema and evidence validation
packages/extension/src/handoff_seeds.ts
Validates types, required fields, allowed values, unknown fields, evidence uniqueness, and regular files beneath the validation root.
Artifact rendering and extraction
packages/extension/src/handoff_seeds.ts
Renders seeds with YAML and Markdown content, then extracts typed seeds after validating frontmatter, markers, and required content.
Fixtures and round-trip enforcement
packages/extension/test/handoff_seeds.test.ts, packages/extension/test/fixtures/handoff-seeds/*
Adds valid and adversarial fixtures and tests for round trips, rejection paths, committed copies, corpus size, blocklists, and render targets.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Seed as HandoffSeed
  participant Validator as SeedValidator
  participant Renderer as SeedRenderer
  participant Artifact as MarkdownArtifact
  participant Extractor as SeedExtractor
  Seed->>Validator: validate fields and evidence
  Validator-->>Renderer: return valid seed
  Renderer->>Artifact: render YAML and Markdown
  Artifact->>Extractor: provide rendered artifact
  Extractor-->>Seed: return extracted typed seed
``

</details>

<!-- walkthrough_end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

<details>
<summary>📝 Generate docstrings</summary>

- [ ] <!-- {"checkboxId":"7962f53c-55bc-4827-bfbf-6a18da830691"} --> Create stacked PR
- [ ] <!-- {"checkboxId":"3e1879ae-f29b-4d0d-8e06-d12b7ba33d98"} --> Commit on current branch

</details>
<details>
<summary>🧪 Generate unit tests (beta)</summary>

- [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} -->   Create PR with unit tests
- [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} -->   Commit unit tests in branch `499-handoff-seeds`

</details>

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---




<sub>Comment `@coderabbitai help` to get the list of available commands.</sub>

<!-- tips_end -->
Loading

@aarontrowbridge
aarontrowbridge marked this pull request as ready for review August 23, 2026 12:22
@aarontrowbridge
aarontrowbridge merged commit c9f0d0d into main Aug 23, 2026
8 checks passed
@aarontrowbridge
aarontrowbridge deleted the 499-handoff-seeds branch August 23, 2026 12:22
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.

Handoff seeds: issue/hypothesis schemas, templates, round-trip corpus

1 participant