oliver-zehentleitner / maity
web+hub: the Why view merges the Keep the Why children into the graph (project setting, default on)
tsk-13scv14k4yg4 Review
Owner decision (req-y1zb7awnyjmd, 2026-11-12): a switch in the project settings, default on.
Today the hub already reads the whole family (root plus children, keep-the-why:children, docs/api.md §11.3), and GET …/keep-the-why returns members. The web Why view (web/js/ktw-host.js, exportState) loads only the root export, so entries from hub/, cli/ and web/ are missing from the graph, the lists and the counts.
Goal:
- With the switch on, the Why view shows the entries of every member that loaded, in one graph, with links between members kept. Each entry shows which member it comes from.
- A member with an error (as
members[].errorreports it) does not break the view. The view says which members are missing and why. - With the switch off, the view behaves as today (root only).
- The switch is a project setting, default on for existing and new projects. Contract first: docs/api.md (setting, default, who may change it) and the §16.11 lists in the same PR as the hub change.
Order (one PR each, review via vuur):
- Contract (docs/api.md).
- Hub: the setting, migration (revision id ≤ 32 chars; ask vuur for a migration slot first), guard tests (per_human_tables, web shapes, web check).
- Web: settings checkbox and the merged graph. Docs in docs/humans.md in the same PR.
Out of scope here: children in other repositories. Today the hub follows only relative directories below the file that lists them; anything else shows location_not_followed. That needs its own design and card.
Check first: does the vendored Keep the Why views library accept a merged export, or does it need one state per member? Post the finding as a note before PR 1.
Notes
An agent · Nov 12, 2026, 15:25 UTC
Step 0 finding (library check), worktree head `2112575a2`, vendored KTW dashboard 0.11.45
Short answer: the library already accepts one merged family state. The host has to build it.
ktw-core.js:553-584mergeStates(groups)(exported at:1181) turns[{member, state}](self first) into one state withmerged: trueandfamily: [...]. A member's topic files and entry ids get its name as prefix (hub/stack.md#…). Each topic and entry carriesproject(null for self),origin(its group),localIdandlocalFile. Authors and findings are summed.- The views read a merged state:
ktw-pages.js:159-160shows the overview's family banner with counts per member,:344links to an entry's own repository viaorigin,:421shows the member on the entry's details, andktw-timeline.js:546prefixes lanes withproject. - The graph has no member layer of its own:
ktw-graph.js:352-376assemble(topics, entries)keys nodes ast:<file>ande:<id>, so it works on the merged lists as they are. See and Superseded-by links resolve byuuid(:365throughktw-core.js:503-534linkFamily), so links between members are kept. - The host today:
web/js/ktw-host.js:166-180exportStateand:277-303makeHostbuild the scene and graph from the root export alone (:294,:302-303).T.findEntry(:327-329) searchesx.state.entriesonly. The family module (ktw-family.js:79-123publicTree/publicTreeFrom, host modeexport) already walksproject.childrenthroughexportState(canonical, root). It returns{groups, missing:[{member, reason}]}(:124), but only search and the family page use it.
Node probe (
vmloading core, ui, scene and graph from the worktree; script kept at/workspace/ktw-probe/probe.mjson my box):- Root and
hubboth havestack.md#use-postgres(a collision before the merge). AftermergeStatesthe ids arestack.md#use-postgresandhub/stack.md#use-postgres, and the topics arestack.mdandhub/stack.md. assembleon the merged lists gives the edgese:stack.md#use-postgres -see-> e:hub/stack.md#use-postgresandt:stack.md -xtopic-> t:hub/stack.md, so the cross-member link is kept.- Caveat 1: when two members carry the same
uuid,linkFamily'sbyUuidkeeps the last one silently. The See resolved toweb/…. - Caveat 2:
mergeStatescopies the entries. Bodies filled into a member state after the merge do not reach the copies (the member has"late body", the merged copy""). The bodies must be loaded before merging, asktw-family.js:82does. - Caveat 3: two members with the same
member.nameget the same prefix, and their ids collide (hub/stack.md#use-postgrestwice).
What the web PR needs (no library change):
- With the setting on, get groups from
family.pool()/publicTree()(or fromGET …/keep-the-whymembers[].pathandexportState("", path)). Awaitfamily.bodies()per group, thenK.core.mergeStates, then pass the result toscene.create({state: merged, self: rootState, scope: "family"}). Graph, lists and counts then follow. - Prefix with a unique member key: the hub's
members[].path(unique,""for the root) ornameplus de-dup, not the freename. - List
missingandmembers[].errorreasons in the view, beside the banner. A failed member is simply not ingroups. - Have
findEntryand entry routes look upmerged.entriesbyuuid. A uuid that repeats across members is ambiguous: first wins, and the view flags it. - With the setting off, keep today's path (root only).
The hub reads need nothing new: §11.3 and §11.5 already serve every member export (
?root=<path>). PR 2 is the setting only.Maity Test Team · Nov 21, 2026, 11:08 UTC
Tester result (maity-test-team), hub part only (#1698 contract, #1705 hub), deployed hub, main b6d523e6b. PASS.
GET /projects/oliver-zehentleitner/maityshowssettings.why_merge_children: true. The project never set the key, so this is the default (§6.1).- PATCH as an agent (me, member tester),
{"settings":{"why_merge_children":true}}→ 403forbidden, reasonhumans_only("whether the Why view merges the children is set by a human"). - The same with
null→ 403humans_only. - The same with
"yes"→invalid,settings.why_merge_children: not_a_boolean. Body validation runs before the agent refusal. That's fine, since nothing is written either way. - After the calls, GET still reads
true: nothing changed. hub/tests/test_why_merge_children.pyon main: 15 passed (local, uv, SQLite).
Not tested: setting it as a human admin (
false, andnullrestoring the default), and theproject_updatedevent. I can't do that as an agent. Also not tested: the web part (3 of 3), which isn't merged yet, so the dashboard doesn't read the key (as docs/api.md §6.1 says).Maity Test Team · Nov 28, 2026, 14:14 UTC
Test (maity-test-team): hub side passes; the web side (PR 3 of 3) is not on main yet, so the card's goal is not testable end to end.
Hub part: #1705, merged as f142618d0c99567ee7c1bd8eead363449fc744be (contract #1698, fe5f84ac1). Both are ancestors of the 0.1.0a12 release commit 6adc6c8cddcfad3936f3198c02b2b636029ead8e. Prod
GET /health: version0.1.0a12, revision/head20261124170513_org_link_check.Live read-only (GET only, no writes on prod):
GET /projects/oliver-zehentleitner/maity:settings.why_merge_childrenistrueon this existing project, which never stored the key. That matches "a missing key reads as true, GET shows it".GET …/keep-the-why:memberslists root,hub,cliandweb, each witherror: null. That is the family the merged view would load.
Local, at 6adc6c8 (worktree,
uv run --python 3.12 --extra dev pytest tests/test_why_merge_children.py): 15 passed in 22.7 s. That covers the default, false stored / null restores it, announcements only on an effective change, no rules_version bump,not_a_booleanfor non-booleans,humans_onlyfor agents, and human admins only. I did not repeat these writes on prod.Not testable yet:
- Web (PR 3: settings checkbox, merged graph, per-member origin, missing-member text, docs/humans.md).
git grep why_merge_children origin/main -- web/js docs/humans.mdfinds nothing at 520e84d64, and docs/api.md §11.5 "The family in one view" is still marked Not built. No open or merged PR for PR 3 turned up when I searched for the card id.
No bug filed: what is built behaves to the contract. The card should stay in review (or go back to in progress) until PR 3 lands.