feat(web): pure sharing-policy mapping, and a CI path for frontend logic #353
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "web-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #352, which left four bare
!translating between negative storage and positive UI with nothing checking them.The actual finding
The gap was bigger than four characters. CI never read the frontend at all — no node, no test target, no syntax check.
web/contains onlystatic/. So a syntax error in a 7000-line inline script, or a flipped toggle, reached production unchallenged. The inversion was simply the first place it was going to bite.What was considered
package.jsonandnode_modulesin a repo that deliberately has neither, plus a network dependency on every CI run.What was built
index.htmlgains a marked, DOM-free block:Load and save both route through it, and the splice asserted that no bare inversion survives outside the block — otherwise the tested copy and the running copy drift apart, which would be worse than no test.
web/test/sharing-policy.test.jslifts that block out and exercises it. No runner, no dependencies, nopackage.json: the single-file frontend stays single-file. Six cases, including the two that encode the reasoning rather than the behaviour — absent keys must read as both features enabled (the upgrade-safety claim, now pinned on the frontend too), and turning both switches off must store explicittruerather thanundefined.CI gains a Web checks step: extract the inline scripts,
node --checkthem, run the suite.Verified by mutation
A guard nobody has watched fail is not a guard. The build flips
publicLinks: !st.shareLinksDisabledto!!in a scratch copy and requires the suite to fail:Note
node --checknow covers the whole inline script, so this also closes a gap that had nothing to do with sharing.web/test/is the place for the next piece of frontend logic that deserves a test, rather than a one-off guard for this one.