Skip to content

fix(docs): keep screenshots versioned docs still link - #7694

Merged
jamesarich merged 2 commits into
mainfrom
fix/docs-sync-keep-versioned-images
Oct 20, 2026
Merged

jamesarich merged 2 commits into
mainfrom
fix/docs-sync-keep-versioned-images

Conversation

@rcarteraz

@rcarteraz rcarteraz commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Fixes #7695

The docs sync deletes every screenshot in static/img/android/docs/ that no current page references, but the frozen Docusaurus snapshots under versioned_docs/ link the same files. When the app drops a screenshot, the site build fails: meshtastic/meshtastic#2728 is red because nodes_node_list.webp, settings_password_field.webp and firmware_disclaimer.webp were pruned while the 2.7 snapshot still uses them.

🐛 Bug Fixes

  • sync-android-docs.js scans versioned_docs/**/*.md(x) for /img/android/docs/ links and skips pruning those images, logging each one it keeps. Current pages are unaffected: an image stays only as a file, never as a link.

Testing Performed

The script has no automated tests. Both scripts were run against a fresh checkout of meshtastic/meshtastic master with --convert-webp, sourcing docs from this branch:

  • The original script removed four images that versioned_docs/version-2.7 links: the three in docs: sync latest Android app documentation meshtastic#2728 and also connections_empty_state.webp.
  • The patched script kept all four, and every /img/android/docs/ image that versioned_docs/ links still existed afterwards.

The docs-site build was not run.

The docs repo's sync workflow runs this script from the latest Android release, so this fix takes effect on the first sync after it ships in a release.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented image assets referenced by versioned documentation from being incorrectly removed during documentation synchronization.
    • Improved image reference matching for links that include query parameters or URL fragments.
    • Ensured documentation assets remain available across versioned releases, reducing the risk of broken images in published content.

The docs sync prunes every image in static/img/android/docs/ that no current page references. Frozen Docusaurus snapshots under versioned_docs/ link the same files, so a screenshot dropped from the app breaks the site build: meshtastic/meshtastic#2728 fails on three images the 2.7 snapshot still uses. Skip pruning any image a versioned_docs/ page links.
@github-actions github-actions Bot added the bugfix PR tag label Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: meshtastic/Meshtastic-Android/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1c039d4-1805-4531-b81c-ee0b35501421
📥 Commits

Reviewing files that changed from the base of the PR and between 34de90f and f4b8b60.

📒 Files selected for processing: 1
  • scripts/sync-android-docs.js
🚧 Files skipped from review as they are similar to previous changes: 1
  • scripts/sync-android-docs.js

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Walkthrough

The Android documentation sync script scans versioned documentation for image references and preserves matching images during stale-image pruning. It removes query strings and fragments before matching image filenames.

Changes: Android image retention

Layer / File(s) Summary
Collect references and prune stale images
scripts/sync-android-docs.js
The script collects Android image basenames referenced by .md and .mdx files under versioned_docs. Stale destination images with matching basenames are retained; other stale images continue through the existing pruning behavior.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to f4b8b

The change is ready to merge after normal checks; no remaining screenshot-retention defect was established.

Pre-merge checks: Passed 7 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Regression Coverage For Changed Behavior Warning Missing regression coverage for the changed docs-sync behavior. main() now calls collectVersionedImageReferences() before pruneStale(), and collectImageReferences() now removes query strings a… Add an integration test that runs scripts/sync-android-docs.js in a temporary fixture. Put stale images in static/img/android/docs/, reference one from nested versioned_docs/*.md and another from nested versioned_docs/*.mdx, includi…
Passed Passed checks: 7 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title accurately describes the main change: preserving screenshots that versioned documentation still links. It is concise and specific, although the wording is slightly awkward.
Linked Issues check Passed Issue #7695 requires sync-android-docs.js to retain images linked by versioned_docs/. The change recursively reads .md and .mdx files under versioned_docs, collects /img/android/docs/ refe…
Out of Scope Changes check Passed The changes are limited to the sync script. The added versioned-document scan, URL normalization, retention logic, logging, and comments directly support issue #7695. No unrelated product or applicati…
Sibling Call Sites And Presence Semantics Passed PASS: The pull request changes only scripts/sync-android-docs.js. It adds versioned-document image retention and strips query strings/fragments from image paths. It does not change nullable fields, …
Tests Prove The Path, Not The End State Passed No tests were added or changed in the pull request. The only changed file is scripts/sync-android-docs.js, so the custom test-quality failure conditions do not apply.
Moved Code Diffed Against Its Original Passed The check is not applicable. The PR changes one existing JavaScript file in place; it does not delete and recreate a function or type, extract code into another module, or move a declaration. The diff…
Full details: Linked Issues check

Explanation

Issue #7695 requires sync-android-docs.js to retain images linked by versioned_docs/. The change recursively reads .md and .mdx files under versioned_docs, collects /img/android/docs/ references, strips query strings and fragments, and passes the protected names to pruneStale. Current-page image handling remains separate. The implementation also logs each retained image.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the sync script. The added versioned-document scan, URL normalization, retention logic, logging, and comments directly support issue #7695. No unrelated product or application behavior changes are present.

Full details: Sibling Call Sites And Presence Semantics

Explanation

PASS: The pull request changes only scripts/sync-android-docs.js. It adds versioned-document image retention and strips query strings/fragments from image paths. It does not change nullable fields, zero guards, presence checks, or numeric field defaults. No NodeItem, NodeItemCompact, RSSI, temperature, current, voltage, particulate, humidity, or SNR call-site update is required.

Full details: Moved Code Diffed Against Its Original

Explanation

The check is not applicable. The PR changes one existing JavaScript file in place; it does not delete and recreate a function or type, extract code into another module, or move a declaration. The diff adds collectVersionedImageReferences, changes collectImageReferences and pruneStale in their original locations, and updates the single pruneStale caller. No moved-code contract needs comparison.

Full details: Regression Coverage For Changed Behavior

Explanation

Missing regression coverage for the changed docs-sync behavior. main() now calls collectVersionedImageReferences() before pruneStale(), and collectImageReferences() now removes query strings and fragments. The observable surface is the generated static/img/android/docs/ assets consumed by the Docusaurus versioned_docs/ build; no Android runtime surface is involved. The diff changes only scripts/sync-android-docs.js and adds no test or test invocation. A versioned image can still be deleted, or a linked image with a query or fragment can be missed, without a test detecting it.

Resolution

Add an integration test that runs scripts/sync-android-docs.js in a temporary fixture. Put stale images in static/img/android/docs/, reference one from nested versioned_docs/*.md and another from nested versioned_docs/*.mdx, including query-string or fragment suffixes, and assert both remain. Add an unreferenced stale image and assert it is removed. The test must fail against the base script.

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: meshtastic/Meshtastic-Android/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 17432aba-283f-4673-9360-6275e83fa460
📥 Commits

Reviewing files that changed from the base of the PR and between b203dc7 and 34de90f.

📒 Files selected for processing: 1
  • scripts/sync-android-docs.js

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread scripts/sync-android-docs.js
A link such as /img/android/docs/old.webp?v=2 was recorded as old.webp?v=2, so it never matched the file and the image was pruned anyway. Strip any ?query or #fragment before taking the basename.
@jamesarich
jamesarich enabled auto-merge October 20, 2026 21:56
@jamesarich
jamesarich added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 2a41b35 Oct 20, 2026
7 checks passed
@jamesarich
jamesarich deleted the fix/docs-sync-keep-versioned-images branch October 20, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Docs sync deletes screenshots that versioned docs still link

2 participants