fix(poi): flatten poi list --json to match markers --json #7

Merged
hugooconnor merged 0 commits from refs/pull/7/head into main 2026-06-21 13:32:58 +00:00
hugooconnor commented 2026-06-21 13:13:34 +00:00 (Migrated from codeberg.org)

Bug

ar-edit poi list --json emitted a confusingly double-nested shape:

{ "pois": [ { "source_id": "src-001", "pois": [ {…poi…} ] } ] }

The outer key pois actually held per-source SourcePois groups, each of which re-used the key pois, so a consumer had to traverse pois[i].pois[j] to reach a POI.

Fix

Emit a flat list, tagging each POI with its source_id:

{ "pois": [ { "id": "poi-001", "category": "highlight", "source_id": "src-001",  } ] }

This mirrors markers --json (flat list, source_id per item) so the two CRDT-annotation commands stay consistent for scripting. The per-item source_id also disambiguates the per-source poi-NNN id namespace (e.g. two sources can each have poi-001).

Test

test_063_marker_annotations updated to assert the flat shape (pois[0].id, pois[0].source_id). Verified end-to-end with two sources; full ar-edit crate suite (127 tests) and fmt pass.

🤖 Generated with Claude Code

## Bug `ar-edit poi list --json` emitted a confusingly double-nested shape: ```json { "pois": [ { "source_id": "src-001", "pois": [ {…poi…} ] } ] } ``` The outer key `pois` actually held per-source `SourcePois` *groups*, each of which re-used the key `pois`, so a consumer had to traverse `pois[i].pois[j]` to reach a POI. ## Fix Emit a flat list, tagging each POI with its `source_id`: ```json { "pois": [ { "id": "poi-001", "category": "highlight", "source_id": "src-001", … } ] } ``` This mirrors `markers --json` (flat list, `source_id` per item) so the two CRDT-annotation commands stay consistent for scripting. The per-item `source_id` also disambiguates the per-source `poi-NNN` id namespace (e.g. two sources can each have `poi-001`). ## Test `test_063_marker_annotations` updated to assert the flat shape (`pois[0].id`, `pois[0].source_id`). Verified end-to-end with two sources; full `ar-edit` crate suite (127 tests) and fmt pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
anuna-research/ar-edit!7
No description provided.