Skip to content

Conversation

Comment on lines +16 to +19
CreationTime time.Time `json:"creationTime,omitempty"`
AdvanceNoticeDuration time.Duration `json:"advanceNoticeDuration,omitempty"`
IODrainTimeout time.Duration `json:"ioDrainTimeout,omitempty"`
StatusPollInterval time.Duration `json:"statusPollInterval,omitempty"`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These do not change behavior, omitempty is ineffective in these cases.

Comment on lines +8 to +9
BeforeFolder *ActionCommand `json:"beforeFolder,omitempty"`
AfterFolder *ActionCommand `json:"afterFolder,omitempty"`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These do not change behavior: omitempty and omitzero behave the same for pointer types (in the absence of an IsZero() function with the type as a receiver parameter)

@julio-lopez julio-lopez requested a review from Copilot November 25, 2025 01:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reverts JSON struct tag changes from omitzero back to omitempty across policy structures and related types. The changes address issue #5006 by reverting three previous PRs (#4981, #4910, #4907) that introduced omitzero tags. The revert affects JSON serialization behavior for policy structs, ensuring zero values are handled consistently with the standard omitempty tag.

Key Changes:

  • Reverted omitzero to omitempty across all policy-related struct fields
  • Updated linter configuration to disable the omitzero check in the modernize linter
  • Modified object and format structs to use omitempty consistently

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
snapshot/policy/upload_policy.go Reverted JSON tags in UploadPolicy and UploadPolicyDefinition structs
snapshot/policy/splitter_policy.go Reverted JSON tags in SplitterPolicy and SplitterPolicyDefinition structs
snapshot/policy/scheduling_policy.go Reverted JSON tags in SchedulingPolicy and SchedulingPolicyDefinition structs; reordered Manual field
snapshot/policy/retention_policy.go Reverted JSON tags in RetentionPolicy and RetentionPolicyDefinition structs
snapshot/policy/policy.go Reverted JSON tags in top-level Policy and Definition structs
snapshot/policy/os_snapshot_policy.go Reverted JSON tags in OSSnapshotPolicy and VolumeShadowCopyPolicy structs
snapshot/policy/logging_policy.go Reverted JSON tags in LoggingPolicy, DirLoggingPolicy, and EntryLoggingPolicy structs
snapshot/policy/files_policy.go Reverted JSON tags in FilesPolicy and FilesPolicyDefinition structs
snapshot/policy/error_handling_policy.go Reverted JSON tags in ErrorHandlingPolicy and ErrorHandlingPolicyDefinition structs
snapshot/policy/compression_policy.go Reverted JSON tags in CompressionPolicy and MetadataCompressionPolicy structs
snapshot/policy/actions_policy.go Reverted JSON tags in ActionsPolicy and ActionsPolicyDefinition structs
snapshot/manifest.go Added omitempty to ObjectID field in DirEntry; reverted StorageStats fields to omitempty
repo/object/indirect.go Added omitempty to Object field in IndirectObjectEntry
repo/format/upgrade_lock_intent.go Reverted time-related fields to omitempty in UpgradeLockIntent
repo/format/content_format.go Reverted EpochParameters field to omitempty
repo/blob/rclone/rclone_options.go Reverted StartupTimeout field to omitempty
.golangci.yml Disabled omitzero check in modernize linter configuration

Comment on lines +69 to 70
Manual bool `json:"manual,omitempty"`
Cron []string `json:"cron,omitempty"`
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Manual field has been moved between NoParentTimesOfDay and Cron, changing the struct field order. This could affect JSON marshaling order and break existing code that relies on struct field positions (e.g., positional initialization). Consider documenting this field reordering if intentional, or restore the original field order.

Suggested change
Manual bool `json:"manual,omitempty"`
Cron []string `json:"cron,omitempty"`
Cron []string `json:"cron,omitempty"`
Manual bool `json:"manual,omitempty"`

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.03%. Comparing base (cb455c6) to head (2b339f6).
⚠️ Report is 782 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5035      +/-   ##
==========================================
+ Coverage   75.86%   78.03%   +2.16%     
==========================================
  Files         470      548      +78     
  Lines       37301    31398    -5903     
==========================================
- Hits        28299    24501    -3798     
+ Misses       7071     4849    -2222     
- Partials     1931     2048     +117     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@julio-lopez julio-lopez marked this pull request as ready for review November 25, 2025 03:17
@julio-lopez julio-lopez merged commit 4526f03 into kopia:master Nov 25, 2025
30 of 31 checks passed
@julio-lopez julio-lopez deleted the revert-omitzero branch November 25, 2025 03:18
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.

2 participants