@@ -32,6 +32,21 @@ Useful environment overrides:
3232- ` OUT_DIR `
3333- ` CMAKE_BUILD_TYPE `
3434
35+ ## Agent PR Workflow
36+
37+ For non-trivial runtime, workflow, or API changes, keep the PR path explicit:
38+
39+ 1 . Start from a clean topic branch and inspect ` git status ` before editing.
40+ 2 . Add or update a regression/contract check before changing behavior when
41+ practical. Static contract scripts are acceptable for workflow invariants.
42+ 3 . Keep Emscripten build directories, ccache, model caches, and Playwright
43+ artifacts outside the repository unless they are intentionally versioned.
44+ 4 . Run the targeted checks in this file and the full browser smoke when the
45+ change touches ` js/ ` , ` src/ ` , ` scripts/ ` , or GitHub workflows.
46+ 5 . Use an independent review before committing PR-bound changes. Fix blocking
47+ findings, rerun the targeted checks, then commit locally; do not push or open
48+ a PR unless the maintainer asks.
49+
3550### Local Verification Notes
3651
3752When validating bridge runtime changes locally, keep build/cache output outside
@@ -44,9 +59,44 @@ export EM_CACHE=/private/tmp/llama_web_bridge_emcache
4459BUILD_DIR=/private/tmp/llama_web_bridge_build MEM64_BUILD_DIR=/private/tmp/llama_web_bridge_build_mem64 OUT_DIR=/private/tmp/llama_web_bridge_dist WEBGPU_BRIDGE_BUILD_MEM64=1 ./scripts/build_bridge.sh
4560```
4661
62+ Minimum local checks before handing off a PR-ready branch:
63+
64+ ``` bash
65+ node --check js/llama_webgpu_bridge.js
66+ node --check js/llama_webgpu_bridge_worker.js
67+ python3 -m py_compile scripts/verify_state_persistence_api.py scripts/verify_ci_reliability.py scripts/state_persistence_browser_smoke.py
68+ python3 scripts/verify_state_persistence_api.py
69+ python3 scripts/verify_ci_reliability.py
70+ ```
71+
72+ For state-persistence or workflow changes, also run the browser smoke against a
73+ built ` OUT_DIR ` . Keep the tiny model in a user cache or ` /private/tmp ` ; do not
74+ commit downloaded GGUFs or smoke artifacts:
75+
76+ ``` bash
77+ python3 -m pip install --user playwright
78+ python3 -m playwright install chromium
79+ python3 scripts/state_persistence_browser_smoke.py \
80+ --dist-dir /private/tmp/llama_web_bridge_dist \
81+ --model-url https://huggingface.co/aladar/llama-2-tiny-random-GGUF/resolve/main/llama-2-tiny-random.gguf \
82+ --model-sha256 81f226c62d28ed4a1a9b9fa080fcd9f0cc40e0f9d5680036583ff98fbcd035cb \
83+ --model-cache-dir ~ /.cache/llama-web-bridge/state-smoke-models \
84+ --artifacts-dir /private/tmp/llama_web_bridge_state_smoke_artifacts
85+ ```
86+
4787## CI / Release
4888
4989- CI build gate: ` .github/workflows/ci.yml `
90+ - CI reliability contract: ` scripts/verify_ci_reliability.py `
91+ - Keep this script updated when changing browser smoke behavior, action
92+ versions, or workflow diagnostics.
93+ - The CI smoke must use a pinned tiny GGUF URL plus SHA-256, cache the model in
94+ the same expanded ` ~/.cache/llama-web-bridge/state-smoke-models ` directory
95+ used by ` actions/cache ` , and upload ` state-persistence-smoke-artifacts ` on
96+ failure.
97+ - Both CI and publish workflows intentionally set
98+ ` FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 ` so action-runtime regressions are caught
99+ before Node 20 deprecation becomes a hard failure.
50100- Publish workflow: ` .github/workflows/publish_assets.yml `
51101 - Requires ` WEBGPU_BRIDGE_ASSETS_PAT `
52102 - Pushes assets + tag to ` llama-web-bridge-assets `
@@ -73,3 +123,11 @@ After publishing assets tag:
73123 ` navigator.hardwareConcurrency ` is greater than the bridge pthread pool size.
74124- Run the smoke through both direct runtime (` disableWorker: true ` ) and the
75125 bridge worker path; both should report ` n_threads ` capped to the pool size.
126+ - For state persistence, exercise both direct and worker runtimes with a real
127+ tiny model. The smoke should evaluate a prompt, save bytes, mutate state,
128+ reload bytes, and verify generation still works after restore.
129+ - Worker and direct runtime filesystems are separate. Do not silently fall back
130+ from worker-owned state APIs to direct runtime state; byte APIs are the durable
131+ app-storage path for IndexedDB/OPFS/Cache API integrations.
132+ - If the smoke downloads a model, never expose raw signed/authenticated locations in
133+ thrown errors or artifacts. Redact userinfo, query, and fragment values.
0 commit comments