garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

cartopolis-agent · 2026-11-30T19:15:11Z

test(app): capture the data layers against a stand-in host

--ui feeds turns every published data layer on once the index is in,
--ui feedcard opens the card of the dot nearest the middle, and with
layers and datalayers the panel opens on the Data tab. The feeds count
as a stream the settle test waits for. An ignored atlas test,
live_stand_in, writes three real TripleXL layers as atlas publishes them
into $FEEDS_SITE; the note says how to serve and capture them.
crates/cartopolis/src/systems/dev/shot_harness.rs | 11 +++++++++
 crates/cartopolis/src/systems/gui/plugin.rs       |  1 +
 docs/notes/data-layers.md                         | 27 ++++++++++++++++-------
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/crates/cartopolis/src/systems/dev/shot_harness.rs b/crates/cartopolis/src/systems/dev/shot_harness.rs
index f0887720..f2aee3f5 100644
--- a/crates/cartopolis/src/systems/dev/shot_harness.rs
+++ b/crates/cartopolis/src/systems/dev/shot_harness.rs
@@ -2419,6 +2419,8 @@ pub struct ScriptedCards<'w, 's> {
     context_menu: ResMut<'w, crate::resources::ContextMenuState>,
     /// The Plans layer's card, for `--ui plansnotice`.
     plans: ResMut<'w, crate::systems::plans::Plans>,
+    /// Layers ▸ Data, for `--ui feeds` and `--ui feedcard`.
+    feeds: ResMut<'w, crate::systems::feeds::Feeds>,
     /// Nested rather than added beside: the ceiling this type exists to work
     /// around is a *parameter* count, so a second bundle would hit it again.
     #[cfg(feature = "comms")]
@@ -2542,6 +2544,11 @@ const UI_ELEMENTS: &[&str] = &[
     "planshere",
     // The card of the notice nearest the shot's point that names council business.
     "plansnotice",
+    // Layers ▸ Data opened (with `layers`), every data layer on, and the card
+    // of the dot nearest the middle (`systems::feeds`).
+    "datalayers",
+    "feeds",
+    "feedcard",
     // The shot's point followed for new plans, every notice near it news.
     "plansnews",
     "places",
@@ -2785,6 +2792,10 @@ pub fn open_scripted_ui(
     if want("planshere") {
         cards.context_menu.plans_here = harness.shots.get(progress.index).map(|s| (s.lat, s.lng));
     }
+    // `--ui feeds`: every published data layer on, once the index is read;
+    // `--ui feedcard`: the card of the dot nearest the middle of the view.
+    cards.feeds.script_all = want("feeds") || want("feedcard");
+    cards.feeds.open_nearest = want("feedcard");
     if want("plansnotice") {
         cards.plans.open_nearest = harness.shots.get(progress.index).map(|s| (s.lat, s.lng));
     }
diff --git a/crates/cartopolis/src/systems/gui/plugin.rs b/crates/cartopolis/src/systems/gui/plugin.rs
index 253a6942..3d12a1fb 100644
--- a/crates/cartopolis/src/systems/gui/plugin.rs
+++ b/crates/cartopolis/src/systems/gui/plugin.rs
@@ -120,6 +120,7 @@ impl Plugin for GuiPlugin {
             // Layers ▸ Places ▸ Plans, and the card a dot opens (`systems::plans`).
             .init_resource::<systems::plans::Plans>()
             .init_resource::<systems::feeds::Feeds>()
+            .watch_stream::<systems::feeds::Feeds>()
             .init_resource::<systems::onscreen_keyboard::OnScreenKeyboard>()
             // What the on-screen navigation controls asked for this frame
             // (`systems::map_osd`); read by `free_camera::camera_controls`.
diff --git a/docs/notes/data-layers.md b/docs/notes/data-layers.md
index 2da1c3f1..b8029e14 100644
--- a/docs/notes/data-layers.md
+++ b/docs/notes/data-layers.md
@@ -6,8 +6,9 @@ updated: 2026-11-30
 
 # Data layers: records from outside, placed by atlas
 
-Built 2026-11-30 from `docs/mockups/data-layers/` (v1), stage 1: points from
-TripleXL's saved queries, Layers ▸ Data, the dot and its card. What the code
+Built 2026-11-30 from `docs/mockups/data-layers/` (v1): points from
+TripleXL's saved queries, followed as the source commits; Layers ▸ Data, the
+dot and its card; and Admin ▸ Data layers on cartopolis.org. What the code
 does not say:
 
 ## Why atlas fetches and the app never talks to the source
@@ -51,12 +52,22 @@ a re-run.
 - `stuwen-kaart` of Noorderzijlvest answered 1,578 rows in 0.15 s;
   `meldingen-kaart` of Hunze & Aa's 4,085.
 - It announces commits as a stream (`text/event-stream`) and as signed
-  webhooks (`/capabilities`, `changeFeed`). **Stage 1 polls** on the layer's
-  clock (6 h by default, a tenth of that after a failure); following the feed
-  is the next stage.
+  webhooks (`/capabilities`, `changeFeed`), and `GET {dataset}` answers its
+  `revision`, which moves with every commit. **atlas follows a layer by that
+  revision**: once a minute, one request per dataset, and a refresh when it
+  moved. Webhooks were not chosen because registering one needs write rights
+  on the dataset, which a reader does not have; the stream is a connection per
+  dataset to keep open for an answer one small poll gives within a minute.
 
 ## Not built yet
 
-Following the change feed; lines and areas (the WKT parser places points only,
-and counts the rest as unplaced); the Admin page (layers are kept through
-`/api/pipeline/feeds` for now); queries that ask for a value; private datasets.
+Lines and areas (the WKT parser places points only, and counts the rest as
+unplaced); queries that ask for a value; private datasets behind a token.
+
+## Looking at it without a deployed atlas
+
+`FEEDS_SITE=/tmp/site cargo test -p cartopolis_atlas live_stand_in -- --ignored`
+writes three real layers as atlas publishes them. Serve `/feeds/*` from that
+tree and the rest from the data host, point `CARTO_3DBAG_URL` at it, and
+capture with `--ui layers,datalayers,feeds` (the tab, every layer on) or
+`--ui feedcard` (the card of the dot nearest the middle).