ci: refresh bundled device_links.json seed in scheduled updates#6385
Conversation
The msh.to device-link catalog (androidApp/src/main/assets/device_links.json) is the offline seed for the runtime cache. It was hand-committed once and has since drifted from the API (201 bundled vs 209 upstream), so fresh-install / offline users see a stale purchase catalog until the runtime TTL refresh runs. Add a device-links step to the hourly scheduled-updates workflow, mirroring the firmware/hardware/event steps against the same api.meshtastic.org host, so the seed stays current. Two deliberate deviations from the sibling steps: - Diff on `.links` only. The response envelope carries a server-set `generatedAt` timestamp that changes every request; a whole-document diff would open a churn PR every hour even when the catalog is unchanged. - Write via `jq .` so the committed asset stays pretty-printed regardless of the API's response formatting. Also guard against a degraded 200-response with an empty catalog wiping the seed, mirroring the runtime, which ignores empty responses for the same reason. Wired into the PR body status list, commit message, and add-paths allowlist. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe scheduled update workflow now fetches and validates the device-links catalog, updates its bundled JSON asset when needed, reports its status in generated pull requests, and includes the asset in PR path filters. ChangesDevice links automation
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant ScheduledWorkflow
participant MeshtasticAPI
participant DeviceLinksAsset
participant PullRequest
ScheduledWorkflow->>MeshtasticAPI: Fetch deviceLinks
MeshtasticAPI-->>ScheduledWorkflow: Return HTTP response and JSON
ScheduledWorkflow->>DeviceLinksAsset: Write changed links catalog
ScheduledWorkflow->>PullRequest: Add status and asset path
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8).github/workflows/scheduled-updates.ymlTraceback (most recent call last): 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 |
Why
The msh.to device-link catalog (
androidApp/src/main/assets/device_links.json) is the offline seed for the runtime device-link cache. That cache refreshes itself fromapi.meshtastic.org/resource/deviceLinkson a 1-day TTL, so for an online user the seed is invisible within a day — but a fresh-install-offline user (or one who cleared data / switched radios) only ever sees the seed.The file was hand-committed once (#5765) and has been frozen since. It has already drifted from upstream — 201 bundled entries vs 209 live — so those users see a stale purchase catalog, and it only diverges further over time.
The sibling assets (
firmware_releases.json,device_hardware.json,event_firmware.json) are all kept current by the hourlyscheduled-updatesworkflow, from the same host. Device links are the odd one out. This closes that gap.🛠️ What changed
Adds an "Update device links list" step to
.github/workflows/scheduled-updates.yml, mirroring the existing firmware/hardware/event steps (sameapi.meshtastic.orghost, same HTTP-code +jq emptyvalidation), plus wiring into the PR status body, commit message, andadd-pathsallowlist.Two deliberate deviations from the sibling steps, both commented in-line:
.linksonly. The response envelope carries a server-setgeneratedAttimestamp that changes on every request. A whole-document diff (what the other steps use) would open a churn PR every hour even when the catalog is identical. Comparingjq --sort-keys '.links'reacts only to real catalog changes.jq .. Keeps the committed asset pretty-printed regardless of whether the API returns minified or pretty output, so future diffs stay minimal.Plus a defensive empty-catalog guard: a degraded HTTP-200 response with an empty
.linksarray is skipped rather than allowed to wipe the seed — mirroring the runtimeDeviceLinkRepositoryImpl, which ignores empty responses for the same reason.✅ Testing performed
No app code changed (CI/YAML only), so the Gradle baseline suite doesn't apply. Verified instead:
yaml.safe_load).generatedAt/links/source/version,linksis an array (209),generatedAtpresent.generatedAt-only delta → UNCHANGED, no churn PR ✅.links→ SKIP, seed protected ✅Reviewer notes
name:/PRtitle:stay(Firmware, Hardware, Translations)— already a shorthand (it omits event firmware too) — and thescheduled-updatesbranch name must stay stable, so neither was renamed.device_links.jsonis not regenerated in this PR. The first scheduled run after merge will produce that data refresh (201 → 209) as its own clean PR, keeping this change purely the mechanism.if: github.repository == 'meshtastic/Meshtastic-Android').🤖 Generated with Claude Code
Summary by CodeRabbit