Skip to content

test(types): cover JSON shape parsing and time wire format - #1583

Merged
skevetter merged 1 commit into
mainfrom
test/coverage-maintenance-20261019
Oct 19, 2026
Merged

skevetter merged 1 commit into
mainfrom
test/coverage-maintenance-20261019

Conversation

@skevetter

@skevetter skevetter commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds hermetic unit tests for pkg/types JSON shape parsing and the Time wire format. Two new _test.go files, no product-code changes.

Coverage

  • StrIntArray and StrArray: string, number, list, and invalid-shape inputs. Invalid shapes are checked with types.ErrUnsupportedType.
  • StrBool: JSON bool and string forms, empty and absent values as unset, invalid input checked with strconv.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/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.

Size

Test-only change. Non-test changed lines: 0. Added test lines: 287 (cap 300).

Summary by CodeRabbit

  • Tests
    • 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.

@skevetter skevetter added the test-coverage Unit test coverage (maintenance bot) label Oct 19, 2026
@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit eed6962
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad5ef7ab8634dd398c74464

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to eed69

The added type tests present no identified merge-blocking risk; merge after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning 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 Warning 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 Passed checks: 3 passed
Check name Status Explanation
Title check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit eed6962
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad5ef7a3596b6522f91b2eb

@skevetter
skevetter marked this pull request as ready for review October 19, 2026 11:43
@mergify

mergify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter
skevetter merged commit 0d4cd26 into main Oct 19, 2026
111 checks passed
@skevetter
skevetter deleted the test/coverage-maintenance-20261019 branch October 19, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l test-coverage Unit test coverage (maintenance bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant