feat(plugins): reconcile missed shot uploads - #645
Conversation
|
P1 — a failed machine snapshot can persist stale machine identity. In lib/src/controllers/de1_state_manager.dart around 602–617, the code reads the currently connected DE1 and replaces baseWorkflow.machine only when that read succeeds. On failure it persists baseWorkflow unchanged. But Workflow.machine can now contain serialNumber loaded through Workflow.fromJson, and /api/v1/workflow accepts that structure into the current workflow. The reconciler then treats any workflow.machine.serialNumber as trustworthy capture-time provenance. |
|
@ODevStudio please rebase on main and verify there is still anything useful to pull out from this PR. |
…econciliation # Conflicts: # assets/plugins/shot-upload.reaplugin/manifest.json # assets/plugins/shot-upload.reaplugin/plugin.js # test/plugins/shot_upload_plugin_test.dart
Summary
What changed, and why?
shot starts, explicitly clearing stale identity if capture fails, so later
uploads never use the wrong machine.
Durable success and rejection annotations let restarts resume without
repeatedly submitting completed or permanently invalid records.
later pass. Pause as soon as brewing starts or automatic upload is disabled.
ahead of the remaining historical backlog.
Change Type (select all)
Scope (select all touched areas)
Linked Issues
Fixes #603
Root Cause (if bug fix)
N/A - this adds bounded reconciliation for uploads missed while the bundled
uploader was unavailable.
Regression Test Plan (if bug fix or refactor)
N/A - feature coverage locks in capture-time identity, candidate filtering,
pagination, cancellation before every retry, durable rejection, and transient retry in
test/plugins/shot_upload_reconciliation_test.dartand related shot tests.Documentation Obligations (required)
assets/api/rest_v1.ymlorassets/api/websocket_v1.yml(if REST/WebSocket changed)doc/Api.md(if user-facing endpoint changed)doc/Plugins.md(if events/API changed)doc/Skins.md(if skin behavior changed)doc/Profiles.md(if profile handling changed)doc/DeviceManagement.md(if device flows changed)Security Impact (required)
Yes; existing shot workflow JSON gainsoptional capture-time machine provenance.
No.Yes; the opt-in bundled uploader can replay abounded backlog through its existing authenticated endpoint.
No.No; existing local shot storage is reused.Yes; the bundled uploader declares theexisting
events.machinepermission needed to pause reconciliation safely.outside idle/sleep states, is bounded and paginated, persists terminal
outcomes, and reuses the backend's idempotent machine/shot key.
User-Visible Changes
for another shot.
being attributed to the currently connected machine.
Verification
Local gates (run before pushing)
dart format lib test- no remaining candidate changesflutter analyze- cleanflutter test- 3,218 passed, 1 skipped; 1 existing Windows CRLF assertion./scripts/fetch_dye2_plugin.sh- not rerun for this local draftManual verification (if applicable)
simulate=1):Yes; used for the Android tablet UI smoke check.No; the physical Android tablet was used without coffee hardware.retry classification, persistence, and pause behavior through focused tests.
transport failures, brewing mid-batch, disabled upload, and missing identity.
Evidence
Detailed evidence:
filtering, exact pagination progress, active and unavailable machine states,
disabling reconciliation mid-batch or during retry backoff, brewing during retry backoff, permanent rejection, and retry after transient or authorization failures.
flutter test --no-pub test/models/workflow_context_test.dart test/controllers/de1_state_manager_shot_state_test.dart test/plugins/bundled_plugin_permissions_test.dart test/plugins/shot_upload_plugin_test.dart test/plugins/shot_upload_reconciliation_test.dart(66 passed)flutter analyze --no-pub(no issues)flutter test --no-pubwith the package-matched QuickJS DLL onPATH(3,186 passed, 1 skipped)
git diff --cached --checkbefore commit (clean)<machine serial>/<shot id>, so areplay after a lost response targets the same stored shot rather than minting
a duplicate. This was confirmed from the maintainer discussion on PR Add shot-upload plugin + enable plugin Decent-proxy writes #565.
flutter run --no-pub -d windows --dart-define=simulate=1. Thelocal build stopped before launch because Flutter selected CMake 3.20 while
the Firebase SDK requires CMake 3.22 or newer. No production-backend or real
machine smoke test was run.
Compatibility & Migration
Yes; machine provenance fields are optional andexisting shot records remain valid.
No.No; annotations and existing JSON storage arereused.
Risks & Mitigations
<machine serial>/<shot id>key,bounded batches, durable outcomes, and immediate machine-state checks.
legacy records local.
Contributor Responsibility
AI-assisted development is allowed. The submitter remains responsible for the submitted work.