"""The front end as the tests mean it: one script, however many files it is. For years `dee/static/app.js` WAS the front end, so a test that wanted to assert something about the front end read that path, and 74 test files across this suite still name it — 129 times. That was accurate and is now a trap. The file reached 24,449 lines, which is more than fits in one sitting or one context window, and a file nobody reads whole is a file where edits get made blind; the `.mc-find[hidden]` bug in #413 was exactly that. It has to come apart. But every extraction moves text out of app.js, and 129 assertions that name app.js by path would fail on text that had simply moved — so the file could not be split without breaking dozens of tests that have no interest in which file anything lives in. So the assertions follow the CODE rather than the filename. `app_js()` returns app.js concatenated with every file lifted out of it, in the order index.html loads them, and a test asserting "this string is in the front end" keeps meaning that through any future extraction. Scope is deliberate. This is NOT every script the page loads: cockpit.js, trace.js and the rest are separate programs that were never part of app.js, and folding them in would quietly change the many tests here that count occurrences rather than merely look for one. The membership rule is self-describing, like the coupled asset set in dee/server.py: a lifted file says so in its own header, and this reads that rather than keeping a list beside it. A list is a second thing to update, and the way it fails is a file dropping silently out of everything asserted here. """ from __future__ import annotations import pathlib import re STATIC = pathlib.Path(__file__).resolve().parent.parent / "dee" / "static" ROOT = "app.js" #: What a file lifted out of app.js writes in its own header to say so. LIFTED_MARKER = "lifted out of app.js" def app_js_files() -> list[pathlib.Path]: """app.js and everything lifted out of it, in index.html's load order. Load order, not alphabetical: these files share one global scope and the whole reason the split is safe is that document order is execution order. A test that reasons about what is defined before what needs to see them in the order the browser does. """ html = (STATIC / "index.html").read_text(encoding="utf-8") loaded = re.findall(r'