Skip to content

test(rivetkit-agent-os): partial-failure driver test for readFiles batch DTO (Option<content>, Option<error>)#5196

Open
abcxff wants to merge 1 commit into
stack/feat-rivetkit-agent-os-phase-3-filesystem-mkdir-readdir-exists-move-deletefile-readfiles-writefiles-readdirrecursive-arms-batch-dtos-onyykwlkfrom
stack/test-rivetkit-agent-os-partial-failure-driver-test-for-readfiles-batch-dto-option-content-option-error-pzzzpmtr
Open

test(rivetkit-agent-os): partial-failure driver test for readFiles batch DTO (Option<content>, Option<error>)#5196
abcxff wants to merge 1 commit into
stack/feat-rivetkit-agent-os-phase-3-filesystem-mkdir-readdir-exists-move-deletefile-readfiles-writefiles-readdirrecursive-arms-batch-dtos-onyykwlkfrom
stack/test-rivetkit-agent-os-partial-failure-driver-test-for-readfiles-batch-dto-option-content-option-error-pzzzpmtr

Conversation

@abcxff

@abcxff abcxff commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@abcxff

abcxff commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Stack for rivet-dev/rivet

Check out this stack: forklift get https://github.com/rivet-dev/rivet/pull/5196
Pull/update this stack: forklift sync
Publish local edits: forklift submit
Merge when ready: forklift merge

@claude

claude Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Code Review

This PR adds a test that covers partial-failure behavior in the readFiles batch DTO, specifically targeting the BatchReadResultDto serialization where Option<content> and Option<error> use #[serde(skip_serializing_if)]. This is a genuinely useful regression guard — the failure mode (fields silently elided on the wire) would otherwise be invisible.

Strengths

  • Meaningful coverage: Targets a concrete serialization invariant that none of the existing batch tests covered. Without this, wrong None-handling in BatchReadResultDto could silently return empty results.
  • Proper isolation: Fresh actor per test via crypto.randomUUID() key, no cross-test contamination.
  • Thorough assertions: Checks path, content, and error for both the success and failure entries, in the correct order.
  • Consistent structure: Timeout, useRealTimers, and setup follow the same pattern as all sibling tests.

Minor issues

1. Inline comment fragments (CLAUDE.md: comments must be complete sentences)

// Successful entry: content present, no error field.
// Failed entry: no content, error string surfaced.

Both are noun-phrase fragments. Per repo style these should be sentences:

// The successful entry has content and no error field.
// The failed entry has no content but surfaces a non-empty error string.

2. Redundant optional chaining after a type assertion

expect(typeof results[1].error).toBe("string");
expect(results[1].error?.length).toBeGreaterThan(0);

The typeof check already proves error is a string, so ?. is unnecessary. results[1].error.length is clearer.

3. Content not asserted as defined for the success case

expect(new TextDecoder().decode(results[0].content)).toBe("present");

TextDecoder.decode(undefined) returns "", so this would silently pass if content were undefined — the string mismatch would catch it eventually, but adding expect(results[0].content).toBeDefined() before the decode makes the failure message immediate and unambiguous, consistent with how results[1].content is handled.


None of these are blockers. The test adds real value and the logic is correct. Addressing the comment style and the optional-chaining nit before merge would keep the file consistent with the rest of the suite.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant