charts refactored onto the shared coop_chart.js module — rendering unchanged
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
The tooltip machinery, axis steps, frames, bars, lines and hover targets move to the canonical shared module (ops-docs scripts/shared/coop_chart.js, byte-identical copy spliced into PAGE_HTML at import). PROOF of no visual change: rendered innerHTML captured across 21 chart states (5 trend metrics x 3 ranges, 2 money modes x 3 periods) is byte-identical pre/post refactor. CI: oidc + chart sync pins added to the pipeline; vendored check-page-js.sh splices the module into the extracted page JS.
This commit is contained in:
1 parent
c31f124bd1
commit
5ea2be7247
5 files changed
+412
-243
No files matched your search
+14
-2
@@ -38,8 +38,20 @@ html = src[start:src.index('"""', start)]
|
||||
blocks = re.findall(r"<script>(.*?)</script>", html, re.S)
|
||||
if len(blocks) != 1:
|
||||
sys.exit(f"expected exactly 1 <script> block in PAGE_HTML, found {len(blocks)}")
|
||||
open(sys.argv[2], "w").write(blocks[0])
|
||||
print(f"extracted {len(blocks[0])} chars of page JS from PAGE_HTML")
|
||||
js = blocks[0]
|
||||
# Splice the shared chart module exactly as the app does at import time, so
|
||||
# the checked/eval'd JS is what actually serves. The placeholder is a comment,
|
||||
# and a missing module file leaves the placeholder in place (the harness then
|
||||
# fails loudly on the missing CoOpChart instead of silently checking stale JS).
|
||||
from pathlib import Path
|
||||
placeholder = "/*@@CHART_MODULE@@*/"
|
||||
if placeholder in js:
|
||||
module = Path(sys.argv[1]).resolve().parent / "coop_chart.js"
|
||||
if module.exists():
|
||||
js = js.replace(placeholder, module.read_text())
|
||||
print(f"spliced shared chart module ({module.name}) into the extracted page JS")
|
||||
open(sys.argv[2], "w").write(js)
|
||||
print(f"extracted {len(js)} chars of page JS from PAGE_HTML")
|
||||
PY
|
||||
|
||||
node --check "$TMP/page.js"
|
||||
|
||||
Reference in new issue
Block a user