Skip to content

feat(bulk-edit): add No cache & Skip asset check to mass edit; restore nocache in viewer - #3150

Merged
vpetersson merged 3 commits into
masterfrom
worktree-cryptic-kindling-hinton
Jul 8, 2026
Merged

feat(bulk-edit): add No cache & Skip asset check to mass edit; restore nocache in viewer#3150
vpetersson merged 3 commits into
masterfrom
worktree-cryptic-kindling-hinton

Conversation

@vpetersson

@vpetersson vpetersson commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Issues Fixed

Fixes #3137

Description

Adds the No cache and Skip asset check flags to the mass-edit ("Edit N assets") modal, so operators can set or clear them across a whole selection instead of one asset at a time. Each flag is opt-in via the existing per-group toggle (unticked groups are left untouched) and picks its target state with an On/Off segmented control — visually distinct from the group's opt-in switch and consistent with the modal's existing pill styling.

While wiring this up I found nocache was a no-op in the current viewer stack — it was silently dropped in the Uzbl→webview migration. Since there is no point exposing a dead flag, this PR also restores it:

  • view_webpage now cache-busts the URL for nocache assets (namespaced _anthias_nc token appended to the raw query string, so signed / pre-encoded URLs are preserved byte-for-byte), so the page is refetched fresh instead of being served from QtWebEngine's in-memory HTTP cache or skipped by the unchanged-URL short-circuit.
  • asset_loop passes the asset's nocache flag through to view_webpage.
  • assets_bulk_update writes both boolean flags as opt-in shared fields.

skip_asset_check was already honoured by the viewer, so it needed only the UI/endpoint wiring.

Validation

Unit: 279 tests pass (10 new: bulk-edit endpoint + viewer cache-busting/dispatch/byte-preservation); ruff check and ruff format --check clean.

End-to-end on a real x86 device (overlaid the changed source onto the running latest-x86 stack, real Qt6 QtWebEngine viewer, pointed webpage assets at a logging HTTP server that returns Cache-Control: max-age=3600):

  • Bulk edit — drove the real web UI in a browser: selected assets → opened the modal → No cache = On → Apply → toast "2 assets updated", and the device DB flipped both rows to nocache=1.

  • Viewer, single looping asset (8s), watched 45s:

    nocache Network fetches Behaviour
    OFF 1 Loads once, never refetches (stale — the bug)
    ON 6 Fresh fetch every rotation, distinct _anthias_nc token each time

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

…viewer

Adds the No cache and Skip asset check flags to the mass-edit modal so
operators can set/clear them across a selection instead of one asset at
a time (#3137). Each is opt-in via the existing per-group toggle and
picks its target state with an On/Off segmented control.

While wiring this up, fixed nocache being a no-op in the current viewer
stack (silently dropped in the Uzbl->webview migration):

- view_webpage now cache-busts the URL for nocache assets, so the page
  is refetched fresh instead of served from QtWebEngine's HTTP cache or
  skipped by the unchanged-URL short-circuit (restores refs #11)
- asset_loop passes the asset's nocache flag through
- assets_bulk_update writes both boolean flags as opt-in shared fields

Verified nocache end-to-end against a real QtWebEngine webview: an
identical URL is served from cache (1 fetch for 2 loads) while
cache-busted URLs refetch every display (2 for 2).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@vpetersson
vpetersson requested a review from a team as a code owner July 8, 2026 08:46
@vpetersson vpetersson self-assigned this Jul 8, 2026
@vpetersson
vpetersson requested a review from Copilot July 8, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds bulk-edit support for No cache and Skip asset check flags, and restores the viewer’s nocache behavior for webpage assets by cache-busting the URL on each display rotation.

Changes:

  • Extend the bulk-edit modal UI to opt-in/apply nocache and skip_asset_check with an On/Off segmented control per flag.
  • Update assets_bulk_update to conditionally write the two boolean flags across the selected asset set.
  • Restore viewer nocache support by passing the flag through asset_loop and cache-busting webpage URLs; add unit tests for both viewer and bulk-edit behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_viewer.py Adds unit coverage for webpage nocache cache-busting and flag propagation from asset_loop.
tests/test_template_views.py Adds Django tests for bulk-updating nocache / skip_asset_check (set, clear, untouched, toast count).
src/anthias_viewer/init.py Implements cache-busted URL generation and threads nocache into view_webpage / asset_loop.
src/anthias_server/app/views.py Extends assets_bulk_update to include opt-in updates for nocache and skip_asset_check.
src/anthias_server/app/templates/_bulk_edit_modal.html Adds bulk-edit groups and controls for the two boolean flags; updates submit enablement logic.
src/anthias_server/app/static/sass/_styles.scss Adds pill styling for the new On/Off segmented controls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/anthias_viewer/__init__.py Outdated
Comment thread src/anthias_server/app/views.py Outdated
- _cache_busted_url appends to the raw query string instead of
  parse_qsl/urlencode round-tripping it, so signed / pre-encoded URLs
  reach the origin byte-for-byte (add regression test)
- correct the assets_bulk_update comment to describe the On/Off radio,
  not the old hidden-checkbox flow

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread tests/test_template_views.py Outdated
Copilot re-review: the bulk-edit flag value is an On/Off segmented
radio, not a switch — align the new test docstrings.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@vpetersson

Copy link
Copy Markdown
Contributor Author

End-to-end tested on a real x86 device ✅

Overlaid the changed source onto a running latest-x86 stack (real Qt6 QtWebEngine viewer) and pointed webpage assets at a logging HTTP server sending Cache-Control: public, max-age=3600.

Bulk edit (real browser → device server): selected 2 assets, opened the modal, set No cache = On, Apply → toast 2 assets updated; device DB confirmed nocache=1 on both.

Viewer nocache (single looping webpage asset, 8s duration, 45s window):

  • nocache OFF → server saw the URL fetched once — the unchanged-URL short-circuit skips every later rotation, so content goes stale (the bug).
  • nocache ON → server saw a fresh fetch every rotation (~8s apart), each with a distinct _anthias_nc token:
HIT 18: /nocache?_anthias_nc=1783505509407
HIT 19: /nocache?_anthias_nc=1783505517414
HIT 20: /nocache?_anthias_nc=1783505525425
HIT 21: /nocache?_anthias_nc=1783505533436
HIT 22: /nocache?_anthias_nc=1783505541446
HIT 23: /nocache?_anthias_nc=1783505549455

Checked the x86 device box. I did not run on a Raspberry Pi, so that box is left unchecked — the viewer change is pure Python and board-agnostic (same Qt cache behaviour across boards), but I only exercised the full stack on x86.

@vpetersson
vpetersson merged commit cd30eb1 into master Jul 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Anthias Website / Viewer - allow mass edit of No Cache and Skip Asset Check

2 participants