fix(config): persist resolved locations and align deployment guidance - #92
Conversation
📝 WalkthroughWalkthroughThe PR adds locked location-field backfilling during CLI execution, validates persistence and error handling, documents matching and caching rules, and revises multilingual Docker, configuration, publishing, troubleshooting, diagnostics, and environment-variable guidance. ChangesLocation resolution backfill
Documentation and deployment guidance
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant LocationResolver
participant backfill_location_fields
participant locations_json
CLI->>LocationResolver: Resolve configured locations
LocationResolver-->>CLI: Return resolved locations
CLI->>backfill_location_fields: Pass configured and resolved locations
backfill_location_fields->>locations_json: Persist missing precise fields under lock
locations_json-->>CLI: Return persistence result
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoDocs: align multilingual Docker deployment and optional RSS guidance
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 117-124: After creating rss-sources.json, add the required chgrp
and chmod commands so the mounted file is readable inside the container. Apply
the same post-creation permission instructions in README.md lines 117-124,
README_ja.md lines 117-125, and README_zh-Hans.md lines 117-125.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 87ff0c5d-64db-408a-95cf-86d0357257ff
📒 Files selected for processing (4)
README.mdREADME_ja.mdREADME_zh-Hans.mdenv.example
Code Review by Qodo
Context used✅ Compliance rules (platform):
41 rules 1.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@weather_briefing/config.py`:
- Around line 315-335: Serialize the full read-modify-write transaction in the
relevant location-update function: acquire the file lock before calling
_json_file(path), reload the current items while holding it, and retain the lock
through write, truncate, flush, and fsync. Ensure concurrent daemon and manual
runs cannot overwrite each other with stale snapshots or interleave writes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 306ad96b-6baa-4ad7-8188-0af93f06cc68
📒 Files selected for processing (9)
README.mdREADME_ja.mdREADME_zh-Hans.mddocs/design.mddocs/requirements.mdtests/test_cli.pytests/test_config.pyweather_briefing/cli.pyweather_briefing/config.py
🚧 Files skipped from review as they are similar to previous changes (2)
- README_ja.md
- README.md
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit b486050 |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit cf96c00 |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 35c0af1 |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 8385107 |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit fc302db |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
34-36: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winClarify the native Windows support boundary.
The statement that the project can run “in other ways” does not communicate the documented scope that native Windows is unsupported. Narrow this wording or add an explicit note so users do not interpret native Windows as a supported runtime.
Suggested wording
-Docker is the recommended deployment method. The examples below use a fixed-version image from Docker Hub. You can also run the project in other ways, as long as it can run persistently and preserve the configuration and state described above. +Docker is the recommended deployment method. The examples below use a fixed-version image from Docker Hub. Other supported deployment methods must run persistently and preserve the configuration and state described above. Native Windows is not a supported runtime.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 34 - 36, Update the “Using the published image” section to explicitly state that native Windows is unsupported, while retaining Docker and other supported persistent deployment options. Narrow the “other ways” wording so it cannot imply native Windows is an available runtime.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/design.md`:
- Line 60: Update the documentation describing backfill_location_fields() so it
states that latitude and longitude are written only when both existing
coordinate values are null, rather than independently filling missing fields.
Keep the documented name backfill behavior and preservation of other fields
unchanged.
---
Outside diff comments:
In `@README.md`:
- Around line 34-36: Update the “Using the published image” section to
explicitly state that native Windows is unsupported, while retaining Docker and
other supported persistent deployment options. Narrow the “other ways” wording
so it cannot imply native Windows is an available runtime.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fa7eeafa-1149-41fc-875a-052e9336876c
📒 Files selected for processing (10)
README.mdREADME_ja.mdREADME_zh-Hans.mddocs/design.mddocs/notes.mddocs/requirements.mdtests/test_cli.pytests/test_config.pyweather_briefing/cli.pyweather_briefing/config.py
🚧 Files skipped from review as they are similar to previous changes (7)
- weather_briefing/cli.py
- docs/requirements.md
- docs/notes.md
- weather_briefing/config.py
- tests/test_cli.py
- README_zh-Hans.md
- README_ja.md
|
/agentic_review |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Code review by qodo was updated up to the latest commit 87fcd10 |
|
Qodo item 11 (POSIX-only fcntl import) is intentionally rejected. Native Windows is outside this project's supported runtime contract; supported targets are Linux containers and direct POSIX execution. The three READMEs and docs/notes.md explicitly document this boundary. Deferring the import would not provide supported cross-platform locking semantics and would misleadingly imply native Windows portability. |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 7833b1d |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
name,latitude, andlongitudefields inlocations.jsonBehavior
Exact geocoding results are written to
state/geocoding.jsonbefore the program attempts to updatelocations.json. If the writable bind mount is unavailable, locked, or encounters another I/O failure, the program logs a warning and continues the current run; later runs reuse the cached result instead of querying the geocoding provider again.After all locations resolve, exact results are backfilled before any reduced-precision confirmation alert is sent. A delivery failure therefore cannot prevent resolved fields for other locations from being persisted.
Resolved names must be non-empty strings, and coordinates must be non-boolean numbers that are finite and within valid latitude and longitude ranges before they can be written back. Invalid provider results leave
locations.jsonunchanged and are handled by the same best-effort backfill boundary.\n\nLatitude and longitude are applied as an atomic pair against the current locked file contents. If another writer leaves only one coordinate present between configuration loading and backfill, the existing coordinate is preserved and the resolved pair is not mixed into it.The writable
locations.jsonbind mount is intentional. Updates happen on the existing inode for compatibility with a single-file Docker bind mount. Readers take a shared lock and backfills hold an exclusive lock through read, merge, write, truncate, flush, andfsync; lock acquisition is limited to five seconds.Users who do not enable RSS do not need to create or mount an RSS source file. The documented
docker execcommands are noninteractive one-shot operations and therefore do not allocate stdin or a TTY with-it.Native Windows is outside the supported runtime scope. Docker and direct POSIX execution are supported, so the location-file locking implementation uses the Python
fcntlstandard-library module.Validation
prek run --all-filesuv run --with pytest --with pytest-cov -- pytest --cov --cov-branch --cov-report=xml(885 passed)99.85%lines,99.55%branchessh -non the deployment shell blocks in all three READMEsSummary by CodeRabbit
locations.jsonto fill only missing fields without overwriting existing values; precision-reduced matches require user confirmation.locations.jsonprevents conflicts when multiple processes run.env.example.