Repository navigation
fix(export): prefix CSV data keys that collide with id/timestamp/duration - #795
Conversation
…tion A data key named id, timestamp or duration produced a duplicate header name. Prefix such keys with "data." (repeated until unique) so every column name is distinct; values are still read by the original key. Git-Session-Id: 838c
|
Git-Session-Id: 76980a96-158b-5a96-a469-b2279ea3a5ba
|
@greptileai review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #795 +/- ##
===========================================
+ Coverage 70.81% 83.96% +13.14%
===========================================
Files 51 82 +31
Lines 2916 10806 +7890
===========================================
+ Hits 2065 9073 +7008
- Misses 851 1733 +882 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
🤖 AI code reviewAdds Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No thread-worthy findings. Advisory notes follow; they are retained without opening review threads. 1 advisory finding (summary-only, not scored)These P2 guard, heuristic, trade-off, or documentation claims are retained for judgment without opening review threads.
This is a How this was verified: static preflight: fix-commit + touched-files scan (rule 7) Files changed (1) — the diff as I read it
Reviewed Maintainer commands
|
…tion A data key named id, timestamp or duration produced a duplicate header name. Prefix such keys with "data." (repeated until unique), matching ActivityWatch/aw-server-rust#795. Values are still read by the original key. Git-Session-Id: 838c
…tion A data key named id, timestamp or duration produced a duplicate header name. Prefix such keys with "data." (repeated until unique), matching ActivityWatch/aw-server-rust#795. Values are still read by the original key. Git-Session-Id: 838c
The bucket CSV export (#722) writes
id,timestamp,durationfollowed by the union of event data keys. A data key namedid,timestampordurationproduced a duplicate header name, so the columns were unambiguous by position but not by name. Greptile flagged this on ActivityWatch/aw-server#178.Fix: a data key that would repeat an earlier header name gets a
data.prefix, repeated until unique (duration→data.duration; data keys arrive sorted, so a literaldata.idkey keepsdata.idand theidkey becomesdata.data.id). Only the header changes; values are still read by the original key. Keys that don't collide are unchanged, and the >32-key singledataJSON column is unaffected.A matching aw-server (Python) PR follows so both servers emit the same header.
Tests: new
csv_header_prefixes_data_keys_that_collide_with_columns(header) andstreamed_csv_prefixed_columns_carry_original_key_values(full export, header↔row);cargo test -p aw-datastore --lib export16 passed, theaw-serverCSV API test passes, fmt and clippy clean.