import sys, os
sys.path.insert(0, os.path.dirname(__file__))
from crlfpatch import patch

patch('docs/adr/0004-single-daemon-broker-brain-split-and-self-update.md', [
('''changes no broker/brain IPC or ownership boundary, and takes effect only when
the running broker has the new implementation.

''',
'''changes no broker/brain IPC or ownership boundary, and takes effect only when
the running broker has the new implementation.

<!-- [doc->REQ-WEB-SERVING-IN-BRAIN] -->
**HTTP listener amendment (releases#305, 2026-09-25):** the node-local loopback
HTTP listener and its request handling (docs, node-prefixed resources, the
cross-node proxy leg) are a **brain** resource. A refresh or a brain-only apply
re-executes only the brain, so serving code that lived in the broker could never
become new without a full daemon flip. The brain binds after the supervisor has
killed its predecessor, so a listener never contends with itself; the rebind gap
is the accepted cost and is measured, not budgeted. The brain announces its bound
port to the broker, whose seed control answers the docs-port query, and the
record is scoped to the announcing generation. The broker keeps what it held for
reasons unrelated to serving: PTYs, the QUIC endpoint, seed control, the
serving-registry boot reconcile, the LAN bootstrap listener and the t=0
canonical-exe capture (KH 6.11). The cross-node proxy still dials through the
broker socket. Consequences: loopback serving now shares the brain's
availability (a crashed or rolling-back brain takes it down until a respawn);
the change is an additive IPC kind, so it rides a brain-only update, and a node
whose broker predates it keeps serving from that broker until its first broker
flip. A rollback across this boundary (an older brain on a newer broker) serves
nothing, which is accepted.

'''),
])

patch('CONTEXT.md', [
('''Under WEBSERVE (ADR-0056) the same paths are also reachable under the local node prefix; the bare paths stay as a compatibility alias. <!-- [doc->REQ-DOCS-LOCAL-SERVER] -->''',
'''Under WEBSERVE (ADR-0056) the same paths are also reachable under the local node prefix; the bare paths stay as a compatibility alias. The listener lives in the daemon **brain**, not the broker (releases#305, ADR-0004 HTTP listener amendment): `spt daemon refresh` and a brain-only update serve new code with no daemon flip, and serving is down while the brain is down. A node whose broker predates this keeps serving from that broker until its first broker flip. <!-- [doc->REQ-DOCS-LOCAL-SERVER] --> <!-- [doc->REQ-WEB-SERVING-IN-BRAIN] -->'''),
])
