Skip to content

ci: refresh bundled device_links.json seed in scheduled updates#6385

Merged
jamesarich merged 1 commit into
mainfrom
claude/msh-to-offline-caching-ec47d2
Jul 23, 2026
Merged

ci: refresh bundled device_links.json seed in scheduled updates#6385
jamesarich merged 1 commit into
mainfrom
claude/msh-to-offline-caching-ec47d2

Conversation

@jamesarich

@jamesarich jamesarich commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

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 from api.meshtastic.org/resource/deviceLinks on 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 hourly scheduled-updates workflow, 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 (same api.meshtastic.org host, same HTTP-code + jq empty validation), plus wiring into the PR status body, commit message, and add-paths allowlist.

Two deliberate deviations from the sibling steps, both commented in-line:

  • Diff on .links only. The response envelope carries a server-set generatedAt timestamp 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. Comparing jq --sort-keys '.links' reacts only to real catalog changes.
  • Write via 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 .links array is skipped rather than allowed to wipe the seed — mirroring the runtime DeviceLinkRepositoryImpl, 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 parses (yaml.safe_load).
  • Live endpoint shape confirmed: top-level generatedAt/links/source/version, links is an array (209), generatedAt present.
  • Diff logic exercised against the live response + committed file:
    • real catalog change (209 vs 201) → UPDATED
    • generatedAt-only delta → UNCHANGED, no churn PR ✅
    • empty .linksSKIP, seed protected ✅

Reviewer notes

  • The workflow name:/PR title: stay (Firmware, Hardware, Translations) — already a shorthand (it omits event firmware too) — and the scheduled-updates branch name must stay stable, so neither was renamed.
  • The bundled device_links.json is 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.
  • Only runs on the upstream repo (if: github.repository == 'meshtastic/Meshtastic-Android').

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Automated update checks now include the device links catalog.
    • Valid device-link changes are included in update pull requests alongside firmware and hardware updates.
  • Bug Fixes
    • Prevented invalid, empty, or unsuccessful API responses from overwriting the bundled device-link data.
    • Reduced unnecessary update activity by detecting changes only to the device links themselves.

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>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d7181cb-b070-49da-8d4d-642cc91cbf6c

📥 Commits

Reviewing files that changed from the base of the PR and between bb7508a and e80bd25.

📒 Files selected for processing (1)
  • .github/workflows/scheduled-updates.yml

📝 Walkthrough

Walkthrough

The 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.

Changes

Device links automation

Layer / File(s) Summary
Fetch and update device links
.github/workflows/scheduled-updates.yml
Fetches the device-links API response, validates HTTP status and JSON, ignores empty catalogs, compares only links, and pretty-prints changed data into device_links.json.
Pull request reporting and inclusion
.github/workflows/scheduled-updates.yml
Adds device-links status messaging, lists the device-links update in the PR body, and includes the asset in PR path filters.

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
Loading

Possibly related PRs

Suggested labels: ci, automation

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding scheduled updates for the bundled device_links.json seed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jamesarich
jamesarich merged commit f8f6ca7 into main Jul 23, 2026
6 checks passed
@jamesarich
jamesarich deleted the claude/msh-to-offline-caching-ec47d2 branch July 23, 2026 12:49
@github-actions github-actions Bot added ci Pertains to ci/cd actions or workflows repo Repository maintenance labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Pertains to ci/cd actions or workflows repo Repository maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant