Give both summaries a modified time, and the dashboard list a footprint

Home's "recently modified" order was a proxy — drafts first, then the
version counter, then the name. Both summaries now carry `updated_at`,
read as the mtime of the working copy: every write in the store commits
immediately, so a file's mtime is its commit time, and `git log -1 --
<path>` costs ~990ms across this instance's 15 documents (it walks the
history back to the last commit touching each one, so it is slowest for
the stalest) against ~1.8ms for the stats. No cache needed.

`DashboardSummary` also carries `footprint`: each widget as its type plus
the placement a panel resolves, which is the whole of what the mosaic
draws. That drops the document fetch per tile and with it the cap of
eight, past which tiles showed a name and nothing else. Verified against
this instance's 8 dashboards: the blocks are identical to what the old
client-side derivation produced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CL9zvnnvcp1mvA8o7impxk
This commit is contained in:
2026-09-06 15:26:48 +02:00
co-authored by Claude Opus 5
parent 8cb843eb25
commit ff612623a1
9 changed files with 271 additions and 86 deletions
+20
View File
@@ -1,4 +1,6 @@
import os
import subprocess
from datetime import UTC, datetime
from pathlib import Path
import pytest
@@ -56,6 +58,24 @@ def test_saving_unchanged_content_does_nothing(store: FlowStore):
assert commit_count(store) == commits
def test_a_flow_is_modified_when_only_its_node_code_is(store: FlowStore):
"""Node code is saved without touching the flow document."""
store.write_flow(a_flow())
# Backdated so the answer can only have come from the node file.
os.utime(store.root / "heating" / "flow.json", (0, 0))
store.write_node_source(
"heating", "sensor", "def process():\n return {'a': 1}\n"
)
updated = store.updated_at("heating")
assert updated is not None and updated > datetime.fromtimestamp(0, UTC)
def test_a_flow_that_is_not_there_has_no_modified_time(store: FlowStore):
assert store.updated_at("nope") is None
def test_missing_flow_is_reported(store: FlowStore):
with pytest.raises(FlowNotFound):
store.read_flow("nope")