Skip to content

refactor(typesafe): evaluate Decisions directly with V2 contracts - #188251

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/decision-15-typesafe-native-v2
Oct 31, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/decision-15-typesafe-native-v2

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

TypeSafe's prepared V2 provider converts requests and results through a private V1 evaluator. Removing that bridge alone would silently widen accepted JSON kinds and question counts.

User Impact

No user-visible behavior or configuration change. Part 15 of the Decision refactor stack, based on part 14.

Why This Change Was Made

Encode the native TypeSafe request directly and validate the mapped result as V2. Reuse the existing System One question encoder. Keep lazy schema validation, prepared credentials/config identity, dispatch admission, cancellation, transport and native result semantics unchanged.

Extract isDecisionBatchV1Representable in the canonical compatibility owner and expose it on the existing Decisions SDK subpath. The canonical converter and native provider share this predicate, retaining explicit JSON-scalar rejection and the 256-question ceiling without constructing a V1 request. Existing codecs/exports remain supported; no subpath or configuration is added. Document the additive predicate.

Evidence

  • Independent fresh source review and local committed-range ClawSweeper review completed with no unresolved actionable findings. Corrective changes were reviewed separately; mechanical restacks were checked with git range-diff.
  • Exact-head ordinary CI passed at 67445ed872fddbd944b067d638d80eb19ffc68a3, including the configured runtime, type, lint and guard lanes.
  • Aggregate production build passed at final production head 5b235dd694af030aeb75e1ec6e831b71ce4b745c. Shared SDK source-audit evidence, the advisory API-report timeout and broader manual-campaign limitations are recorded in part01.
  • Pinned local formatting, limited standalone lint, content hooks and diff checks passed. Local dependencies failed qualification, so no local project runtime pass is claimed.

Landing update

Current head: 1e755970e1bece179536db8fa663f19cfd6c3702; current-head CI passed at 1e755970e1bece179536db8fa663f19cfd6c3702. Native landing targets main after the preceding slice merged. Replayed only this slice onto verified landed part14 c993c8f2a51aba66a3b2be6fed3c68d00ae64bdb after observed squash-ancestry conflicts in the TypeSafe codec and adapter. The predecessor's affected source and shared compatibility/SDK contracts are byte-identical to their landed form. The own-slice range remains patch-identical by git range-diff, with a valid commit signature. Prior passing CI41163008432 at 9e6d8eb4679fd04408da2661877ef4d970549aed remains historical evidence; fresh CI and native admission are required for this head.

Earlier landing evidence

Earlier head: 22c13fc3cfb92d636a884c20805f1f4f656e14dc; that head's CI is pending. After part04 landed, the remaining stack was replayed onto its actual protected-main commit 63dbee6a514580948082dc20cb930c7e748c019e to resolve the named CI/base-context gap in part05. All 20 commit ranges remain patch-identical by git range-diff; the allocation guard passes. Earlier CI/build evidence above remains historical. Each slice lands through the native main-targeted review, preparation, and merge workflow after its predecessor.

The reviewed main reconciliation retains the canonical System One decoder. TypeSafe retains its inline executor and native V2 execution without a V1 round trip.

@vincentkoc vincentkoc self-assigned this Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review October 30, 2026 10:20
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation plugin: typesafe size: M labels Oct 30, 2026
@vincentkoc
vincentkoc force-pushed the refactor/decision-15-typesafe-native-v2 branch from a399bb2 to 67445ed Compare October 30, 2026 10:31
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 30, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

TypeSafe evaluates prepared Decision V2 requests directly and shares a documented admission predicate with the existing V1 converter.

Example: Evaluate a Boolean question with typesafe/jev-latest.

  • Before: The V2 request and response pass through private V1 conversions.
  • After: The provider encodes and validates V2 directly, preserving the returned probability and existing input restrictions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation has no identified defect and green exact-head CI, with confidence limited to source and automated boundary evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate and introduces no material authority change; its supplied validation is source review and automated tests rather than a shipped-entry-point capture.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-approved change removes unnecessary V1 execution machinery while preserving admission, native answers, configuration, and public compatibility.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored refactor removes the private V1 execution bridge without an identified behavior regression, and the reviewed head's CI gate is green.

Priority: P3
Reviewed head: 67445ed872fddbd944b067d638d80eb19ffc68a3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No current-head CLI or Gateway TypeSafe evaluation is supplied; registered-provider coverage uses mocked fetch.
Agent review details

How this fits together

The Decision host supplies prepared model, credential, deadline, and admission facts to the TypeSafe plugin, which sends a native System One request and returns validated typed answers.

flowchart LR
  A[Decision host] --> B[Prepared TypeSafe provider]
  B --> C[Shared admission predicate]
  C --> D[Native request codec]
  D --> E[Guarded TypeSafe client]
  E --> F[System One endpoint]
  F --> G[V2 result validation]
  G --> A
Loading

Technical review

Best possible solution:

Retain the direct V2 executor, canonical compatibility predicate, and unchanged native transport and response-validation owners.

Do we have a high-confidence way to reproduce the issue?

This is a refactor rather than a reported runtime bug; source inspection confirms the private V1 bridge exists on main.

Is this the best way to solve the issue?

The change uses existing compatibility, System One encoding, and native validation owners without adding a competing execution path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 37410f5f464f.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 4f1a901 adds extensions/typesafe/src/decisions.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4f1a9013299a; files: extensions/typesafe/src/decisions.ts)
  • Josh Lehman: Raw commit cde6bbd adds src/decisions/validation.ts:125 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cde6bbdcfe84; files: src/decisions/validation.ts)
  • Peter Steinberger: Raw commit e0e2082 adds extensions/typesafe/src/decisions.ts:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: e0e2082ed423; files: extensions/typesafe/src/decisions.ts)

PR surface

Source +3, Tests +66, Docs +6, Other +2. Total +77 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 116 113 +3
Tests 3 69 3 +66
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 10 193 116 +77

Review metrics

Metric Value Why it matters
Production versus test growth Production net +3 lines; tests net +66 lines. The small production increase replaces the bridge with shared admission; test growth covers admission boundaries, public type narrowing, and image-reference behavior.
Public API addition One callable export on the existing Decisions SDK subpath. The documented predicate is shared by the canonical converter and native provider; existing exports and configuration remain unchanged.

Labels

Label changes:

  • add P3: This is a behavior-preserving maintenance refactor with no established user-facing outage.
  • add merge-risk: 🚨 compatibility: The PR adds a supported Plugin SDK callable; the maintainer-authored direction accepts this additive expansion while retaining existing codecs and exports.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a behavior-preserving maintenance refactor with no established user-facing outage.
  • merge-risk: 🚨 compatibility: The PR adds a supported Plugin SDK callable; the maintainer-authored direction accepts this additive expansion while retaining existing codecs and exports.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 6:46 AM ET / 10:46 UTC.

@vincentkoc
vincentkoc force-pushed the refactor/decision-14-typesafe-protocol branch from 8130530 to ed26e87 Compare October 30, 2026 13:37
@vincentkoc
vincentkoc force-pushed the refactor/decision-15-typesafe-native-v2 branch from 67445ed to 9629343 Compare October 30, 2026 13:38
@vincentkoc
vincentkoc force-pushed the refactor/decision-14-typesafe-protocol branch from ed26e87 to d34dfbe Compare October 30, 2026 13:58
@vincentkoc
vincentkoc force-pushed the refactor/decision-15-typesafe-native-v2 branch 2 times, most recently from e0125ce to 22c13fc Compare October 30, 2026 14:28
@vincentkoc
vincentkoc changed the base branch from refactor/decision-14-typesafe-protocol to main October 31, 2026 03:04
@vincentkoc
vincentkoc force-pushed the refactor/decision-15-typesafe-native-v2 branch from 22c13fc to 9e6d8eb Compare October 31, 2026 03:07
@vincentkoc
vincentkoc force-pushed the refactor/decision-15-typesafe-native-v2 branch from 9e6d8eb to 1e75597 Compare October 31, 2026 03:51
@vincentkoc
vincentkoc merged commit 44f536d into main Oct 31, 2026
145 of 146 checks passed
@vincentkoc
vincentkoc deleted the refactor/decision-15-typesafe-native-v2 branch October 31, 2026 04:04
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: typesafe rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant