honest framework

honest-DOM

The DOM is the authority on state. The primitives are pure; every boundary op is injected — no global document, no ambient clock.

The DATAOS primitives — collect, apply, observe, on, send, replay — as pure functions. Every boundary op injected, no global document.

DATAOS says the DOM is the state — there is no other store. But the moment you write the client code that makes it true, a document.querySelector sneaks into a pure function, a new Date() decides an expiry, an addEventListener wires a handler you can no longer test without a browser. The principle is sound; the implementation quietly grows the exact hidden state and hidden I/O it was meant to abolish. Now "read the DOM, decide, write the DOM" is untestable, because deciding is tangled with touching the global document.

honest-DOM is the small, pure-function library that implements DATAOS without smuggling globals back in. It gives you the primitives — collect(), apply(), observe(), on(), send(), replay() — and it treats every boundary operation as *injected*. There is no bare document, no ambient clock, no free-floating addEventListener inside the library's own logic. The element is the DOM interface; the clock is a parameter; the event bus is passed in. That is what makes "read, decide, write" a function you can test over a plain mock.

The DOM is the authority; the primitives are pure

collect() reads a declared region of the DOM into a manifest, a plain value. Your logic transforms the value. apply() writes it back, changing only what differs. observe() and on() subscribe through an injected bus, so a handler is a pure function from element and event to a set of changes, not a closure mutating the world. send() and replay() carry browser events to the server's event log and recover the page after a refresh by re-applying recorded state. State lives in the DOM; the functions that move it are pure.

Why injected boundaries are a poka-yoke

A pure-sounding client function with a hidden document or Date.now() inside is the standard way DATAOS erodes: it works, it ships, and it drags untestable global state along behind it. Inject every boundary op instead — element methods, the clock, the bus — and the category is structurally gone. honest-check's HC-P004 and HC-P011 flag a bare global read or a lifecycle hook in the library's logic at the gate. The DOM stays the single store, and the code that reads and writes it stays a set of functions you can verify without a browser at all.