Make server JSON decoding more idiomatic Effect#3810
Draft
cursor[bot] wants to merge 3 commits into
Draft
Conversation
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>
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.
What Changed
Schema.fromJsonStringvia the shared JSON helper instead of rawJSON.parseand manual unknown record traversal.Optioninstead of nullable state.GitHubClito map schema decode failures directly to existing tagged CLI errors.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
Optionstate where values may be absent.Checklist
Validation:
vp checkvp run typecheckpnpm exec vp test run src/diagnostics/TraceDiagnostics.test.ts src/sourceControl/GitHubCli.test.ts(fromapps/server)Note
Make JSON decoding in server trace and GitHub PR modules use Effect idioms
TraceRecordLineSchemainTraceDiagnostics.tsto validate trace line structure with a typed schema; lines failing schema validation now incrementparseErrorCountalongside JSON parse failures.decodeGitHubPullRequestJsonEffect,decodeGitHubPullRequestListJsonEffect) ingitHubPullRequests.tsand updatesGitHubCli.tsto surface decode failures as tagged errors (GitHubPullRequestDecodeError) in the Effect error channel.toStringValue,unixNanoToDateTime,readExitTag,readExitCause) from nullable returns toOption<T>types throughoutTraceDiagnostics.ts.parseErrorCountin trace diagnostics now counts schema validation failures in addition to raw JSON parse errors.Macroscope summarized 55038ce.