Repository navigation
feat: extract phase 1 validator, review payload, fixtures, and bench - #32
Merged
Merged
Conversation
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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5 tasks done
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.
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.
There was a problem hiding this comment.
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
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.
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.
5 tasks done
This was referenced Oct 7, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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:
The roadmap explicitly leaves playground consumption open until a pinned consumer is delivered.