fix(#571): the internal-sharing switch never reached the admin page #580

Merged
Cordy merged 7 commits from fix-571b2 into main 2026-09-17 20:30:08 +00:00
Owner

#578 added the switch and it rendered on no page at all. Caught by Nikola's screenshot of the live admin page, not by anything in CI — which is the part worth fixing.

Why it was invisible. Every setting lives once, in the hidden #settingsdlg. ensureSettingsInShell() then moves each field listed in SET_SLOTS into its admin slot:

for (const [id, slot] of SET_SLOTS) { const e = $(id), s = $(slot); if (e && s) s.appendChild(e); }

A field that is not in SET_SLOTS is never moved, and the dialog is not reachable from the admin shell. The markup looks perfect the whole time. Two further consequences I had also got wrong:

  • Order on screen is SET_SLOTS order, not DOM order — so placing the markup under Public share links achieved nothing.
  • Descriptions come from SET_DESC, a field-id → i18n-key map, rendered as .sdesc. My inline <p class="hint"> inside a subfield span was the wrong shape for this row; it is now a plain .field.check identical to its neighbours, with the description supplied the house way.

The guard. web/test/settings-slots.test.js asserts three invariants, all of which are invisible when broken:

  1. every set-f-* field in the markup is in SET_SLOTS — a field nobody slotted is a field nobody can see;
  2. every SET_DESC value is a defined i18n key. index.html already documents this hole — "t(SET_DESC[id]) is a dynamic lookup, so the undefined-key test cannot see these — a typo here shows up as a verbatim key in the UI, not as a failure" — and now something checks it;
  3. every described field is also slotted.

It immediately found a second, pre-existing orphan: set-f-trashwarn. That field has been in the dialog and on no admin page. I have not touched it — I do not know whether it was missed when the dialog was broken into admin pages or is deliberately not offered, and those have different fixes. It is allow-listed with a comment pointing at #579.

Red witnessed: these fields exist in #settingsdlg but are never moved into the admin shell, so they render nowhere: set-f-internalshare, set-f-trashwarn.

Process note. Three times this session a run has been lost to retyping whitespace instead of reading it — gofmt comment alignment, a struct field, and here an anchor written with four spaces where the file has two. Every splice in this workflow now either matches on a substring with no leading whitespace, or derives the indent from the line it matched.

Verified: new test green, all nine web tests green, extract.js + node --check (#389 fence gate) green, the \\u escape guard green, full Go suite green.

#578 added the switch and it rendered on **no page at all**. Caught by Nikola's screenshot of the live admin page, not by anything in CI — which is the part worth fixing. **Why it was invisible.** Every setting lives once, in the hidden `#settingsdlg`. `ensureSettingsInShell()` then *moves* each field listed in `SET_SLOTS` into its admin slot: ```js for (const [id, slot] of SET_SLOTS) { const e = $(id), s = $(slot); if (e && s) s.appendChild(e); } ``` A field that is not in `SET_SLOTS` is never moved, and the dialog is not reachable from the admin shell. The markup looks perfect the whole time. Two further consequences I had also got wrong: - **Order on screen is `SET_SLOTS` order, not DOM order** — so placing the markup under Public share links achieved nothing. - **Descriptions come from `SET_DESC`**, a field-id → i18n-key map, rendered as `.sdesc`. My inline `<p class="hint">` inside a `subfield` span was the wrong shape for this row; it is now a plain `.field.check` identical to its neighbours, with the description supplied the house way. **The guard.** `web/test/settings-slots.test.js` asserts three invariants, all of which are invisible when broken: 1. every `set-f-*` field in the markup is in `SET_SLOTS` — a field nobody slotted is a field nobody can see; 2. every `SET_DESC` value is a defined i18n key. index.html already documents this hole — *"t(SET_DESC[id]) is a dynamic lookup, so the undefined-key test cannot see these — a typo here shows up as a verbatim key in the UI, not as a failure"* — and now something checks it; 3. every described field is also slotted. **It immediately found a second, pre-existing orphan: `set-f-trashwarn`.** That field has been in the dialog and on no admin page. I have not touched it — I do not know whether it was missed when the dialog was broken into admin pages or is deliberately not offered, and those have different fixes. It is allow-listed with a comment pointing at **#579**. Red witnessed: `these fields exist in #settingsdlg but are never moved into the admin shell, so they render nowhere: set-f-internalshare, set-f-trashwarn`. **Process note.** Three times this session a run has been lost to retyping whitespace instead of reading it — gofmt comment alignment, a struct field, and here an anchor written with four spaces where the file has two. Every splice in this workflow now either matches on a substring with no leading whitespace, or derives the indent from the line it matched. Verified: new test green, all nine web tests green, `extract.js` + `node --check` (#389 fence gate) green, the `\\u` escape guard green, full Go suite green.
Cordy merged commit 31ba232dd8 into main 2026-09-17 20:30:08 +00:00
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: Cordy/Cairn#580
No description provided.