Repository navigation
fix(hybrid): resolve system timezone through /usr/share/zoneinfo.default - #6
Open
brettporter wants to merge 1 commit into
Open
brettporter wants to merge 1 commit into
brettporter wants to merge 1 commit into
Conversation
_get_local_tz() derived the IANA timezone name by resolving /etc/localtime and splitting on the literal substring "zoneinfo/". On a clean macOS install, the symlink chain can resolve to /usr/share/zoneinfo.default instead of /usr/share/zoneinfo, so the split silently no-ops and the full absolute path gets passed to ZoneInfo(), which rejects it with "ZoneInfo keys may not be absolute paths". Since this runs at import time, it broke the server (and every test importing HybridRepository) on affected machines. Use a regex that strips either zoneinfo variant so the IANA name resolves correctly regardless of which directory the symlink chain lands on. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
/etc/localtimecan resolve through/usr/share/zoneinfo.defaultinstead of/usr/share/zoneinfo— likely macOS 27 (Tahoe successor) rather than an installation problem, since both/usr/share/zoneinfoand/var/db/timezone/zoneinfoare themselves symlinks that ultimately land on.defaulton affected systems._get_local_tz()(src/omnifocus_operator/repository/hybrid/hybrid.py) derived the IANA timezone name by splitting the resolved path on the literal substring"zoneinfo/". Against the.defaultvariant this substring never matches, so the split is a no-op and the entire absolute path gets passed toZoneInfo(...), which raisesValueError: ZoneInfo keys may not be absolute paths, got: /usr/share/zoneinfo.default/Australia/Sydney._LOCAL_TZ = _get_local_tz()), the failure isn't contained to timezone handling — it crashes the import ofHybridRepositoryentirely, breaking server startup on affected machines.zoneinfo/orzoneinfo.default/as the prefix, so the IANA name resolves correctly regardless of which directory the symlink chain lands on. Verified against all three real path variants (/usr/share/zoneinfo/...,/usr/share/zoneinfo.default/...,/var/db/timezone/zoneinfo/...)._get_local_tz()previously had zero test coverage since existing tests monkeypatch_LOCAL_TZdirectly rather than exercising the resolution logic itself.Test plan
TestGetLocalTzintests/test_hybrid_repository.py) covers all three symlink resolution variantsuv run ruff check/uv run ruff format --check— passuv run mypy src/— passuv run pytest --cov-fail-under=80— pass (pre-existing, unrelatedtest_due_today_returns_tasks_due_todayflake noted separately, not touched by this change)🤖 Generated with Claude Code