Skip to content

feat: extract phase 1 validator, review payload, fixtures, and bench - #32

Merged
BunsDev merged 7 commits into
mainfrom
feat/phase1-extract
Sep 23, 2026
Merged

BunsDev merged 7 commits into
mainfrom
feat/phase1-extract

Conversation

@BunsDev

@BunsDev BunsDev commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1. The playground consumer remains a separate required delivery step.

Extracts proposal validation, the v1 Jev payload/review path, synthetic fixtures and the offline bench from merged playground revision 6fe5967. The upstream #41 gate and separate Zod dependency PR #28 are complete.

The hardened decision/types/input modules are retained. Transport stays injected, the Node fixture loader stays outside the public contract, and base mode stays benchmark-only. Nothing applies or executes proposals.

The v1 request remains instruction-only, matching the original post-validation wire body. The generic payload validator preserves explicitly supplied Noul criteria, rejects malformed criteria and coerced question types, and requires the exact model pin. Request aliases fail before transport; missing or mismatched real-response model metadata produces unavailable evidence. Explicit mocks retain their provenance. Cancellation is checked before dispatch and after the transport resolves, so an ignoring transport cannot supply usable evidence after cancellation.

Verdict impact

No existing fixture verdict changes. The model pin, threshold, question IDs, wording/version, favorable directions and execution semantics are unchanged. Invalid configuration or response metadata can no longer bypass the documented pin; no canonical fixture moves.

Verification

Offline verification artifact:

  • 20 original fixture files are byte-identical to merged upstream.
  • All 40 normalized v1 requests and validation results match; 80 normalized base/mock receipts match (reason text and latency excluded).
  • Frozen install, typecheck, 188 offline tests, production build and secret scans passed.
  • Mock bench reproduces 7/20 base bad caught, 20/20 reviewed bad caught, 2/20 good held, and 40/40 expected verdicts. These are scripted values, not Jev measurements.
  • Model-pin and malformed-question-type regressions failed before their fixes and now pass.
  • Signed commits; independent spec and quality reviews. No live provider calls in these checks.

The roadmap explicitly leaves playground consumption open until a pinned consumer is delivered.

BunsDev and others added 2 commits September 22, 2026 08:07
Matches the exact version and lockfile integrity pinned by
TypeSafeAI/typesafe-playground at 2c6cac9 (PR #41 head), so the phase 1
validator can be extracted without behavior drift.

Refs #1

Co-Authored-By: Claude Opus 5 <[email protected]>
Extracts the remaining Week 1 harness from TypeSafeAI/typesafe-playground
at 2c6cac903ee3887eb72548e012c14a7aefe4f3bd (head of PR #41, not yet
merged). Re-diff against the merged playground main once #41 lands.

- src/contract/payload.ts: local Question/RunPayload types and
  validateReviewPayload, which preserves explicitly supplied noul criteria,
  rejects malformed criteria, and refuses an empty model rather than
  defaulting to an alias.
- src/contract/validate.ts + diff.ts: zod proposal schema, path checks, and
  single-file diff checks; diff.ts is the playground parsePullRequest diff
  logic with messages unchanged.
- src/contract/review.ts: question set v1 exactly as it historically
  reached the wire (instructions only; the playground validator dropped
  criteria), buildReviewPayload, parseReviewAnswers, reviewProposal over an
  injected transport. The authored criteria text is kept, unsent, as
  REVIEW_QUESTION_CRITERIA. REVIEW_QUESTION_SET_VERSION stays 1.
- src/benchmark/{fixtures,proposer,mock,run,bench,load}.ts: fixture bench
  machinery; base mode uses the benchmark-only decideBase; load.ts is
  Node-only and not re-exported.
- fixtures/proposal-review: the 20 synthetic fixtures, byte-identical.
- Ported proposal-review{,-fixtures,-bench} tests against the hardened
  decide(), plus tests/review-payload.test.ts for the exact post-validation
  request, criteria preservation, and absent labels.
- pnpm bench:review: offline mock bench. Totals: base 7/20 bad caught,
  +Jev 20/20, 2/20 good held (the two ambiguous fixtures).

The hardened decide() and types are unchanged. No verdict moves.

Refs #1

Co-Authored-By: Claude Opus 5 <[email protected]>
@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
jev-harness Ready Ready Preview Sep 23, 2026 6:31am UTC

Request Review

Merge the current dependency branch, preserving routing and integration work. Re-diff phase 1 against playground 6fe5967dc020521a0731682b06c4d8eeeab95ffb and retain byte-identical fixtures and normalized v1 requests.

Reject request model overrides before transport and fail real-source replies with absent or mismatched model metadata as unavailable. Keep explicitly labeled mock evidence, question semantics and the hardened decision table unchanged.

Verified frozen install, typecheck, 184 tests, offline mock bench, production build, secrets and diff checks. Playground consumer delivery remains open.
Base automatically changed from deps/zod to main September 23, 2026 06:05
Require exact noul, choice or score strings before selecting a payload branch. Array-valued types can no longer pass string coercion and become score questions.

The regression failed before the fix; all 14 payload tests and 186 full tests pass, with typecheck, mock bench, production build and secret scans. Canonical fixture, normalized request and receipt parity remains unchanged.
@BunsDev
BunsDev marked this pull request as ready for review September 23, 2026 06:16
Copilot AI lite review requested due to automatic review settings September 23, 2026 06:16

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Unresolved moderate findings affect cancellation, payload validation, diff handling, benchmark receipts, and threshold validation; duplicate dependency changes also need cleanup.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Extracts phase 1 proposal validation, the v1 Jev review path, synthetic fixtures, and the offline benchmark. Playground consumption remains a separate delivery step.

Changes:

  • Adds validation, diff parsing, pinned payloads, and transport-injected reviews.
  • Adds fixtures, mock execution, benchmarking, and related tests.
  • Updates documentation, scripts, verification artifacts, and dependency metadata.
File Summary
tsconfig.json Includes the review benchmark script.
tests/​review-payload.test.ts Tests payload and model-pin behavior.
tests/​proposal-review.test.ts Tests validation, review, runner, and failure behavior.
tests/​proposal-review-fixtures.test.ts Tests fixture integrity and expected outcomes.
tests/​proposal-review-bench.test.ts Tests benchmark aggregation and totals.
tests/​noul-guidance.test.ts Verifies updated Noul guidance.
src/​contract/​validate.ts Adds proposal, path, and diff validation. Moderate: insertion-only zero-old hunks are rejected.
src/​contract/​review.ts Adds questions, payload construction, and review parsing. Moderate: cancellation should be checked before transport and after awaiting it.
src/​contract/​payload.ts Adds generic payload validation and criteria handling. Moderate: unknown top-level and question fields are silently dropped.
src/​contract/​index.ts Exports the extracted contract APIs.
src/​contract/​diff.ts Adds unified-diff parsing and limits.
src/​benchmark/​run.ts Adds fixture review orchestration and receipts. Moderate: validate thresholds before Jev transport.
src/​benchmark/​proposer.ts Adds the scripted fixture proposer.
src/​benchmark/​mock.ts Adds scripted mock transport. Moderate: mock model identity is incompatible with audit receipt binding.
src/​benchmark/​load.ts Adds the Node-only fixture loader.
src/​benchmark/​fixtures.ts Adds fixture schemas and parsing.
src/​benchmark/​bench.ts Adds benchmark aggregation and rendering.
scripts/​bench-review.ts Adds the offline benchmark command.
README.md Documents extracted functionality and benchmark usage.
pnpm-lock.yaml Locks dependency metadata. Nit: remove duplicate Zod lockfile changes already owned by PR #28.
package.json Adds Zod and the benchmark script. Nit: remove the duplicate dependency change already owned by PR #28.
fixtures/​proposal-review/​off-scope-wrong-file.json Adds an off-scope fixture.
fixtures/​proposal-review/​off-scope-two-files.json Adds a multi-file scope fixture.
fixtures/​proposal-review/​off-scope-log-level.json Adds an unrelated-change fixture.
fixtures/​proposal-review/​off-scope-escape-root.json Adds a path-escape fixture.
fixtures/​proposal-review/​missing-evidence-phantom-null.json Adds an unsupported-claim fixture.
fixtures/​proposal-review/​missing-evidence-fake-quote.json Adds a fake-evidence fixture.
fixtures/​proposal-review/​missing-evidence-cache-claim.json Adds a missing-evidence fixture.
fixtures/​proposal-review/​injection-todo-delete-env.json Adds a prompt-injection fixture.
fixtures/​proposal-review/​injection-readme-delete-env.json Adds a README-injection fixture.
fixtures/​proposal-review/​injection-comment-disable-auth.json Adds an auth-disable injection fixture.
fixtures/​proposal-review/​clean-typo-message.json Adds a clean proposal fixture.
fixtures/​proposal-review/​clean-sum-loop-bound.json Adds a clean loop-bound fixture.
fixtures/​proposal-review/​clean-sort-ascending.json Adds a clean sorting fixture.
fixtures/​proposal-review/​clean-read-before-edit.json Adds a read-first fixture.
fixtures/​proposal-review/​clean-percent-rounding.json Adds a clean rounding fixture.
fixtures/​proposal-review/​clean-parse-port.json Adds a clean parsing fixture.
fixtures/​proposal-review/​clean-null-guard.json Adds a clean null-guard fixture.
fixtures/​proposal-review/​clean-default-timeout.json Adds a clean timeout fixture.
fixtures/​proposal-review/​ambiguous-which-timeout.json Adds an ambiguous timeout fixture.
fixtures/​proposal-review/​ambiguous-clean-up-helper.json Adds an ambiguous cleanup fixture.
docs/​verification/​phase1-extraction-2026-09-23.json Records offline extraction verification.
docs/​roadmap.md Updates phase 1 extraction progress.
docs/​hardening/​10-repository-provenance.md Updates provenance status.
docs/​hardening/​09-evaluation.md Clarifies fixture benchmarking scope.
docs/​hardening/​07-noul-contract.md Documents criteria-preserving validation.
docs/​architecture.md Documents the extracted pipeline.
AGENTS.md Updates repository orientation and contracts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/contract/review.ts Resolved
Check the abort signal before dispatch and after the injected transport resolves. A pre-aborted review makes no transport call, and transports that ignore or race cancellation cannot return usable answers.

Both new cancellation regressions failed before the fix. All 16 payload tests and 188 full tests pass, alongside typecheck, mock bench, production build, secrets and canonical-source parity. Question semantics, model pin, threshold and fixture verdicts remain unchanged.

This branch was successfully deployed

1 active deployment
Preview — 7d135060 Deployed Sep 23, 2026 by vercel[bot]
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.

2 participants