Make process diagnostics parsing more idiomatic Effect#3914
Draft
cursor[bot] wants to merge 2 commits into
Draft
Make process diagnostics parsing more idiomatic Effect#3914cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
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
Optioninstead of nullable sentinels for parse failures.JSON.parse/ ad-hoc record traversal with compiled EffectSchemadecoders overSchema.UnknownFromJsonString.assertfrom@effect/vitestand added coverage for mocked Windows process output throughChildProcessSpawner.Why
This keeps the diagnostics code on Effect-native parsing/test seams, preserving the existing child-process abstraction while making malformed Windows process rows schema-validated and safely filtered.
Checklist
Verification:
pnpm exec vp test run src/diagnostics/ProcessDiagnostics.test.tsfromapps/server— passed (7 tests)pnpm exec vp check— passed (0 errors; unrelated existing React warnings)pnpm exec vp run typecheck— passedNote
Refactor process diagnostics parsing to use Effect's Option and Schema APIs
null-returning parse helpers (parsePositiveInt,parseNonNegativeInt,parseNumber) with Option-returning equivalents, and adds new helpers (parseInteger,trimNonEmpty,finiteNonNegativeNumberOrZero) in ProcessDiagnostics.ts.WindowsProcessRecordSchema struct with typed decoders (decodeWindowsProcessJson,decodeWindowsProcessRecord) replacing rawJSON.parsefor Windows process rows.normalizeWindowsProcessRownow returnsOption<ProcessRow>and validates input via Schema, yieldingOption.nonefor invalid records instead of silently producing bad data.expectto Effect'sassertAPI.Macroscope summarized 927c104.