store, web: cite the source of what they rely on (assumptions part D)

Comments only, no behaviour changed. modernc.org/sqlite v1.60.1 (the
_pragma list on every connection, busy_timeout first; extended result
codes; a deferred BEGIN; multi-statement Exec) and SQLite 3.53.4's
documentation (transactions, WAL, foreign keys, NOCASE, upsert, julianday,
partial indexes); htmx 2.0.4 src/htmx.js; the Fetch and HTML standards for
Sec-Fetch-Site, Origin, SameSite, __Host-, CSP and defer order; Go's
html/template. Comments the source contradicts are corrected - the driver
does not serialise writes (SetMaxOpenConns(1) does), htmx:load fires per
swapped element, no-store does not keep a page out of history.

Left for their own commits: D-S3 a migration two processes can both run,
D-S20 recipient case, D-B3 Origin: null under Referrer-Policy: no-referrer,
D-H5/H6/H7/H9 (audit M11, stage 4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mix
2026-10-14 19:36:26 +03:00
co-authored by Claude Opus 5.5
parent b113e72c71
commit ad3d834392
25 changed files with 243 additions and 38 deletions
+13 -1
View File
@@ -110,6 +110,12 @@ type Tag struct {
// why a message was decided the way it was). It is the browser's own popover:
// the tag is a button that names the sheet by ID, so ID is unique on the page.
// Its content is a table of name and value.
//
// HTML Living Standard, popover.html: popovertarget on a button shows or hides
// (popovertargetaction="hide") the element with that id, with no script; a
// browser without the popover attribute (before Chrome 114, Firefox 125,
// Safari 17 - MDN browser-compat-data 6.0.0, html.global_attributes.popover)
// does not open it.
type Sheet struct {
ID string
Tag Tag
@@ -163,7 +169,9 @@ func StatusTag(status string) string {
// wbrAt escapes s and puts a <wbr> after every @ (template function wbr_at):
// an address in a table cell breaks where it reads naturally, so the column can
// shrink without splitting a name mid-word.
// shrink without splitting a name mid-word. Go 1.26, text/template funcs.go
// HTMLEscape(): HTMLEscapeString escapes < > & ' " and NUL, so the only markup
// in the result is the <wbr> added here.
func wbrAt(s string) template.HTML {
return template.HTML(strings.ReplaceAll(template.HTMLEscapeString(s), "@", "@<wbr>"))
}
@@ -283,6 +291,10 @@ type Box struct {
Poll string
// OOB marks the box to be swapped into the page by its ID when it comes
// in a polled fragment beside the element that asked for the fragment.
// htmx 2.0.4, src/htmx.js swap(): the response replaces only the target;
// findAndSwapOobElements() takes every hx-swap-oob element out of it,
// nested ones too (allowNestedOobSwaps defaults true), and oobSwap()
// with "true" swaps it outerHTML over the element of its id.
OOB bool
// DomainPick: see Box.
DomainPick bool
+6 -1
View File
@@ -16,7 +16,10 @@ import (
// a response carries no validator at all and the browser is free to guess how
// long to keep it — which is how a replaced favicon keeps showing the old mark
// long after a deploy. Hashing the content gives every asset a validator that
// changes exactly when the asset does.
// changes exactly when the asset does. RFC 9111 § 4.2.2: without explicit
// freshness a cache may assign a heuristic lifetime; Go 1.26, net/http fs.go
// ServeContent(): no Last-Modified for a zero modtime, and an ETag the caller
// set answers If-None-Match.
var staticETags = buildStaticETags()
func buildStaticETags() map[string]string {
@@ -50,6 +53,8 @@ func buildStaticETags() map[string]string {
// handful of small files on a single-operator panel that trade is the right way
// round — correctness after a deploy matters more than saving the round trip.
// http.ServeContent answers the conditional request from the ETag we set here.
// RFC 9111 § 5.2.2.4: no-cache lets a cache store the response but not reuse
// it without validating it first.
func StaticHandler() http.Handler {
files := http.FileServer(http.FS(assetsFS))
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+23 -5
View File
@@ -10,7 +10,8 @@
// read from the field itself, so it can never drift from what is shown. Where
// the clipboard API is absent (plain HTTP outside localhost) the value is
// selected instead, ready for the operator's own Ctrl+C. The button's icon
// stays; only its word changes for a moment.
// stays; only its word changes for a moment. W3C Clipboard API, § Navigator
// interface: navigator.clipboard is [SecureContext].
document.addEventListener("click", function (ev) {
var button = ev.target.closest("button[data-copy]");
if (!button) {
@@ -69,6 +70,9 @@
// inline script. The listener is delegated from the document,
// so it also covers markup swapped in by HTMX. With JavaScript disabled the
// form submits without asking — exactly as the inline handler behaved.
// HTML Living Standard, form-control-infrastructure.html#form-submission-algorithm:
// submit is fired with bubbles and cancelable true, and a cancelled one
// ends the submission.
document.addEventListener("submit", function (ev) {
var form = ev.target.closest("form[data-confirm]");
if (form && !window.confirm(form.dataset.confirm)) {
@@ -140,6 +144,10 @@
form.querySelectorAll(rule.target).forEach(function (target) {
// hidden alone does not hide an element whose own stylesheet gives it a
// display (Bulma's .box), so Bulma's is-hidden helper goes with it.
// HTML Living Standard, rendering.html#hidden-elements: [hidden] is
// display: none in the user agent's sheet, which an author rule such
// as Bulma 1.0.4's .box { display: block } overrides; .is-hidden is
// display: none !important.
target.hidden = !show;
target.classList.toggle("is-hidden", !show);
if (!show && rule.clearWhenHidden) {
@@ -169,19 +177,26 @@
initShowWhen(document);
});
// htmx:load fires for every element htmx puts into the page, so swapped-in
// markup starts with its blocks shown or hidden the way a full page does.
// htmx:load fires for each top-level element htmx puts into the page, so
// swapped-in markup starts with its blocks shown or hidden the way a full
// page does. htmx 2.0.4, src/htmx.js insertNodesBefore() queues
// makeAjaxLoadTask(child) for each element of the swapped content, which
// triggers htmx:load on it (detail.elt); initShowWhen looks inside it.
document.addEventListener("htmx:load", function (ev) {
initShowWhen(ev.detail.elt);
});
// --- Adaptive monitoring polling ---------------------------------------
// The four monitoring fragments carry data-poll and hx-trigger="load" for
// the first fetch only. panel.js schedules the rest: 5 s while the operator
// the first fetch only (htmx 2.0.4, src/htmx.js addTriggerHandler(): "load"
// fires once, when the element is first processed). panel.js schedules the rest: 5 s while the operator
// is active on the page, 30 s when the tab is visible but idle, and nothing
// while the tab is hidden. hx-trigger="every Ns [expr]" could express some
// of that, but the filter is evaluated with `new Function`, which the
// panel's CSP (default-src 'self', no 'unsafe-eval') would silently break.
// panel's CSP (default-src 'self', no 'unsafe-eval') would break: htmx
// 2.0.4, src/htmx.js maybeGenerateConditional() compiles the filter with
// Function(); the EvalError is caught, logged as htmx:syntax:error, and the
// trigger is kept without its filter, so it would fire on every tick.
var pollActiveMs = 5000;
var pollIdleMs = 30000;
// No pointer/keyboard/scroll input for this long → treat the tab as idle.
@@ -238,6 +253,9 @@
}
// Swapped-in markup still carries hx-trigger="load"; strip it so htmx does
// not issue a duplicate GET on top of the response we just received.
// htmx 2.0.4, src/htmx.js swap(): htmx:afterSwap fires on the new
// elements before doSettle() runs the settle tasks, and only those
// (makeAjaxLoadTask -> processNode) act on hx-trigger.
el.removeAttribute("hx-trigger");
schedulePoll(el);
}
+5 -1
View File
@@ -32,7 +32,11 @@
the head for the request-indicator classes. The panel uses no
hx-indicator, and that injected element would be the one thing the
Content-Security-Policy has to make an exception for, so it
is switched off here. */}}
is switched off here. htmx 2.0.4, src/htmx.js: the ready handler runs
mergeMetaConfig() before insertIndicatorStyles(), which adds the element
only while includeIndicatorStyles is not false. Both scripts are defer:
they run in this order once parsing ends and before DOMContentLoaded
(HTML Living Standard, parsing.html#the-end). */}}
<meta name="htmx-config" content='{"includeIndicatorStyles":false}'>
<script src="/static/htmx.min.js" defer></script>
<script src="/static/panel.js" defer></script>