Skip to content

chore: import the time zone data explicitly - #4204

Merged
pbleser-oc merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:fix/4200-embed-tzdata
Dec 4, 2026
Merged

pbleser-oc merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:fix/4200-embed-tzdata

Conversation

@pbleser-oc

@pbleser-oc pbleser-oc commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Related to #4200.

With TZ, the revision cleanup counts days in that time zone (#4200, opencloud-eu/reva#1097). The container image (alpine) has no time zone files, so TZ only works there because the binary embeds the time zone data. Today, it does so only because a dependency, OPA, imports time/tzdata (vendor/github.com/open-policy-agent/opa/v1/topdown/time.go). This imports it explicitly, so that TZ doesn't stop working unnoticed when that dependency changes.

No change in behavior, nor in the size of the binary: a stripped build is 114,025,672 bytes with and without the import. Go uses the embedded data only as a fallback, after the time zone files of the system, so where the system has more recent ones, those still win.

(This PR first claimed that TZ doesn't work in the image at all, see #4205, closed: that was a test with a separate Go program instead of opencloud.)

AI assistance: Claude Code (claude-opus-5-5) wrote the change and this description, and measured the binary sizes; I reviewed them.

@codacy-production

codacy-production Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage ∅ diff coverage · 0.00% coverage variation

Metric Results
Coverage variation ✅ 0.00% coverage variation (-1.00%)
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4154dcd) 99485 32810 32.98%
Head commit (6e56885) 99485 (+0) 32809 (-1) 32.98% (0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4204) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

✅ No blocking issues noticed

No blocking implementation issues were identified. The main risk is that the time-zone fallback and related local-time behavior lack automated coverage, so regressions may go undetected.

About this PR

  • Add automated coverage for the container fallback, system time zone compatibility, and local-time consumers such as revision cleanup. Consider documenting the behavior change for deployments using non-UTC TZ settings.

Test suggestions

  • Run the binary without system time zone files with TZ set to a non-UTC zone and verify local time uses that zone.
  • Verify behavior remains compatible on systems with system time zone files.
  • Verify revision cleanup uses the configured local time zone.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Run the binary without system time zone files with TZ set to a non-UTC zone and verify local time uses that zone.
2. Verify behavior remains compatible on systems with system time zone files.
3. Verify revision cleanup uses the configured local time zone.

TIP How was this review? Give us feedback

@pbleser-oc pbleser-oc added Type:Maintenance E.g. technical debt, packaging, etc. and removed Type:Bug labels Dec 3, 2026
@pbleser-oc pbleser-oc changed the title fix: let TZ work in container images without time zone files chore: import the time zone data explicitly Dec 3, 2026
@pbleser-oc
pbleser-oc force-pushed the fix/4200-embed-tzdata branch from 787b9ff to 930d3fc Compare December 3, 2026 13:55
@pbleser-oc
pbleser-oc requested a review from aduffeck December 3, 2026 13:56
With TZ, the revision cleanup counts days in that time zone (opencloud-eu#4200). The
container image (alpine) has no time zone files, so TZ only works there
because the binary embeds the time zone data, which today it does only
because a dependency, OPA, imports time/tzdata. Import it explicitly, so
that TZ doesn't stop working unnoticed when that dependency changes.

No change in behavior, nor in the size of the binary.

opencloud-eu#4200

Assisted-by: Claude Code:claude-opus-5-5
@pbleser-oc
pbleser-oc force-pushed the fix/4200-embed-tzdata branch from 930d3fc to 6e56885 Compare December 4, 2026 10:00
@pbleser-oc
pbleser-oc merged commit 65929b5 into opencloud-eu:main Dec 4, 2026
62 checks passed
@pbleser-oc
pbleser-oc deleted the fix/4200-embed-tzdata branch December 4, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Maintenance E.g. technical debt, packaging, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants