You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(types): cover JSON shape parsing and time wire format - #1583
Time: JSON marshal and unmarshal, query-parameter marshal and unmarshal, zero and nil handling, ordering helpers.
Why
pkg/types has no direct tests for these decoders or the time encoding. Their output feeds config and API parsing. No open PR touches this package.
Validation
go test -race -count=3 ./pkg/types/: pass
gofmt -l pkg/types/: clean
golangci-lint run ./pkg/types/...: no findings in the added files
Break-it check: temporarily changed the StrBool.Bool empty branch to return true, nil and removed .UTC() from Time.MarshalJSON. Failing tests: TestStrBoolJSONValueParsesToBool, TestStrBoolBoolNilReceiverIsFalse, TestTimeMarshalJSON. Both product lines were restored; tracked files are unchanged.
Unrelated failures on the base branch: pkg/agent/delivery, pkg/driver/docker, pkg/driver/microsandbox.
CodeRabbit CLI
coderabbit review --agent --committed failed twice with a WebSocket connection error, so no review ran.
Expanded coverage for parsing JSON values and timestamps, including supported input formats, invalid values, empty and nil cases, and time-zone handling.
Added checks for timestamp serialization, query-parameter round trips, and time comparison helpers. These tests help verify consistent handling of common and edge-case inputs.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 00f83e63-ae77-4535-bcc4-efe892b1e793
📥 Commits
Reviewing files that changed from the base of the PR and between 91c3655 and eed6962.
📒 Files selected for processing: 2
pkg/types/json_values_test.go
pkg/types/time_test.go
📝 Walkthrough
This change adds tests for JSON decoding of several value types and for Time JSON and query-parameter behavior, including parsing, serialization, nil handling, and ordering helpers.
Changes: Types test coverage
Layer / File(s)
Summary
JSON value decoding tests pkg/types/json_values_test.go
Adds shared decode-case checks and tests for StrIntArray, StrArray, StrBool, and OptionEnumArray, including accepted inputs and expected errors.
Time serialization and helper tests pkg/types/time_test.go
Adds tests for JSON and query-parameter serialization and parsing, plus Before, Equal, and IsZero behavior.
The added type tests present no identified merge-blocking risk; merge after normal checks.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
The description explains the scope, coverage, rationale, validation commands, break-it checks, and unrelated failures. However, it omits several template sections and required information, including t…
Update the description to follow the repository template. Add the issue reference or state none, select the applicable type of change, complete the AI assistance section, record the unit-test and integration-test applicability, complete the…
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: tests for JSON shape parsing and the Time wire format. It follows the repository's Conventional Commits style.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the scope, coverage, rationale, validation commands, break-it checks, and unrelated failures. However, it omits several template sections and required information, including the issue reference, type of change, AI assistance declaration, checklist confirmations, and the explicit testing section.
Resolution
Update the description to follow the repository template. Add the issue reference or state none, select the applicable type of change, complete the AI assistance section, record the unit-test and integration-test applicability, complete the checklist, and retain the existing validation details. Remove sections that do not apply rather than leaving them incomplete.
Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
Summary
Adds hermetic unit tests for
pkg/typesJSON shape parsing and theTimewire format. Two new_test.gofiles, no product-code changes.Coverage
StrIntArrayandStrArray: string, number, list, and invalid-shape inputs. Invalid shapes are checked withtypes.ErrUnsupportedType.StrBool: JSON bool and string forms, empty and absent values as unset, invalid input checked withstrconv.ErrSyntax, nil receiver.OptionEnumArray: plain values, object values with display names, empty list, invalid shapes.Time: JSON marshal and unmarshal, query-parameter marshal and unmarshal, zero and nil handling, ordering helpers.Why
pkg/typeshas no direct tests for these decoders or the time encoding. Their output feeds config and API parsing. No open PR touches this package.Validation
go test -race -count=3 ./pkg/types/: passgofmt -l pkg/types/: cleangolangci-lint run ./pkg/types/...: no findings in the added filesStrBool.Boolempty branch toreturn true, niland removed.UTC()fromTime.MarshalJSON. Failing tests:TestStrBoolJSONValueParsesToBool,TestStrBoolBoolNilReceiverIsFalse,TestTimeMarshalJSON. Both product lines were restored; tracked files are unchanged.pkg/agent/delivery,pkg/driver/docker,pkg/driver/microsandbox.CodeRabbit CLI
coderabbit review --agent --committedfailed twice with a WebSocket connection error, so no review ran.Size
Test-only change. Non-test changed lines: 0. Added test lines: 287 (cap 300).
Summary by CodeRabbit