Imported (-synced-from-) buckets are writable and unmarked; local writes to them are silently lost
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing bucket import in aw-sync and bucket handling under aw-server/src and aw-datastore/src; inspect sync_datastores and the POST events, heartbeat, and PUT paths. Done means imported buckets carry provenance and derived metadata and reject writes with 409. Rebuild and aw-webui work are separately scoped.
Written by the indexing model from the issue text.
Description
Buckets created by a sync pull are ordinary, fully writable local buckets. Nothing marks them as derived and nothing refuses writes to them.
Verified — searching the server and datastore for any notion of synced/read-only buckets returns nothing:
$ git grep -nE "synced.from|read_only|readonly|is_synced" origin/master -- aw-server/src aw-datastore/src
$
The only place -synced-from- is understood at all is inside aw-sync itself (is_synced_bucket, added by #648 to stop re-export laundering). The server that owns the data has no concept of it.
Why that is a problem
An imported bucket is a copy of another device's data. The local device is not its owner and cannot publish changes to it — sync_datastores explicitly skips -synced-from- buckets when pushing. So any local write to one is guaranteed to be either lost or permanently divergent:
- A watcher misconfigured to a peer's bucket ID, a
POST /api/0/buckets/<id>/heartbeat, a manual event insert from the web UI or a script — all succeed silently. - The written events never propagate anywhere, because the bucket is never pushed.
- They may or may not survive the next pull, depending on where the resume cursor lands relative to the inserted timestamps. Nothing detects the divergence, and nothing can repair it, because there is no "rebuild this bucket from source" operation.
- Deleting an imported bucket to recover is currently the only remedy, and it re-imports the whole history.
On my own instance this is live: nine imported buckets holding roughly 2.9M foreign events, all writable, none marked.
Fix
Make imported buckets explicitly derived:
- Mark them. Record provenance in bucket
dataat import —$aw.sync.origin_device_idand aderived: true/read_only: trueflag — rather than relying on the ID substring, which is what #649 was about. - Refuse writes to a bucket marked derived:
409 ConflictonPOST events/heartbeat/PUT, with a message saying which device owns it. A local write to a mirror is always a mistake; failing loudly is strictly better than accepting it. - Make them rebuildable. A drop-and-reimport path, so divergence and the truncation in #683 both have a remedy that is not "delete the bucket and hope".
- Consider surfacing the distinction in aw-webui's Raw Data page, which already groups by device (ActivityWatch/aw-webui#982).
(1) and (2) are small and independent of the larger question of whether the import should exist at all — a derived bucket should be read-only under any design.
Credit: found in a design review of aw-sync; the absence of any guard is verified by the grep above.
Related: #649, #648, #683, ActivityWatch/aw-webui#982.
cc @TimeToBuildBob
- Dominant language
- Rust
- Stars
- 322
- Forks
- 105
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 22
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ActivityWatch/aw-server-rust
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ActivityWatch/aw-server-rust#798 · 1 comment ·
Maintainers usually reply within 1 day
-
Allow configuring sync dir in the `aw-sync/config.toml` filePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
ActivityWatch/aw-server-rust#853 · 1 comment ·
Maintainers usually reply within 1 day
-
Correctness bugs: heartbeat cache, query cache invalidation, commit rollback statePossibly taken A pull request linked to this issue is open or already merged. Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 25/100
ActivityWatch/aw-server-rust#825 · 2 comments ·
Maintainers usually reply within 1 day
-
aw-sync: rowid upgrade bootstrap does not recover backfills lost under the old timestamp cursorOpen
Difficulty 5/5 Over a week Newbie friendliness 25/100
ActivityWatch/aw-server-rust#793 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
ActivityWatch/aw-server-rust#790 ·
Maintainers usually reply within 1 day
All issues in ActivityWatch/aw-server-rust
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
symposium-dev/symposium#530 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
topgrade-rs/topgrade#2540 ·
Maintainers usually reply within 1 day
-
Invalid JSON options for ngram and edge_ngram silently use defaultsPossibly taken @Tilendlesa claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
noemaforge/vimanam#153 ·
Maintainers usually reply within 1 day