Repository navigation
Factor a transport-agnostic adapter core to stop the four-way adapter drift - #1556
Conversation
… drift (closes #1500) TauriAdapter, HttpAdapter, the dev-proxy, and a fourth embedded copy in the e2e harness each hand-encoded the same node_service.proto request/response shapes independently, with nothing asserting they agreed. Extract the shared shaping rules (CreateNode field defaults, the task-update tri-state clear/set/no-change encoding, InsertPosition's oneof encoding, HTTP route templates) into adapter-core.ts; TauriAdapter/HttpAdapter and the dev-proxy now call the same builders instead of re-deriving them, and the e2e harness imports the real HttpAdapter instead of a fourth duplicate. While wiring dev-proxy to the shared InsertPosition builder, found and fixed two live bugs it exposed: POST /api/nodes silently dropped insertPosition entirely, and POST /api/nodes/:id/parent still sent a legacy insertAfterNodeId field that no longer exists in MoveNodeRequest's oneof — both meant browser-mode create/move-with-position silently fell back to appending at the end. Adds a contract test (adapter-contract.e2e.ts) asserting shape parity between the transports and exercising the fixed insert-position round-trip against a real daemon, plus unit tests for the extracted builders. Co-Authored-By: Claude <[email protected]>
…ties.task Verified against a real daemon (built via the pre-push gate's cargo build): assignee/status/priority are stored flat under properties (see packages/core/src/models/task_node.rs), not namespaced under properties.task — my initial assertion assumed a namespace that doesn't exist on the wire. Co-Authored-By: Claude <[email protected]>
Sessions have repeatedly treated a git push timeout as a push failure when it was actually the pre-push gate (scripts/test-gate.ts, ADR-047) still mid cold cargo build — it reruns test:all, cargo build --bin nodespaced, and the full e2e suite on every push. Note the expected duration and to check actual output before concluding a push failed. Co-Authored-By: Claude <[email protected]>
Code Review SummaryThis is a net-positive, well-scoped refactor that does what it says: it collapses four hand-synced adapter implementations into one shared core, and it found two real, previously-shipping bugs while doing it ( Recommendation: APPROVE, with one non-blocking process gap worth a fast follow-up (dev-tools has zero static verification in this repo, before or after this PR) and a couple of clarifications worth a comment/doc update. Requirements Check
FindingsCritical IssuesNone. No security, correctness-of-shipped-behavior, or architectural-regression issues block this merge. Suggested Improvements🟡 async updateTaskNode(id: string, version: number, update: TaskNodeUpdate): Promise<TaskNode> {
return withDiagnosticLogging(
'updateTaskNode',
() => invoke<TaskNode>('update_task_node', { id, version, update }),
[id, version, update]
);
}The PR's own framing calls Recommendation: this doesn't need to block the merge, since it can't be closed in TypeScript. But the PR body / a code comment on Engineering principle: a "single source of truth" claim is only as strong as its weakest untested seam. Documenting the boundary honestly costs nothing and prevents a future reader from assuming cross-language parity that isn't actually enforced. 🟡 Cross-package relative import from Verified: the workspace root's Recommendation: either (a) add Engineering principle: cross-package imports that bypass the package boundary (via relative paths instead of a workspace dependency) work until they don't, and the failure mode (a broken import in an unlint file) is invisible until someone happens to run the exact path that exercises it. 🟢 These are Nitpicks
Answers to the specific scope questions raised
RecommendationAPPROVE. The refactor is a genuine net improvement — it collapses real duplication, is caught by tests that exercise the actual runtime paths (not mocks pretending to), and found/fixed two live bugs in the process. The findings above are follow-up hardening (visibility of the Tauri-side boundary, static coverage of dev-tools), not blockers. |
malibio
left a comment
There was a problem hiding this comment.
Review recommendation: APPROVE (see full findings in the review comment above). Note: could not submit a formal GitHub 'Approve' review because GitHub blocks self-approval on your own PR — this comment-type review records the recommendation instead.
- TauriAdapter.updateTaskNode forwards TaskNodeUpdate as-is rather than calling buildTaskNodeUpdatePatch; the tri-state encoding for that path lives in the Rust #[tauri::command] handler and can't literally share code with the TS builder. Documented why, and pointed at ADR-048 decision 2 as the planned way to prove the two encodings still agree. - adapter-core.ts is imported by dev-proxy.ts (a separate workspace package with no $lib alias resolution) via a relative path; documented that every $lib import here must stay type-only. Addresses reviewer recommendations from PR #1556's pragmatic-code-review (both 🟡, non-blocking; recommendation was APPROVE). Skipped: extracting dev-tools into the typecheck pipeline (repo-wide tooling scope, better as its own issue) and a grep-based static guard against dev-proxy re-inlining the tri-state encoding (marginal value given the live contract test already exercises it end-to-end). Co-Authored-By: Claude <[email protected]>
Addressed review feedbackRecommendation from the pragmatic-code-review was APPROVE — all findings were 🟡/🟢, non-blocking. ✅ Addressed (2):
⏭️ Skipped (2):
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: All changes in this follow-up are documentation-only (code comments + PR body wording) — no logic changed, no new surface added. |
Summary
TauriAdapter,HttpAdapter, the dev-proxy's REST→gRPC translation, and a fourth duplicate embedded in the e2e harness) into a singleadapter-core.ts.TauriAdapter/HttpAdapterand the dev-proxy now call the same builders instead of re-deriving them by hand, anddaemon-harness.tsimports the realHttpAdapterinstead of a fourth copy.packages/protohas no JS/TS codegen output (it's a Rust-only crate consumed viatonic-build), so "sourced from nodespace-proto" here means the builders hand-encode the.protofile's documented field/optionality contracts (with comments citing the source message/field), not generated bindings.encodeInsertPositionbuilder, found and fixed two live bugs it exposed:POST /api/nodessilently droppedinsertPositionentirely, andPOST /api/nodes/:id/parentstill sent a legacyinsertAfterNodeIdfield that no longer exists inMoveNodeRequest's proto oneof — both meant browser-mode create/move-with-position silently fell back to appending at the end instead of honoring the caller's requested position.adapter-contract.e2e.ts— a contract test asserting shape parity between the transports and exercising the fixed insert-position round-trip against a real daemon — plus unit tests for the extracted builders inadapter-core.test.ts.TauriAdapter.updateTaskNodestill forwards its update as-is rather than calling the shared tri-state builder — that encoding happens in the Rust#[tauri::command]handler on that path, which can't literally share TS code. Documented in place; ADR-048 decision 2 (a Rust-side integration test against the Tauri command layer) is the planned way to prove the two encodings agree.Closes #1500.
Test plan
bun run test— 148 test files, 3959 tests passed (baseline was 147/3948; +1 new unit test file)bun run test:e2e— 5 test files, 24 tests passed against a real headless daemon (includes the new adapter-contract.e2e.ts and the fixed insert-position regression test)bunx tsc --noEmit— clean (only one pre-existing, unrelated error inbacklinks-panel.test.ts)bun run quality:fix(desktop-app scope) — 0 errors, 0 warningstest:all+cargo build --bin nodespaced+test:e2e) passed🤖 Generated with Claude Code