Skip to content

Make server JSON decoding more idiomatic Effect#3810

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/idiomatic-effect-patterns-9ba6
Draft

Make server JSON decoding more idiomatic Effect#3810
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/idiomatic-effect-patterns-9ba6

Conversation

@cursor

@cursor cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Updated trace diagnostics NDJSON aggregation to decode span lines through Schema.fromJsonString via the shared JSON helper instead of raw JSON.parse and manual unknown record traversal.
  • Tracked trace span bounds internally with Option instead of nullable state.
  • Added Effect-returning GitHub PR JSON decoder variants and wired GitHubCli to map schema decode failures directly to existing tagged CLI errors.
  • Added focused regression coverage for schema-invalid trace lines and invalid GitHub PR JSON output.

Why

This keeps two server JSON parsing paths aligned with the repo's idiomatic Effect patterns: schema-driven parsing, structured tagged errors, Effect-returning decoder APIs, and explicit Option state where values may be absent.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • UI changes not applicable

Validation:

  • vp check
  • vp run typecheck
  • pnpm exec vp test run src/diagnostics/TraceDiagnostics.test.ts src/sourceControl/GitHubCli.test.ts (from apps/server)
Open in Web View Automation 

Note

Make JSON decoding in server trace and GitHub PR modules use Effect idioms

  • Introduces TraceRecordLineSchema in TraceDiagnostics.ts to validate trace line structure with a typed schema; lines failing schema validation now increment parseErrorCount alongside JSON parse failures.
  • Adds Effect-returning decoders (decodeGitHubPullRequestJsonEffect, decodeGitHubPullRequestListJsonEffect) in gitHubPullRequests.ts and updates GitHubCli.ts to surface decode failures as tagged errors (GitHubPullRequestDecodeError) in the Effect error channel.
  • Converts internal helpers (toStringValue, unixNanoToDateTime, readExitTag, readExitCause) from nullable returns to Option<T> types throughout TraceDiagnostics.ts.
  • Behavioral Change: parseErrorCount in trace diagnostics now counts schema validation failures in addition to raw JSON parse errors.

Macroscope summarized 55038ce.

cursoragent and others added 3 commits July 8, 2026 16:15
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant