diff --git a/.github/workflows/phase0-host.yml b/.github/workflows/phase0-host.yml index fe092a7..4709ab7 100644 --- a/.github/workflows/phase0-host.yml +++ b/.github/workflows/phase0-host.yml @@ -36,10 +36,14 @@ jobs: working-directory: pi_hmi - run: python -m unittest discover -s tests -p 'test_m7.py' -v working-directory: pi_hmi + - run: python -m unittest discover -s tests -p 'test_m8.py' -v + working-directory: pi_hmi - run: node --check static/history.js working-directory: pi_hmi - run: node --check static/storage.js working-directory: pi_hmi + - run: node --check static/offline.js + working-directory: pi_hmi - run: g++ -std=c++11 tests/firmware_behavior.cpp -o /tmp/germ-firmware-test && /tmp/germ-firmware-test working-directory: pi_hmi - uses: actions/setup-node@v4 @@ -67,6 +71,10 @@ jobs: working-directory: pi_hmi env: GERM_PLAYWRIGHT_MODULE: ${{ runner.temp }}/germ-browser/node_modules/playwright + - run: node tests/browser_m8.cjs + working-directory: pi_hmi + env: + GERM_PLAYWRIGHT_MODULE: ${{ runner.temp }}/germ-browser/node_modules/playwright - uses: actions/upload-artifact@v4 if: always() with: @@ -77,3 +85,4 @@ jobs: build/m5-browser/ build/m6-browser/ build/m7-browser/ + build/m8-browser/ diff --git a/docs/evidence/README.md b/docs/evidence/README.md index b544e60..6a3736c 100644 --- a/docs/evidence/README.md +++ b/docs/evidence/README.md @@ -1,6 +1,6 @@ # GERM implementation evidence index -M7: [storage/backup/offline restore campaign](m7/README.md), under [M6 acceptance and M7 authorization](../phase0/M6_REVIEW_VERDICT.md). Earlier M6/M5 evidence is preserved as historical review evidence. No physical, security or deployment acceptance is implied. +M8: [offline host/usability campaign](m8/README.md), under [M7 acceptance and M8 authorization](../phase0/M7_REVIEW_VERDICT.md). Earlier M7/M6/M5 evidence is preserved as historical review evidence. No physical, security or deployment acceptance is implied. Current M5: [capture/local-ML evidence](m5/README.md), [implementation/traceability](../phase0/M5_IMPLEMENTATION.md), [dependency register](../phase0/M5_DEPENDENCIES.md). Synthetic host milestone only; all earlier PRs remain unmerged and M6 is not started. diff --git a/docs/evidence/m8/CI_RESULTS.json b/docs/evidence/m8/CI_RESULTS.json new file mode 100644 index 0000000..694363a --- /dev/null +++ b/docs/evidence/m8/CI_RESULTS.json @@ -0,0 +1,457 @@ +{ + "tested_commit": "1ab1acdd54fe9bb753e0382fce264ff376c98ce2", + "runs": [ + { + "id": 43905012557, + "url": "https://github.com/turtle-robotics/GERM/actions/runs/43905012557", + "jobs": [ + { + "id": 133431394158, + "name": "host", + "status": "completed", + "conclusion": "success", + "run_id": 43905012557, + "logs_url": null, + "steps": [ + { + "name": "Set up job", + "status": "completed", + "conclusion": "success", + "number": 1 + }, + { + "name": "Run actions/checkout@v4", + "status": "completed", + "conclusion": "success", + "number": 2 + }, + { + "name": "Run actions/setup-python@v5", + "status": "completed", + "conclusion": "success", + "number": 3 + }, + { + "name": "Run python -m pip install -r tests/requirements-host.txt", + "status": "completed", + "conclusion": "success", + "number": 4 + }, + { + "name": "Run python check_integration.py", + "status": "completed", + "conclusion": "success", + "number": 5 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_phase0.py' -v", + "status": "completed", + "conclusion": "success", + "number": 6 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m0.py' -v", + "status": "completed", + "conclusion": "success", + "number": 7 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m1.py' -v", + "status": "completed", + "conclusion": "success", + "number": 8 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m1_http.py' -v", + "status": "completed", + "conclusion": "success", + "number": 9 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m2.py' -v", + "status": "completed", + "conclusion": "success", + "number": 10 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m3.py' -v", + "status": "completed", + "conclusion": "success", + "number": 11 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m4.py' -v", + "status": "completed", + "conclusion": "success", + "number": 12 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m5.py' -v", + "status": "completed", + "conclusion": "success", + "number": 13 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m5_clock.py' -v", + "status": "completed", + "conclusion": "success", + "number": 14 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m6.py' -v", + "status": "completed", + "conclusion": "success", + "number": 15 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m7.py' -v", + "status": "completed", + "conclusion": "success", + "number": 16 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m8.py' -v", + "status": "completed", + "conclusion": "success", + "number": 17 + }, + { + "name": "Run node --check static/history.js", + "status": "completed", + "conclusion": "success", + "number": 18 + }, + { + "name": "Run node --check static/storage.js", + "status": "completed", + "conclusion": "success", + "number": 19 + }, + { + "name": "Run node --check static/offline.js", + "status": "completed", + "conclusion": "success", + "number": 20 + }, + { + "name": "Run g++ -std=c++11 tests/firmware_behavior.cpp -o /tmp/germ-firmware-test && /tmp/germ-firmware-test", + "status": "completed", + "conclusion": "success", + "number": 21 + }, + { + "name": "Run actions/setup-node@v4", + "status": "completed", + "conclusion": "success", + "number": 22 + }, + { + "name": "Run npm install --prefix \"$RUNNER_TEMP/germ-browser\" playwright@1.62.1", + "status": "completed", + "conclusion": "success", + "number": 23 + }, + { + "name": "Run \"$RUNNER_TEMP/germ-browser/node_modules/.bin/playwright\" install --with-deps chromium", + "status": "completed", + "conclusion": "success", + "number": 24 + }, + { + "name": "Run node tests/browser_checks.cjs", + "status": "completed", + "conclusion": "success", + "number": 25 + }, + { + "name": "Run node tests/browser_m4.cjs", + "status": "completed", + "conclusion": "success", + "number": 26 + }, + { + "name": "Run node tests/browser_m5.cjs", + "status": "completed", + "conclusion": "success", + "number": 27 + }, + { + "name": "Run node tests/browser_m6.cjs", + "status": "completed", + "conclusion": "success", + "number": 28 + }, + { + "name": "Run node tests/browser_m7.cjs", + "status": "completed", + "conclusion": "success", + "number": 29 + }, + { + "name": "Run node tests/browser_m8.cjs", + "status": "completed", + "conclusion": "success", + "number": 30 + }, + { + "name": "Run actions/upload-artifact@v4", + "status": "completed", + "conclusion": "success", + "number": 31 + }, + { + "name": "Post Run actions/setup-node@v4", + "status": "completed", + "conclusion": "success", + "number": 60 + }, + { + "name": "Post Run actions/setup-python@v5", + "status": "completed", + "conclusion": "success", + "number": 61 + }, + { + "name": "Post Run actions/checkout@v4", + "status": "completed", + "conclusion": "success", + "number": 62 + }, + { + "name": "Complete job", + "status": "completed", + "conclusion": "success", + "number": 63 + } + ] + } + ] + }, + { + "id": 43904999920, + "url": "https://github.com/turtle-robotics/GERM/actions/runs/43904999920", + "jobs": [ + { + "id": 133431349801, + "name": "host", + "status": "completed", + "conclusion": "success", + "run_id": 43904999920, + "logs_url": null, + "steps": [ + { + "name": "Set up job", + "status": "completed", + "conclusion": "success", + "number": 1 + }, + { + "name": "Run actions/checkout@v4", + "status": "completed", + "conclusion": "success", + "number": 2 + }, + { + "name": "Run actions/setup-python@v5", + "status": "completed", + "conclusion": "success", + "number": 3 + }, + { + "name": "Run python -m pip install -r tests/requirements-host.txt", + "status": "completed", + "conclusion": "success", + "number": 4 + }, + { + "name": "Run python check_integration.py", + "status": "completed", + "conclusion": "success", + "number": 5 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_phase0.py' -v", + "status": "completed", + "conclusion": "success", + "number": 6 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m0.py' -v", + "status": "completed", + "conclusion": "success", + "number": 7 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m1.py' -v", + "status": "completed", + "conclusion": "success", + "number": 8 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m1_http.py' -v", + "status": "completed", + "conclusion": "success", + "number": 9 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m2.py' -v", + "status": "completed", + "conclusion": "success", + "number": 10 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m3.py' -v", + "status": "completed", + "conclusion": "success", + "number": 11 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m4.py' -v", + "status": "completed", + "conclusion": "success", + "number": 12 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m5.py' -v", + "status": "completed", + "conclusion": "success", + "number": 13 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m5_clock.py' -v", + "status": "completed", + "conclusion": "success", + "number": 14 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m6.py' -v", + "status": "completed", + "conclusion": "success", + "number": 15 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m7.py' -v", + "status": "completed", + "conclusion": "success", + "number": 16 + }, + { + "name": "Run python -m unittest discover -s tests -p 'test_m8.py' -v", + "status": "completed", + "conclusion": "success", + "number": 17 + }, + { + "name": "Run node --check static/history.js", + "status": "completed", + "conclusion": "success", + "number": 18 + }, + { + "name": "Run node --check static/storage.js", + "status": "completed", + "conclusion": "success", + "number": 19 + }, + { + "name": "Run node --check static/offline.js", + "status": "completed", + "conclusion": "success", + "number": 20 + }, + { + "name": "Run g++ -std=c++11 tests/firmware_behavior.cpp -o /tmp/germ-firmware-test && /tmp/germ-firmware-test", + "status": "completed", + "conclusion": "success", + "number": 21 + }, + { + "name": "Run actions/setup-node@v4", + "status": "completed", + "conclusion": "success", + "number": 22 + }, + { + "name": "Run npm install --prefix \"$RUNNER_TEMP/germ-browser\" playwright@1.62.1", + "status": "completed", + "conclusion": "success", + "number": 23 + }, + { + "name": "Run \"$RUNNER_TEMP/germ-browser/node_modules/.bin/playwright\" install --with-deps chromium", + "status": "completed", + "conclusion": "success", + "number": 24 + }, + { + "name": "Run node tests/browser_checks.cjs", + "status": "completed", + "conclusion": "success", + "number": 25 + }, + { + "name": "Run node tests/browser_m4.cjs", + "status": "completed", + "conclusion": "success", + "number": 26 + }, + { + "name": "Run node tests/browser_m5.cjs", + "status": "completed", + "conclusion": "success", + "number": 27 + }, + { + "name": "Run node tests/browser_m6.cjs", + "status": "completed", + "conclusion": "success", + "number": 28 + }, + { + "name": "Run node tests/browser_m7.cjs", + "status": "completed", + "conclusion": "success", + "number": 29 + }, + { + "name": "Run node tests/browser_m8.cjs", + "status": "completed", + "conclusion": "success", + "number": 30 + }, + { + "name": "Run actions/upload-artifact@v4", + "status": "completed", + "conclusion": "success", + "number": 31 + }, + { + "name": "Post Run actions/setup-node@v4", + "status": "completed", + "conclusion": "success", + "number": 60 + }, + { + "name": "Post Run actions/setup-python@v5", + "status": "completed", + "conclusion": "success", + "number": 61 + }, + { + "name": "Post Run actions/checkout@v4", + "status": "completed", + "conclusion": "success", + "number": 62 + }, + { + "name": "Complete job", + "status": "completed", + "conclusion": "success", + "number": 63 + } + ] + } + ] + } + ] +} diff --git a/docs/evidence/m8/HOST_TEST_RESULTS.json b/docs/evidence/m8/HOST_TEST_RESULTS.json new file mode 100644 index 0000000..7ea302d --- /dev/null +++ b/docs/evidence/m8/HOST_TEST_RESULTS.json @@ -0,0 +1,424 @@ +{ + "timestamp_utc": "2026-11-16T16:16:23.397607+00:00", + "python": "3.12.14 (main, Aug 25 2026, 14:01:42) [MSC v.1944 64 bit (AMD64)]", + "platform": "win32", + "commit": "1ab1acdd54fe9bb753e0382fce264ff376c98ce2", + "scope": "Host/synthetic only; no devices, deployment, flash, production restart or physical acceptance", + "results": [ + { + "name": "existing-integration", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "check_integration.py" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "existing-integration.txt", + "log_sha256": "0e26429cdb23586093733660d877535a459d38537e507977fd8f6b65b5ec0aa3" + }, + { + "name": "phase0-contracts", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_phase0.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "phase0-contracts.txt", + "log_sha256": "9b28a2b0a60c132334b854e969e4bd3696ebd4d0902c766a7876d657cd3a5229" + }, + { + "name": "m0-contracts", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m0.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m0-contracts.txt", + "log_sha256": "d182c0d01d4d724a33bb1f75b472717185d892341a57d379ef746d3f52cd3bdc" + }, + { + "name": "m1-state-permissions", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m1.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m1-state-permissions.txt", + "log_sha256": "a77cc7dbbb9c146f51f0a3c93ee53e9f2d0106ec84f3fa9fb4181e5d24cdc966" + }, + { + "name": "m1-http-boundary", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m1_http.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m1-http-boundary.txt", + "log_sha256": "a791376d5f9b2d894904620a53b6c5d6fe014b92356b53e114778d40dedb777a" + }, + { + "name": "m2-sqlite-recovery", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m2.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m2-sqlite-recovery.txt", + "log_sha256": "1ef7e778d631e092ac27de06383b4f541aeaf9785dac54c7a6e1afc600e0ab6c" + }, + { + "name": "m3-durable-events", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m3.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m3-durable-events.txt", + "log_sha256": "2931b67642cb88e74f6ffb89da0715e3d65ef035e3898cf5328eee2496fd34b0" + }, + { + "name": "m4-grow-hmi", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m4.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m4-grow-hmi.txt", + "log_sha256": "96e6788fde91768b1cedf6bcbbac70c16ce9298aebd497091503ed243012f030" + }, + { + "name": "m5-camera-ml", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m5.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m5-camera-ml.txt", + "log_sha256": "c4cca212b47fe042b320ba4a7ec29d8bfbf9884648f79a6cc59c225b7b3bec78" + }, + { + "name": "m5-clock-recovery", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m5_clock.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m5-clock-recovery.txt", + "log_sha256": "84b6d21c2be52a2833c6a3f105d3dab8c215fffc90e7053f00f0cc6d21c6e309" + }, + { + "name": "m6-history-export", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m6.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m6-history-export.txt", + "log_sha256": "9b71dda2425f7175247c0f6b5dbe86f7ffc20065162db5ded75f265695fe1b16" + }, + { + "name": "m7-storage-backup", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m7.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m7-storage-backup.txt", + "log_sha256": "cd5888be325575e080ebae53940251761a6d18194d31c0d0178ea7e6430d1da0" + }, + { + "name": "m8-offline-usability", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_m8.py", + "-v" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "m8-offline-usability.txt", + "log_sha256": "fc618c8fa4c8578993df96993a05e5f3c52f6d0e52fad275b49b4b0f31364707" + }, + { + "name": "preserved-root-app", + "command": [ + "C:\\Users\\jorda\\GERM 2.0\\.venv\\Scripts\\python.exe", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-v" + ], + "cwd": ".", + "exit_code": 0, + "log": "preserved-root-app.txt", + "log_sha256": "03f60b8b653674197df770b604878abb0dd36b456cfc7a2861548f8729ec54a1" + }, + { + "name": "python-parse", + "files": 71, + "exit_code": 0 + }, + { + "name": "javascript-parse", + "command": [ + "C:\\Program Files\\nodejs\\node.EXE", + "--check", + "static/hmi.js" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "javascript-parse.txt", + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "history-javascript-parse", + "command": [ + "C:\\Program Files\\nodejs\\node.EXE", + "--check", + "static/history.js" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "history-javascript-parse.txt", + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "storage-javascript-parse", + "command": [ + "C:\\Program Files\\nodejs\\node.EXE", + "--check", + "static/storage.js" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "storage-javascript-parse.txt", + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "offline-javascript-parse", + "command": [ + "C:\\Program Files\\nodejs\\node.EXE", + "--check", + "static/offline.js" + ], + "cwd": "pi_hmi", + "exit_code": 0, + "log": "offline-javascript-parse.txt", + "log_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "firmware-behavior", + "skipped": "g++ unavailable locally; required CI job compiles/runs actual sketch harness" + } + ], + "source_sha256": { + "docs/phase0/API_ENDPOINTS.json": "7c2f01ee10bc02387e6a71a7982cae5071f8eb874a8c6d53ced06fcb1d8e6c5e", + "docs/phase0/HMI_API_CHECKLIST.json": "31b5e6dabbd082a94f13d50ac72f8e89afe66cf063ab5d83dfa53c66284d7430", + "docs/phase0/HOST_TEST_RESULTS.json": "d3ce6ef6bde4f86e39e387408f73e3a596cebf90ee3dfdc83f483757ff5101b3", + "docs/phase0/M0_SOURCE_BASELINE.json": "3a73c864576532be212152fdaa78856610f412cd7070df64c17da5464d9dcc75", + "docs/phase0/REQUIREMENTS_BASELINE.json": "117e6ece1f830a83ae80e00de64fb5c2be5c46f8176ccb61e0019ed357381911", + "docs/phase0/SOURCE_BASELINE.json": "bc5f04c48ce8b0ed1eb5297e0a0b06f5c4535c3671297b106edcfbed97dd8d39", + "pi_hmi/app.py": "888022b51eadce3a79349f769379ba290ff2831c119fa60deeb7badea4b482c8", + "pi_hmi/arduino_program/arduino_program.ino": "e8402270ca39feb754bd8e7e36ce8bcd3441694b9c60c59f1e93c3953d4ee944", + "pi_hmi/arduino_serial.py": "89aac0b6b0a4b984f87ebf550cded1c8091a44af62c733a89bbcba9b392eabde", + "pi_hmi/camera.py": "301e1d48a50c97398459447fe5702d5804eca84ad7fdd762bdcfe7f32edd8c5e", + "pi_hmi/check_integration.py": "af1b614ef1b1534718b2fe911fdcb237ace9395b25b5db4194749029c7251b08", + "pi_hmi/dashboard.py": "c111337b3e2220061b5fd1a7d20dd820862a20fd04e7795a7e0934a0bd413c60", + "pi_hmi/deploy_to_pi.py": "22060b62f1f22ed52e75a60c9cebe3277679d08b6f1302718ffa2a07fa9fe6c7", + "pi_hmi/dht11_reader.py": "b9770c3c18dc57ccf98d08785e07b0936491afd155419d7a585bf4c066f84f2d", + "pi_hmi/environment/source-sha256.json": "ef5f8d90654af0e93884194e309300b4f48d3535962995cc321a6ec82f52e32a", + "pi_hmi/fan_sender.py": "6883873c813ae8c8d8d72e9f829fb4de38fbc99646aee21a9c339846c89582d1", + "pi_hmi/firmware_service.py": "e4d20cda14b753fb139dbc96342f6c565348f554cc69dbc7627a38204d7bde0a", + "pi_hmi/led_sender.py": "28e0073e288b5a00b7c78686af272bfcb44f5307038d89c1020634b48018dd52", + "pi_hmi/migrations/001_baseline.sql": "7a770f9abf31dbdccfe320a51ca2513adabd5dc44095e3d48a81def524daa883", + "pi_hmi/migrations/002_repository_recovery.sql": "7e160eecbb3e74e0a877d342225dc70dd9be9136b0bf48ab04167db68088eaed", + "pi_hmi/migrations/003_event_receipts.sql": "24d294ce5b6c846c15147b822ee220f68c58174e9b4a381e7248f4af53c5ed13", + "pi_hmi/migrations/004_grow_cycles.sql": "1fe4b12e7155dd4a12d4237dc6474a9436a3127424728818c64b17a17bf6c459", + "pi_hmi/migrations/005_camera_ml.sql": "afc83a022683acb2d0cfeeb2a86938db2fa9c1cdd07b6103628dd6491e58c7d3", + "pi_hmi/migrations/006_camera_clock_guard.sql": "2be0af1e8b90a152f42b1b03a2ebdf10cad29f8e9f602c6351b4e032f18da371", + "pi_hmi/migrations/007_history_exports.sql": "615c9587da69491dd428a1c0df4eee0c4b145e4104e4f17035b8874243e35640", + "pi_hmi/migrations/008_storage_jobs.sql": "532f0b436f3ddf2a12410b873b176c7b13a69c05265390ff43b97c25f73b234f", + "pi_hmi/offline_host.py": "32dcf7e5fe918b057d08202f4c585575fd9259f4eafe24d14ffea363d51fd7c2", + "pi_hmi/sensor_reader.py": "26a9219a60c29bdba2847bda4cfb4bc8449ea9e186faffb37328c933ca0ed3bc", + "pi_hmi/services/__init__.py": "789272cbd285116fd2cf23e525a5fa8af36da2b581382be2393013a06a057088", + "pi_hmi/services/artifact_jobs.py": "929f92115b06d8d1644977e9bb39c4eae6e25a0eeb8145b3aa972fd729d63dab", + "pi_hmi/services/camera_adapter.py": "6e1c5633a85d19245d69a7ae7e45ebd6fa61790d784e4e6d043701a12ad74128", + "pi_hmi/services/camera_service.py": "6bf9f6028be5eee6faf9efee22243ac4d43e6d75e55b7e4e5360ae489b8839f5", + "pi_hmi/services/capture_service.py": "0877baa164d2f2f92f18d81b773435978b89c36ba51d1dae1068445a213c3a60", + "pi_hmi/services/command_service.py": "4e6fb6d1e6e4d79d41508004ec68879986b2e36e1f8d46078adf16ae37339f0e", + "pi_hmi/services/control_runtime.py": "5d815e2112fedbec2e581467cd9ad506c5883809dbddd51f10d94ba2db69301f", + "pi_hmi/services/database_service.py": "3fcd6103ca7cb095cbaf054a5c3716484ca93eb58c349c6aec26ffdca098c8c4", + "pi_hmi/services/event_repository.py": "468e3e60ac13131df8590561f84506ce73ec883cb838ffaf37586c44a0d7991e", + "pi_hmi/services/event_service.py": "a8791205d6f1536d712793ee32f5b5a04099daf384487777083e595b9c8e6842", + "pi_hmi/services/file_lease.py": "41c762e22065bf2dfded6bc1784ae976d62fa8e9ddf9a7a11331c06370edaf26", + "pi_hmi/services/grow_repository.py": "f5e533844ccb5dfc5d4ae91512fd7e1f1e6c48af5be3580f0c160c66cc5dfea7", + "pi_hmi/services/grow_service.py": "6b830c30dfd06c285ea8112f9f4ad3e0e3777088f87cf481f12cffeae9643c3b", + "pi_hmi/services/history_export.py": "b0204b47d475d1d49120aa1d5d1c7ee0381263675b95b25323b9dd44e238f642", + "pi_hmi/services/history_http.py": "d97e004b91e59a5f91504cac990526ce16410edcdabd4117ef8b9e307c8e4a87", + "pi_hmi/services/history_repository.py": "4f88f07f2170353b07438695c500610dd6a2853d50a57deda0b4be90af175330", + "pi_hmi/services/host_lifecycle.py": "f8757c59d963250837c6a12b29fadf56411e5d478ff3a0504388f599cf14ae27", + "pi_hmi/services/image_validation.py": "0f85ad574c5c17a1d738fe9a7e510b34b34f827f8ecb774c702bed6b6e2f98bb", + "pi_hmi/services/lifecycle_http.py": "195eca4374dc71ad7cd7b97fb10a10b01a9f0ad46ed8f0c9f8c9707abad5e37f", + "pi_hmi/services/local_ml_service.py": "7bd404118a51635f5c0298ef80f2ce14382df957f24e2c6acf65686d5fef2a3b", + "pi_hmi/services/media_repository.py": "27b69ef0afcaa4631cc0d942228b1f7cfc0f4a90806acd15dab2f833889ce3f9", + "pi_hmi/services/media_runtime.py": "16d0abbb73ab6f877056d6a8985b836106d995113a4896975f571eb590422136", + "pi_hmi/services/ml_service.py": "5a0dca6a9841c4ed31dd991c232b33ae9e0becad11a3ed69af84662035e66ac4", + "pi_hmi/services/model_contract.py": "349129e33a2140249efbd076efc2a4b41bbbe3703128971145e643fdd3ffbd19", + "pi_hmi/services/restart_service.py": "e3c09ec49535b079293ead3dae8d5685e58b89fead2501e479bb0e1c61050207", + "pi_hmi/services/sensor_policy.py": "e44007427be7d5f5b256308e7a753bb192505a5a72362b2d865dd630e22adfe0", + "pi_hmi/services/sensor_service.py": "5f0cfdd67c21450ea45a67baea235269c2babbf91ca60312a638518fc50ab9f1", + "pi_hmi/services/sqlite_repository.py": "08e78c59b84bb366a39f4295024910d601ba3e575384d0a6c7727a6d16a2af00", + "pi_hmi/services/state_service.py": "9d4ff44a7351b77d071b57b24d83316a6c66d0f6e5732731ccf1bee02816a779", + "pi_hmi/services/storage_http.py": "f947bc36c035a081adc437737f57587f9ecc559dc8c46a5179537f0797cd390f", + "pi_hmi/services/storage_service.py": "7a0b07a69dd8538c22391a83ace3dbcf3412b9d295a1642f5342d3f399d31948", + "pi_hmi/sim/media_fakes.py": "8d8dce2fea76a2321959c5655ea2131682bfb0c2e387e4ba570ea8c07e0e9b51", + "pi_hmi/sim/offline_adapters.py": "52ab1572ce00d86f17fb157119839f5bac0b776d47fc388d4d9f7fa3a5e61921", + "pi_hmi/sim/run_sim.py": "f364579cb2adbb55da952b4b96e54fbb9565194b3bedd383a99f577d72a3ccd2", + "pi_hmi/static/history.css": "6a45625e254fd801129f477a1ac987acbb47ae985365045f2cca72d58bc9a783", + "pi_hmi/static/history.js": "51793e1dbc3961d42f84f3cc6b544e2a988a3172891ab0ca3d8552bde327ec7c", + "pi_hmi/static/hmi.css": "a0830ba0befb75383acab89d7605c0099e79eb93c8b42eb390212975b43637ca", + "pi_hmi/static/hmi.js": "97d96610134267c7e90e08e43eac2b0ff12bce8f8a99c16c808f1c44f9cf192d", + "pi_hmi/static/offline.css": "6cdb500b0fccf434320365145eafad6cfbea01c2dfed5850f331a568cba55944", + "pi_hmi/static/offline.js": "4b2aa90ddcb44080a37e6c54a71895ba5498fe0753f93cd6da88cde4d0d3411c", + "pi_hmi/static/storage.css": "3fcaadcd48f5cf2901098cac82bea5e83c54f1ca23961b025541910794341425", + "pi_hmi/static/storage.js": "8b6a0c66718a233ed74e55e196b97aafa46623f786faeb5cd35a279d2381da60", + "pi_hmi/templates/fan.html": "794c626b58f4205cbdc1c24e8444b2816bde2c744656cabc6caae2599ea918b4", + "pi_hmi/templates/firmware.html": "32a92ca906b3cd0fd8b458b35921ec12b4a85559f54f01d533a30bacc25c29bc", + "pi_hmi/templates/index.html": "1365ba7bce462f48074971b891ceac84573dc8357983a6849440f94980ed65fe", + "pi_hmi/templates/led.html": "3ffbe6bd48e1db875384d491938eb5e6c16c576bfeefbfbe2630e8b08f31e048", + "pi_hmi/templates/pump.html": "8b59e0de57f234c0662df4ccfc17719f8177896176b5c4f966ea4368176896ba", + "pi_hmi/tests/browser_checks.cjs": "9f0e80a08b65a42514aa0ac4922127c368d1677ca40bfd0732df55a48ffdc5bb", + "pi_hmi/tests/browser_host.py": "a4a2789d95d55e15c289e33792753e5c1e735619c175d5d2a07e3e51271d548c", + "pi_hmi/tests/browser_m4.cjs": "efe1c5d4e4be3ebf1cb7fa5774813392f62c42bc6ef6efb6c89dcad21925d08c", + "pi_hmi/tests/browser_m4_host.py": "afb15b9b8e80fc2b75940372903f53271ba50766a5f0cdd1b6ee80ecd35b9bdc", + "pi_hmi/tests/browser_m5.cjs": "6b39f1a6188b5a2536c060a802c25fba136e8ccd308e32aa4f455060ad0883ca", + "pi_hmi/tests/browser_m5_host.py": "356c81d666e5d6a7b3988de163bf9071e9f564da4c172167978866c0f9920b13", + "pi_hmi/tests/browser_m6.cjs": "73cb75daa7c05076689142e38dc7805e7a8ef7c0cf3eb253ea808e1b908bbf43", + "pi_hmi/tests/browser_m6_host.py": "e8827a9b49ff58c1e8375324ff7cde9cd92890243336723690edcd0991540b74", + "pi_hmi/tests/browser_m7.cjs": "c9e698b3c609a452f8e32e411e82fc93e4607f9928126b5e838d43c8c384ccf6", + "pi_hmi/tests/browser_m7_host.py": "e9cd2933fda73648c420959398116fc3754f8ea7cb45f28f1c0cf0117b37d187", + "pi_hmi/tests/browser_m8.cjs": "202069f22de6882a2d9784f10f379667192466553397013e5316affbd6a09286", + "pi_hmi/tests/browser_m8_host.py": "dfabacf11c3fab506aba2d0aee71117f7d53104950b55152f1a122e10bffd954", + "pi_hmi/tests/build_sample_db.py": "cc2c4ca30d888a363332a8495736cc5114f5b86bc4ae6fb7bf3e8881f8d4f183", + "pi_hmi/tests/firmware_behavior.cpp": "e8a6c9a298e193e0b8b7d3e7a091ecdf1ae382e8ee23e3e6b1e9e6255ea7d604", + "pi_hmi/tests/fixtures/api_requests.json": "05713a1486f1674b4daa8ccff2a01f5b4f57e0a0e1dc3030783ad47e5f0c6754", + "pi_hmi/tests/fixtures/camera_metadata.json": "e69aed477489cea9f75a5344cff0e1294586f782988dfc49f21f8a638b928d64", + "pi_hmi/tests/fixtures/scenarios.json": "d103b4ac5abe1c46c5ec733638b2c2279e49c713a49a4e9e5c2a680bfd098172", + "pi_hmi/tests/fixtures/seed.sql": "fd8146d4d165829d6b467763fb3d2b97222a5c3c6dea8164a9fa699358509317", + "pi_hmi/tests/fixtures/sensors.json": "061893105d014394d631b848bc6530b5abf9cf4edc6e607e2ff7cee28930242a", + "pi_hmi/tests/fixtures/serial.json": "2bd486880268ce5799825a3fa41b1cbcf28f0623cd0f33ca66732ba9b2300451", + "pi_hmi/tests/m1_fixtures.py": "315f69e57650c6cdd4c34eb94f1c1e8f6e6fc03b065f3a1e76326f156c87a876", + "pi_hmi/tests/m1_http_harness.py": "aae7284632e48554367c655177b64ed5296de3a41cec06216a75ed7b117a3f78", + "pi_hmi/tests/m4_fixtures.py": "346df3f0e262437c885142999e88ceede7ff315ad8596eca4bcae53ecf2d2f30", + "pi_hmi/tests/m5_fixtures.py": "81be199ed1a4f01e9c1e91898205841473446cb40a70bd588b9dd77a7f39a174", + "pi_hmi/tests/run_host_checks.py": "bdc466e3f9f6019da0e675447a3f583dda4dae49fbe584214f3d562f410f77eb", + "pi_hmi/tests/test_m0.py": "dda217e1a8e94e86177d0b30288c4dc3dc7187f25e802119292e8d4588bb1f63", + "pi_hmi/tests/test_m1.py": "119c20fbf697aae61d24ca48faaed5aeded8a57872827a6ce14c20ba7429c76e", + "pi_hmi/tests/test_m1_http.py": "c0652372446de1ee925d72058c56aed7d154dcdc1fc3470124a40b1502f11967", + "pi_hmi/tests/test_m2.py": "422db898feb02aa20c35512bb15ba714bc74750387cd024799f68494972902bd", + "pi_hmi/tests/test_m3.py": "2369a5a365c73eef66c9ea29885e8602578ff94dfe8b18f054c7fb3169975b50", + "pi_hmi/tests/test_m4.py": "3e858f778b94798ec3b4eed0dbeeb7fb3f9dccc1acc4aacc2f9a2ee52247d07b", + "pi_hmi/tests/test_m5.py": "3e40195c27d7480fd75166f35d9f2e10798ef7e376c51e57da57e3afed885484", + "pi_hmi/tests/test_m5_clock.py": "87f60cdde24198062d9962e405288e159a2d026214ac29f2fbd55dd2dce7c88f", + "pi_hmi/tests/test_m6.py": "90a145a731793e5d6868179b28b76ef95e5e5d816f7782255a9b6e3b3ac31aba", + "pi_hmi/tests/test_m7.py": "119e1729a2e29709142c900d799c2694e5f11599f2d8d683008b494e4ec735a9", + "pi_hmi/tests/test_m8.py": "49a27863159c95ae200c236c5a7b2cfec0538158a22a27f08d7b1c645756df01", + "pi_hmi/tests/test_phase0.py": "802874bf65f0c2386577fd8cbabe6530d1cce40e3a9094569030f6c02fa81be1", + "pi_hmi/verify_live.py": "06e9ee62ae6125d2fc33b14ef91bcd467561e32270c6885a226e10106d22a395" + } +} diff --git a/docs/evidence/m8/README.md b/docs/evidence/m8/README.md new file mode 100644 index 0000000..fb3edfd --- /dev/null +++ b/docs/evidence/m8/README.md @@ -0,0 +1,17 @@ +# M8 Tasks 125/132 host evidence + +Tested implementation: `1ab1acdd54fe9bb753e0382fce264ff376c98ce2`, directly stacked above reviewed M7 `55d69c558f5c134540299128aa23f4415550f9fa`. [PR #13](https://github.com/turtle-robotics/GERM/pull/13) targets `codex/m7-storage-backup`. [M7 verdict and M8 authorization](../../phase0/M7_REVIEW_VERDICT.md), [implementation/traceability/limitations](../../phase0/M8_IMPLEMENTATION.md), [local operating instructions](../../phase0/M8_HOST_OPERATION.md). M8 awaits human review; M9 has not started. + +The campaign retains 226 earlier Python checks and adds 22 M8 tests, for 248 tracked checks: 12 integration, 24 Phase 0, 10 M0, 22 M1, 12 HTTP, 13 M2, 17 M3, 22 M4, 33 M5, 14 clock, 25 M6, 22 M7 and 22 M8. Local Windows results include two explicitly logged symlink-privilege skips in the unchanged M6/M7 suites; POSIX CI runs those checks. Nine preserved untracked root-app tests are separately recorded locally and are not part of GitHub CI. Local g++ is unavailable; CI compiles/runs the actual-sketch C++ harness. All six M1/M4/M5/M6/M7/M8 Chromium flows remain in CI. CI_RESULTS.json records exact source-head runs, jobs and step conclusions. + +Reproduce Python/contracts/parsing with `.venv\Scripts\python.exe pi_hmi/tests/run_host_checks.py --root-app --output build/m8-final-evidence`. HOST_TEST_RESULTS.json records the source commit, commands, UTC timestamp, platform, source/log SHA-256 and package versions. The collector verifies every recorded source hash against the checkout. SOURCE_SECRET_SCAN.json is the empty redacted source-range scan `55d69c5..1ab1acd`. All 15 original hashes are separately verified unchanged. + +M8 tests cover local-only runtime, explicit dependency order, missing/corrupt/unmarked DB preservation, latched repository/logging/gateway faults, duplicate owner/worker refusal, missing/stale/blocked workers, mutation/job/media quiescence, fresh gateway/ML ownership, repeated restart and retained history, synthetic-input freshness, missing camera/model, persisted capture-schedule restart holds, interrupted artifact and inference receipts without replay, unchanged production denial and all seven screen assets/headers. Restart discards confirmations/input authority, pauses cycles and never restores permissions or automatically resumes schedules. Recovery of interrupted inference receipts also works when no model is installed. + +browser-RESULTS.json and three 739×447 screenshots cover all seven screens with external origins blocked, same-origin assets/CSP, current-page navigation, keyboard skip/focus, readable scrolling layout with no horizontal overflow, touch targets, Cancel-focused dialog/Escape without dispatch, local browser transport loss, no POST replay on reconnect, explicit DB/core-worker recovery with paused/unarmed cycles and stale camera hiding without a placeholder. Browser tests use disposable synthetic loopback servers; their explicit authorizer and healthy synthetic inputs are test fixtures. The optional launcher keeps POST authorization unset and cannot select physical adapters. + +Earlier campaigns exposed intermittent paused-summary wait timeouts: the first source push failed the existing M4 browser wait after a successful Pause response; a later local M8 run timed out on the initial paused summary. Repeated runs and later complete campaigns passed. Server responses alone did not establish the cause; no timeout or previous assertion was relaxed. M8 browser failures now retain DOM/API state diagnostics. The unresolved intermittency remains a usability/test-stability limitation for review. A separate observed status gap was corrected: a repository already latched in error now degrades the lifecycle and requires explicit recovery even if a subsequent probe succeeds. + +Offline means runtime independence from internet after dependencies are locally installed, with a reachable local Flask service. It does not provide cached browser-shell operation while that service is absent. No real-time, physical safety, security, full accessibility, target power-loss/endurance or novice usability certification follows from simulations. Optional adapters stay honestly unavailable/degraded; no real sensors, images, model weights or diagnoses are fabricated. Trusted factories are Python code, not a plug-in sandbox; blocking native calls can delay watchdog/shutdown while ownership remains held. + +All prior contracts/tests and the M1 command boundary are retained. No Pi deployment/system-service installation, physical interface, real camera/model operation/download, firmware, live actuator operation, production POST enablement, new network exposure, historical deletion/retention enforcement, merge or Gantt update occurred. The original 15 files and untracked work remain preserved. Electrical/sensor/crop approval, real camera/model validation, authentication/network/security, controlled requirements release, retention, target-system and human-usability gates remain unresolved. All PRs #5–#13 remain unmerged in dependency order; return for M8 review before M9. diff --git a/docs/evidence/m8/SOURCE_SECRET_SCAN.json b/docs/evidence/m8/SOURCE_SECRET_SCAN.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/docs/evidence/m8/SOURCE_SECRET_SCAN.json @@ -0,0 +1 @@ +[] diff --git a/docs/evidence/m8/browser-RESULTS.json b/docs/evidence/m8/browser-RESULTS.json new file mode 100644 index 0000000..cf6f72c --- /dev/null +++ b/docs/evidence/m8/browser-RESULTS.json @@ -0,0 +1,20 @@ +{ + "status": "PASS", + "viewport": "739x447", + "externalRequests": [], + "pageErrors": [], + "checks": [ + "all seven screens with external requests blocked", + "same-origin assets and CSP", + "keyboard skip link and visible focus", + "current-page navigation", + "no horizontal overflow", + "touch target size", + "Cancel-focused dialog and Escape no dispatch", + "lost localhost clears status and disables commands", + "reconnect never replays POSTs", + "DB/core-worker failure requires explicit recovery", + "restart never restores permissions or armed schedules", + "stale camera hides image; no placeholder" + ] +} \ No newline at end of file diff --git a/docs/evidence/m8/browser-local-connection-lost.png b/docs/evidence/m8/browser-local-connection-lost.png new file mode 100644 index 0000000..6ed01de Binary files /dev/null and b/docs/evidence/m8/browser-local-connection-lost.png differ diff --git a/docs/evidence/m8/browser-recovered-permissions-inhibited.png b/docs/evidence/m8/browser-recovered-permissions-inhibited.png new file mode 100644 index 0000000..3d06320 Binary files /dev/null and b/docs/evidence/m8/browser-recovered-permissions-inhibited.png differ diff --git a/docs/evidence/m8/browser-stale-camera-no-placeholder.png b/docs/evidence/m8/browser-stale-camera-no-placeholder.png new file mode 100644 index 0000000..6787ba1 Binary files /dev/null and b/docs/evidence/m8/browser-stale-camera-no-placeholder.png differ diff --git a/docs/evidence/m8/existing-integration.txt b/docs/evidence/m8/existing-integration.txt new file mode 100644 index 0000000..ae46c9c --- /dev/null +++ b/docs/evidence/m8/existing-integration.txt @@ -0,0 +1,17 @@ +test_dashboard_reports_fan_pwm_speed (__main__.RouteTests.test_dashboard_reports_fan_pwm_speed) ... ok +test_fan_command_is_acknowledged (__main__.RouteTests.test_fan_command_is_acknowledged) ... ok +test_fan_pwm_speed_is_acknowledged (__main__.RouteTests.test_fan_pwm_speed_is_acknowledged) ... ok +test_host_scripts_and_custom_sketches_rejected (__main__.RouteTests.test_host_scripts_and_custom_sketches_rejected) ... ok +test_invalid_values_never_send (__main__.RouteTests.test_invalid_values_never_send) ... ok +test_lighting_selector_and_unknown_mode (__main__.RouteTests.test_lighting_selector_and_unknown_mode) ... ok +test_routes_preserved (__main__.RouteTests.test_routes_preserved) ... ok +test_upload_modes_do_not_bypass_gateway (__main__.RouteTests.test_upload_modes_do_not_bypass_gateway) ... ok +test_upload_token_and_review_gate (__main__.RouteTests.test_upload_token_and_review_gate) ... ok +test_firmware_pause_requires_gateway_session (__main__.SerialTests.test_firmware_pause_requires_gateway_session) ... ok +test_matched_acknowledgement (__main__.SerialTests.test_matched_acknowledgement) ... ok +test_stale_acknowledgement_is_not_success (__main__.SerialTests.test_stale_acknowledgement_is_not_success) ... ok + +---------------------------------------------------------------------- +Ran 12 tests in 0.141s + +OK diff --git a/docs/evidence/m8/history-javascript-parse.txt b/docs/evidence/m8/history-javascript-parse.txt new file mode 100644 index 0000000..e69de29 diff --git a/docs/evidence/m8/host-packages.txt b/docs/evidence/m8/host-packages.txt new file mode 100644 index 0000000..8cea87d --- /dev/null +++ b/docs/evidence/m8/host-packages.txt @@ -0,0 +1,10 @@ +blinker==1.9.0 +click==8.5.0 +Flask==3.1.3 +itsdangerous==2.2.0 +Jinja2==3.1.6 +MarkupSafe==3.0.3 +pillow==13.0.0 +pyserial==3.5 +waitress==3.0.2 +Werkzeug==3.1.9 diff --git a/docs/evidence/m8/javascript-parse.txt b/docs/evidence/m8/javascript-parse.txt new file mode 100644 index 0000000..e69de29 diff --git a/docs/evidence/m8/m0-contracts.txt b/docs/evidence/m8/m0-contracts.txt new file mode 100644 index 0000000..0101e2c --- /dev/null +++ b/docs/evidence/m8/m0-contracts.txt @@ -0,0 +1,15 @@ +test_all_screen_fields_and_actual_endpoint_references_are_grounded (test_m0.ChecklistContractTests.test_all_screen_fields_and_actual_endpoint_references_are_grounded) ... ok +test_provisional_requirements_preserve_all_forty_official_rows (test_m0.ChecklistContractTests.test_provisional_requirements_preserve_all_forty_official_rows) ... ok +test_bundled_showcase_only_changes_startup_default (test_m0.SimulatorContractTests.test_bundled_showcase_only_changes_startup_default) ... ok +test_invalid_pwm_does_not_change_output_or_extend_watchdog (test_m0.SimulatorContractTests.test_invalid_pwm_does_not_change_output_or_extend_watchdog) ... ok +test_led_white_rejection_preserves_rgb_and_mode (test_m0.SimulatorContractTests.test_led_white_rejection_preserves_rgb_and_mode) ... ok +test_pwm_requests_and_reported_state_match_candidate (test_m0.SimulatorContractTests.test_pwm_requests_and_reported_state_match_candidate) ... ok +test_real_bridge_accepts_simulator_ack_without_opening_serial (test_m0.SimulatorContractTests.test_real_bridge_accepts_simulator_ack_without_opening_serial) ... ok +test_shorter_pulse_shortens_existing_run (test_m0.SimulatorContractTests.test_shorter_pulse_shortens_existing_run) ... ok +test_status_does_not_extend_pump_limit_or_on_reset_timer (test_m0.SimulatorContractTests.test_status_does_not_extend_pump_limit_or_on_reset_timer) ... ok +test_watchdog_and_stop_clear_all_reported_outputs (test_m0.SimulatorContractTests.test_watchdog_and_stop_clear_all_reported_outputs) ... ok + +---------------------------------------------------------------------- +Ran 10 tests in 0.035s + +OK diff --git a/docs/evidence/m8/m1-http-boundary.txt b/docs/evidence/m8/m1-http-boundary.txt new file mode 100644 index 0000000..e72e3de --- /dev/null +++ b/docs/evidence/m8/m1-http-boundary.txt @@ -0,0 +1,17 @@ +test_all_mutations_denied_without_approved_boundary_or_token (test_m1_http.HttpBoundaryTests.test_all_mutations_denied_without_approved_boundary_or_token) ... ok +test_confirm_cancel_change_accept_and_physical_distinction (test_m1_http.HttpBoundaryTests.test_confirm_cancel_change_accept_and_physical_distinction) ... ok +test_custom_and_builtin_firmware_cannot_flash_or_auto_change_mode (test_m1_http.HttpBoundaryTests.test_custom_and_builtin_firmware_cannot_flash_or_auto_change_mode) ... ok +test_deployment_and_live_utilities_stop_before_any_side_effect (test_m1_http.HttpBoundaryTests.test_deployment_and_live_utilities_stop_before_any_side_effect) ... ok +test_direct_post_missing_confirmation_and_source_spoof_cannot_write (test_m1_http.HttpBoundaryTests.test_direct_post_missing_confirmation_and_source_spoof_cannot_write) ... ok +test_every_control_route_is_inhibited_even_when_old_send_is_patched (test_m1_http.HttpBoundaryTests.test_every_control_route_is_inhibited_even_when_old_send_is_patched) ... ok +test_firmware_usb_context_cannot_release_without_acknowledged_stop (test_m1_http.HttpBoundaryTests.test_firmware_usb_context_cannot_release_without_acknowledged_stop) ... ok +test_helpers_modes_heartbeat_and_raw_transport_share_boundary (test_m1_http.HttpBoundaryTests.test_helpers_modes_heartbeat_and_raw_transport_share_boundary) ... ok +test_maintenance_persists_across_pages_and_requires_exit_then_start (test_m1_http.HttpBoundaryTests.test_maintenance_persists_across_pages_and_requires_exit_then_start) ... ok +test_matching_ack_after_deadline_is_not_success (test_m1_http.HttpBoundaryTests.test_matching_ack_after_deadline_is_not_success) ... ok +test_physical_adapter_remains_denied_even_with_page_token_and_env (test_m1_http.HttpBoundaryTests.test_physical_adapter_remains_denied_even_with_page_token_and_env) ... ok +test_serial_rejects_truthy_command_id_and_physical_object (test_m1_http.HttpBoundaryTests.test_serial_rejects_truthy_command_id_and_physical_object) ... ok + +---------------------------------------------------------------------- +Ran 12 tests in 0.207s + +OK diff --git a/docs/evidence/m8/m1-state-permissions.txt b/docs/evidence/m8/m1-state-permissions.txt new file mode 100644 index 0000000..00b3f52 --- /dev/null +++ b/docs/evidence/m8/m1-state-permissions.txt @@ -0,0 +1,27 @@ +test_acquisition_fault_requests_safe_state_immediately_without_browser (test_m1.PermissionTests.test_acquisition_fault_requests_safe_state_immediately_without_browser) ... ok +test_concurrent_confirmation_replay_dispatches_at_most_once (test_m1.PermissionTests.test_concurrent_confirmation_replay_dispatches_at_most_once) ... ok +test_confirmation_once_bound_to_payload_authority_revision_and_expiry (test_m1.PermissionTests.test_confirmation_once_bound_to_payload_authority_revision_and_expiry) ... ok +test_contradictory_stop_feedback_never_releases_update_or_renews_status (test_m1.PermissionTests.test_contradictory_stop_feedback_never_releases_update_or_renews_status) ... ok +test_duplicate_request_does_not_repeat_dispatch (test_m1.PermissionTests.test_duplicate_request_does_not_repeat_dispatch) ... ok +test_estop_latch_blocks_maintenance_test_after_signal_reset (test_m1.PermissionTests.test_estop_latch_blocks_maintenance_test_after_signal_reset) ... ok +test_failed_safe_stop_blocks_watchdog_heartbeat (test_m1.PermissionTests.test_failed_safe_stop_blocks_watchdog_heartbeat) ... ok +test_fault_committed_before_concurrent_requests_has_zero_writes (test_m1.PermissionTests.test_fault_committed_before_concurrent_requests_has_zero_writes) ... ok +test_firmware_is_review_gated_and_stop_failure_prevents_update (test_m1.PermissionTests.test_firmware_is_review_gated_and_stop_failure_prevents_update) ... ok +test_maintenance_exit_and_manual_test_never_authorize_automatic_restart (test_m1.PermissionTests.test_maintenance_exit_and_manual_test_never_authorize_automatic_restart) ... ok +test_missing_physical_and_safe_output_policies_are_denied (test_m1.PermissionTests.test_missing_physical_and_safe_output_policies_are_denied) ... ok +test_optional_storage_failure_cannot_block_control_or_grant_permission (test_m1.PermissionTests.test_optional_storage_failure_cannot_block_control_or_grant_permission) ... ok +test_policy_and_intent_validation_cannot_create_nonexpiring_or_forged_grants (test_m1.PermissionTests.test_policy_and_intent_validation_cannot_create_nonexpiring_or_forged_grants) ... ok +test_requested_ack_and_physical_outcomes_are_separate (test_m1.PermissionTests.test_requested_ack_and_physical_outcomes_are_separate) ... ok +test_status_heartbeat_preserves_pending_confirmation_and_operator_outcome (test_m1.PermissionTests.test_status_heartbeat_preserves_pending_confirmation_and_operator_outcome) ... ok +test_unauthorized_source_or_forged_intent_cannot_dispatch (test_m1.PermissionTests.test_unauthorized_source_or_forged_intent_cannot_dispatch) ... ok +test_each_sensor_failure_detected_by_two_periods (test_m1.StateAndFaultTests.test_each_sensor_failure_detected_by_two_periods) ... ok +test_each_unsafe_interlock_inhibits_and_reset_never_restarts (test_m1.StateAndFaultTests.test_each_unsafe_interlock_inhibits_and_reset_never_restarts) ... ok +test_invalid_and_future_samples_need_valid_recovery (test_m1.StateAndFaultTests.test_invalid_and_future_samples_need_valid_recovery) ... ok +test_rate_replay_adapter_fault_and_intermittency (test_m1.StateAndFaultTests.test_rate_replay_adapter_fault_and_intermittency) ... ok +test_startup_unknown_interlocks_never_normal (test_m1.StateAndFaultTests.test_startup_unknown_interlocks_never_normal) ... ok +test_warning_snapshot_isolation_and_conservative_reboot (test_m1.StateAndFaultTests.test_warning_snapshot_isolation_and_conservative_reboot) ... ok + +---------------------------------------------------------------------- +Ran 22 tests in 0.205s + +OK diff --git a/docs/evidence/m8/m2-sqlite-recovery.txt b/docs/evidence/m8/m2-sqlite-recovery.txt new file mode 100644 index 0000000..0a3fda2 --- /dev/null +++ b/docs/evidence/m8/m2-sqlite-recovery.txt @@ -0,0 +1,18 @@ +test_backup_restore_reopen_and_never_overwrite (test_m2.RepositoryTests.test_backup_restore_reopen_and_never_overwrite) ... ok +test_checkpoint_repeats_when_profile_changes_during_commit (test_m2.RepositoryTests.test_checkpoint_repeats_when_profile_changes_during_commit) ... ok +test_empty_migration_repeat_pragmas_indexes_and_explicit_seed (test_m2.RepositoryTests.test_empty_migration_repeat_pragmas_indexes_and_explicit_seed) ... ok +test_failed_restart_store_inhibits_and_safe_stop_ignores_slow_checkpoint (test_m2.RepositoryTests.test_failed_restart_store_inhibits_and_safe_stop_ignores_slow_checkpoint) ... ok +test_future_checksum_and_corruption_are_rejected (test_m2.RepositoryTests.test_future_checksum_and_corruption_are_rejected) ... ok +test_interrupted_upgrade_rolls_back_and_unknown_schema_is_not_repaired (test_m2.RepositoryTests.test_interrupted_upgrade_rolls_back_and_unknown_schema_is_not_repaired) ... ok +test_lock_failure_is_visible_and_cannot_report_success (test_m2.RepositoryTests.test_lock_failure_is_visible_and_cannot_report_success) ... ok +test_recovery_read_failure_is_visible_and_cannot_enable_start (test_m2.RepositoryTests.test_recovery_read_failure_is_visible_and_cannot_enable_start) ... ok +test_recovery_restores_intent_but_never_permission_or_old_health (test_m2.RepositoryTests.test_recovery_restores_intent_but_never_permission_or_old_health) ... ok +test_repository_reads_bounds_ack_and_parameterization (test_m2.RepositoryTests.test_repository_reads_bounds_ack_and_parameterization) ... ok +test_restart_generation_cas_rejects_stale_writer (test_m2.RepositoryTests.test_restart_generation_cas_rejects_stale_writer) ... ok +test_v1_upgrade_preserves_rows_and_verified_preupgrade_backup (test_m2.RepositoryTests.test_v1_upgrade_preserves_rows_and_verified_preupgrade_backup) ... ok +test_validation_foreign_keys_and_image_metadata (test_m2.RepositoryTests.test_validation_foreign_keys_and_image_metadata) ... ok + +---------------------------------------------------------------------- +Ran 13 tests in 27.995s + +OK diff --git a/docs/evidence/m8/m3-durable-events.txt b/docs/evidence/m8/m3-durable-events.txt new file mode 100644 index 0000000..fd47153 --- /dev/null +++ b/docs/evidence/m8/m3-durable-events.txt @@ -0,0 +1,22 @@ +test_actuator_accept_ack_failure_and_reject_are_distinct (test_m3.DurableEventTests.test_actuator_accept_ack_failure_and_reject_are_distinct) ... ok +test_concurrent_same_event_retry_has_one_durable_row (test_m3.DurableEventTests.test_concurrent_same_event_retry_has_one_durable_row) ... ok +test_concurrent_stop_revokes_start_waiting_for_latch_checkpoint (test_m3.DurableEventTests.test_concurrent_stop_revokes_start_waiting_for_latch_checkpoint) ... ok +test_event_retry_same_id_is_idempotent_and_reopen_keeps_exact_envelope (test_m3.DurableEventTests.test_event_retry_same_id_is_idempotent_and_reopen_keeps_exact_envelope) ... ok +test_existing_v2_migrates_with_backup_and_preserves_events (test_m3.DurableEventTests.test_existing_v2_migrates_with_backup_and_preserves_events) ... ok +test_explicit_sensor_snapshot_and_dictionary_conflict (test_m3.DurableEventTests.test_explicit_sensor_snapshot_and_dictionary_conflict) ... ok +test_failed_logger_retains_event_ids_then_retries_without_granting_permission (test_m3.DurableEventTests.test_failed_logger_retains_event_ids_then_retries_without_granting_permission) ... ok +test_http_reports_pending_without_legacy_duplicate_write (test_m3.DurableEventTests.test_http_reports_pending_without_legacy_duplicate_write) ... ok +test_invalid_envelopes_cannot_be_acknowledged (test_m3.DurableEventTests.test_invalid_envelopes_cannot_be_acknowledged) ... ok +test_locked_database_has_no_false_receipt_and_preserves_retry (test_m3.DurableEventTests.test_locked_database_has_no_false_receipt_and_preserves_retry) ... ok +test_maintenance_and_recovery_events_survive_reopen_without_restart (test_m3.DurableEventTests.test_maintenance_and_recovery_events_survive_reopen_without_restart) ... ok +test_poison_event_is_visible_and_does_not_prevent_valid_commits (test_m3.DurableEventTests.test_poison_event_is_visible_and_does_not_prevent_valid_commits) ... ok +test_process_loss_before_commit_is_not_claimed_as_durable (test_m3.DurableEventTests.test_process_loss_before_commit_is_not_claimed_as_durable) ... ok +test_projection_failure_rolls_back_envelope_and_retry_commits_once (test_m3.DurableEventTests.test_projection_failure_rolls_back_envelope_and_retry_commits_once) ... ok +test_queue_loss_and_unacknowledged_commit_never_show_durable (test_m3.DurableEventTests.test_queue_loss_and_unacknowledged_commit_never_show_durable) ... ok +test_sensor_fault_records_invalid_null_and_safe_state_outcomes (test_m3.DurableEventTests.test_sensor_fault_records_invalid_null_and_safe_state_outcomes) ... ok +test_slow_logger_and_concurrent_drains_do_not_block_safe_stop (test_m3.DurableEventTests.test_slow_logger_and_concurrent_drains_do_not_block_safe_stop) ... ok + +---------------------------------------------------------------------- +Ran 17 tests in 28.418s + +OK diff --git a/docs/evidence/m8/m4-grow-hmi.txt b/docs/evidence/m8/m4-grow-hmi.txt new file mode 100644 index 0000000..0193ef8 --- /dev/null +++ b/docs/evidence/m8/m4-grow-hmi.txt @@ -0,0 +1,27 @@ +test_dashboard_uses_sql_and_missing_electronics_remains_missing (test_m4.GrowHttpTests.test_dashboard_uses_sql_and_missing_electronics_remains_missing) ... ok +test_default_post_boundary_and_failed_workflow_database_are_honest (test_m4.GrowHttpTests.test_default_post_boundary_and_failed_workflow_database_are_honest) ... ok +test_highest_alarm_and_profile_settings_preserve_severity_and_maintenance (test_m4.GrowHttpTests.test_highest_alarm_and_profile_settings_preserve_severity_and_maintenance) ... ok +test_authorities_cannot_be_supplied_as_strings_or_bypass_gateway (test_m4.GrowTests.test_authorities_cannot_be_supplied_as_strings_or_bypass_gateway) ... ok +test_clock_rollback_inhibits_and_cycle_day_is_utc_calendar (test_m4.GrowTests.test_clock_rollback_inhibits_and_cycle_day_is_utc_calendar) ... ok +test_complete_preserves_history_and_allows_spearmint_selection (test_m4.GrowTests.test_complete_preserves_history_and_allows_spearmint_selection) ... ok +test_concurrent_ticks_claim_each_occurrence_once (test_m4.GrowTests.test_concurrent_ticks_claim_each_occurrence_once) ... ok +test_configuration_commit_revokes_confirmation_prepared_during_write (test_m4.GrowTests.test_configuration_commit_revokes_confirmation_prepared_during_write) ... ok +test_configuration_write_failure_and_transport_failure_inhibit (test_m4.GrowTests.test_configuration_write_failure_and_transport_failure_inhibit) ... ok +test_conflicting_invalid_schedules_are_rejected_without_writes_or_commands (test_m4.GrowTests.test_conflicting_invalid_schedules_are_rejected_without_writes_or_commands) ... ok +test_cross_midnight_light_window_and_late_pulses_have_no_catchup_burst (test_m4.GrowTests.test_cross_midnight_light_window_and_late_pulses_have_no_catchup_burst) ... ok +test_due_commands_run_once_and_events_remain_queued_until_committed (test_m4.GrowTests.test_due_commands_run_once_and_events_remain_queued_until_committed) ... ok +test_failed_claim_and_failed_outcome_do_not_retry_or_allow_running (test_m4.GrowTests.test_failed_claim_and_failed_outcome_do_not_retry_or_allow_running) ... ok +test_failed_creation_has_no_cycle_or_fabricated_success (test_m4.GrowTests.test_failed_creation_has_no_cycle_or_fabricated_success) ... ok +test_failed_cycle_write_cannot_arm_or_claim_success (test_m4.GrowTests.test_failed_cycle_write_cannot_arm_or_claim_success) ... ok +test_maintenance_exit_and_estop_reset_never_restart_schedules (test_m4.GrowTests.test_maintenance_exit_and_estop_reset_never_restart_schedules) ... ok +test_missing_stale_and_unsafe_inputs_disarm_without_energizing (test_m4.GrowTests.test_missing_stale_and_unsafe_inputs_disarm_without_energizing) ... ok +test_pause_during_slow_start_write_prevents_arm_and_dispatch (test_m4.GrowTests.test_pause_during_slow_start_write_prevents_arm_and_dispatch) ... ok +test_preloaded_profiles_and_persisted_cycle_config_are_not_agronomic_defaults (test_m4.GrowTests.test_preloaded_profiles_and_persisted_cycle_config_are_not_agronomic_defaults) ... ok +test_repeated_start_rejection_preserves_existing_schedule_arm (test_m4.GrowTests.test_repeated_start_rejection_preserves_existing_schedule_arm) ... ok +test_restart_pauses_and_restores_profile_schedules_but_no_health_or_arm (test_m4.GrowTests.test_restart_pauses_and_restores_profile_schedules_but_no_health_or_arm) ... ok +test_start_requires_backend_confirmation_and_configured_schedules (test_m4.GrowTests.test_start_requires_backend_confirmation_and_configured_schedules) ... ok + +---------------------------------------------------------------------- +Ran 22 tests in 21.175s + +OK diff --git a/docs/evidence/m8/m5-camera-ml.txt b/docs/evidence/m8/m5-camera-ml.txt new file mode 100644 index 0000000..5efe58c --- /dev/null +++ b/docs/evidence/m8/m5-camera-ml.txt @@ -0,0 +1,38 @@ +test_all_production_media_posts_and_model_paths_are_denied (test_m5.MediaHttpTests.test_all_production_media_posts_and_model_paths_are_denied) ... ok +test_media_capture_infer_view_and_metadata_flow (test_m5.MediaHttpTests.test_media_capture_infer_view_and_metadata_flow) ... ok +test_stale_camera_and_corrupt_saved_image_never_serve_placeholders (test_m5.MediaHttpTests.test_stale_camera_and_corrupt_saved_image_never_serve_placeholders) ... ok +test_capture_exact_bytes_dimensions_utc_hash_and_experiment_plant (test_m5.MediaTests.test_capture_exact_bytes_dimensions_utc_hash_and_experiment_plant) ... ok +test_capture_outbox_survives_queue_loss_and_commit_retry (test_m5.MediaTests.test_capture_outbox_survives_queue_loss_and_commit_retry) ... ok +test_claim_without_frame_is_interrupted_not_reacquired (test_m5.MediaTests.test_claim_without_frame_is_interrupted_not_reacquired) ... ok +test_clock_rollback_does_not_show_historical_image_as_zero_age_fresh (test_m5.MediaTests.test_clock_rollback_does_not_show_historical_image_as_zero_age_fresh) ... ok +test_concurrent_duplicate_capture_is_one_frame_one_image (test_m5.MediaTests.test_concurrent_duplicate_capture_is_one_frame_one_image) ... ok +test_concurrent_inference_is_single_flight (test_m5.MediaTests.test_concurrent_inference_is_single_flight) ... ok +test_corrupt_indexed_file_is_not_served_or_inferred (test_m5.MediaTests.test_corrupt_indexed_file_is_not_served_or_inferred) ... ok +test_database_claim_failure_is_traced_without_acquiring_frame (test_m5.MediaTests.test_database_claim_failure_is_traced_without_acquiring_frame) ... ok +test_default_and_physical_camera_never_activate (test_m5.MediaTests.test_default_and_physical_camera_never_activate) ... ok +test_duplicate_capture_request_does_not_acquire_or_index_twice (test_m5.MediaTests.test_duplicate_capture_request_does_not_acquire_or_index_twice) ... ok +test_failed_and_non_monotonic_results_cannot_extend_abnormal_streak (test_m5.MediaTests.test_failed_and_non_monotonic_results_cannot_extend_abnormal_streak) ... ok +test_failed_inference_breaks_reviewed_abnormal_streak (test_m5.MediaTests.test_failed_inference_breaks_reviewed_abnormal_streak) ... ok +test_final_name_collision_and_invalid_plant_do_not_overwrite (test_m5.MediaTests.test_final_name_collision_and_invalid_plant_do_not_overwrite) ... ok +test_hourly_schedule_deduplicates_and_skips_downtime_bursts (test_m5.MediaTests.test_hourly_schedule_deduplicates_and_skips_downtime_bursts) ... ok +test_inference_is_versioned_linked_and_duplicate_is_idempotent (test_m5.MediaTests.test_inference_is_versioned_linked_and_duplicate_is_idempotent) ... ok +test_inference_rollback_recovery_and_durable_outbox (test_m5.MediaTests.test_inference_rollback_recovery_and_durable_outbox) ... ok +test_interrupted_after_final_link_and_database_rollback_are_recoverable (test_m5.MediaTests.test_interrupted_after_final_link_and_database_rollback_are_recoverable) ... ok +test_interrupted_after_stage_recovers_without_acquiring_frame (test_m5.MediaTests.test_interrupted_after_stage_recovers_without_acquiring_frame) ... ok +test_invalid_scores_and_failed_adapter_report_error_without_inference (test_m5.MediaTests.test_invalid_scores_and_failed_adapter_report_error_without_inference) ... ok +test_low_confidence_and_unreviewed_classifications_are_uncertain (test_m5.MediaTests.test_low_confidence_and_unreviewed_classifications_are_uncertain) ... ok +test_manifest_hash_input_policy_and_unapproved_adapter_validation (test_m5.MediaTests.test_manifest_hash_input_policy_and_unapproved_adapter_validation) ... ok +test_orphan_files_are_reported_preserved_and_not_indexed (test_m5.MediaTests.test_orphan_files_are_reported_preserved_and_not_indexed) ... ok +test_partial_disk_write_is_preserved_and_never_finalized (test_m5.MediaTests.test_partial_disk_write_is_preserved_and_never_finalized) ... ok +test_restart_marks_running_inference_interrupted_without_rerun (test_m5.MediaTests.test_restart_marks_running_inference_interrupted_without_rerun) ... ok +test_scheduled_restart_reuses_claim_and_never_reacquires_same_slot (test_m5.MediaTests.test_scheduled_restart_reuses_claim_and_never_reacquires_same_slot) ... ok +test_single_owner_serializes_parallel_reads_and_rejects_second_owner (test_m5.MediaTests.test_single_owner_serializes_parallel_reads_and_rejects_second_owner) ... ok +test_slow_inference_times_out_late_result_cannot_commit_or_spawn_more_workers (test_m5.MediaTests.test_slow_inference_times_out_late_result_cannot_commit_or_spawn_more_workers) ... ok +test_two_consecutive_reviewed_abnormal_results_and_reset (test_m5.MediaTests.test_two_consecutive_reviewed_abnormal_results_and_reset) ... ok +test_unavailable_stale_future_corrupt_frames_do_not_become_images (test_m5.MediaTests.test_unavailable_stale_future_corrupt_frames_do_not_become_images) ... ok +test_versioned_models_can_analyze_same_image_without_combining_streaks (test_m5.MediaTests.test_versioned_models_can_analyze_same_image_without_combining_streaks) ... ok + +---------------------------------------------------------------------- +Ran 33 tests in 19.155s + +OK diff --git a/docs/evidence/m8/m5-clock-recovery.txt b/docs/evidence/m8/m5-clock-recovery.txt new file mode 100644 index 0000000..7350c62 --- /dev/null +++ b/docs/evidence/m8/m5-clock-recovery.txt @@ -0,0 +1,19 @@ +test_advancing_utc_observations_do_not_create_false_rollback (test_m5_clock.CaptureClockTests.test_advancing_utc_observations_do_not_create_false_rollback) ... ok +test_clock_guard_persistence_failure_fails_closed (test_m5_clock.CaptureClockTests.test_clock_guard_persistence_failure_fails_closed) ... ok +test_explicit_recovery_requires_high_water_and_waits_for_strict_future_slot (test_m5_clock.CaptureClockTests.test_explicit_recovery_requires_high_water_and_waits_for_strict_future_slot) ... ok +test_late_recovery_skips_expired_slot_without_catchup_burst (test_m5_clock.CaptureClockTests.test_late_recovery_skips_expired_slot_without_catchup_burst) ... ok +test_missed_slots_and_interrupted_claims_remain_terminal_after_recovery (test_m5_clock.CaptureClockTests.test_missed_slots_and_interrupted_claims_remain_terminal_after_recovery) ... ok +test_reconfiguration_and_journal_recovery_cannot_bypass_clock_latch (test_m5_clock.CaptureClockTests.test_reconfiguration_and_journal_recovery_cannot_bypass_clock_latch) ... ok +test_repeated_ack_and_reconfiguration_cannot_duplicate_recovered_slot (test_m5_clock.CaptureClockTests.test_repeated_ack_and_reconfiguration_cannot_duplicate_recovered_slot) ... ok +test_repeated_rollback_ticks_never_read_camera_or_create_new_claims (test_m5_clock.CaptureClockTests.test_repeated_rollback_ticks_never_read_camera_or_create_new_claims) ... ok +test_restart_detects_rollback_against_persisted_tick_without_previous_fault (test_m5_clock.CaptureClockTests.test_restart_detects_rollback_against_persisted_tick_without_previous_fault) ... ok +test_restart_preserves_latch_and_recovery_boundary_and_claim_identity (test_m5_clock.CaptureClockTests.test_restart_preserves_latch_and_recovery_boundary_and_claim_identity) ... ok +test_rollback_during_frame_read_cannot_index_a_wrong_slot (test_m5_clock.CaptureClockTests.test_rollback_during_frame_read_cannot_index_a_wrong_slot) ... ok +test_schema_v5_upgrade_seeds_high_water_from_all_persisted_claims (test_m5_clock.CaptureClockTests.test_schema_v5_upgrade_seeds_high_water_from_all_persisted_claims) ... ok +test_time_recovery_alone_never_clears_persisted_fault (test_m5_clock.CaptureClockTests.test_time_recovery_alone_never_clears_persisted_fault) ... ok +test_api_reports_persistent_fault_and_explicit_recovery_without_capture (test_m5_clock.ClockHttpTests.test_api_reports_persistent_fault_and_explicit_recovery_without_capture) ... ok + +---------------------------------------------------------------------- +Ran 14 tests in 13.660s + +OK diff --git a/docs/evidence/m8/m6-history-export.txt b/docs/evidence/m8/m6-history-export.txt new file mode 100644 index 0000000..98f409d --- /dev/null +++ b/docs/evidence/m8/m6-history-export.txt @@ -0,0 +1,30 @@ +test_http_bounds_restricted_exports_verified_download_and_seven_routes (test_m6.HistoryHttpTests.test_http_bounds_restricted_exports_verified_download_and_seven_routes) ... ok +test_100000_rows_index_plan_bounded_pagination_and_concurrent_writes (test_m6.HistoryTests.test_100000_rows_index_plan_bounded_pagination_and_concurrent_writes) ... ok +test_all_resources_empty_or_legacy_and_no_adapter_side_effects (test_m6.HistoryTests.test_all_resources_empty_or_legacy_and_no_adapter_side_effects) ... ok +test_archive_verifier_rejects_extra_members_and_truncated_zip (test_m6.HistoryTests.test_archive_verifier_rejects_extra_members_and_truncated_zip) ... ok +test_backup_failure_disk_full_partial_stage_and_quotas_preserve_files (test_m6.HistoryTests.test_backup_failure_disk_full_partial_stage_and_quotas_preserve_files) ... ok +test_changing_image_bytes_are_not_silently_archived (test_m6.HistoryTests.test_changing_image_bytes_are_not_silently_archived) ... ok +test_csv_utf8_formula_injection_and_raw_provenance (test_m6.HistoryTests.test_csv_utf8_formula_injection_and_raw_provenance) ... ok +test_db_failure_never_claims_persistence_and_restart_marks_interrupted (test_m6.HistoryTests.test_db_failure_never_claims_persistence_and_restart_marks_interrupted) ... ok +test_export_deadline_and_total_quota_fail_without_deletion (test_m6.HistoryTests.test_export_deadline_and_total_quota_fail_without_deletion) ... ok +test_formula_prefix_variants_and_typed_negative (test_m6.HistoryTests.test_formula_prefix_variants_and_typed_negative) ... ok +test_inference_policy_manifest_and_actuator_ack_provenance (test_m6.HistoryTests.test_inference_policy_manifest_and_actuator_ack_provenance) ... ok +test_initial_job_write_failure_and_read_failure_propagate (test_m6.HistoryTests.test_initial_job_write_failure_and_read_failure_propagate) ... ok +test_large_export_streams_100000_rows_and_exact_counts (test_m6.HistoryTests.test_large_export_streams_100000_rows_and_exact_counts) ... ok +test_literal_search_filters_unknown_experiment_and_validation (test_m6.HistoryTests.test_literal_search_filters_unknown_experiment_and_validation) ... ok +test_microsecond_order_legacy_invalid_time_and_half_open_utc (test_m6.HistoryTests.test_microsecond_order_legacy_invalid_time_and_half_open_utc) ... ok +test_missing_corrupt_images_partial_status_and_strict_failure (test_m6.HistoryTests.test_missing_corrupt_images_partial_status_and_strict_failure) ... ok +test_modified_archive_and_unsafe_path_download_denied (test_m6.HistoryTests.test_modified_archive_and_unsafe_path_download_denied) ... ok +test_pagination_equal_times_high_water_and_filter_bound_cursors (test_m6.HistoryTests.test_pagination_equal_times_high_water_and_filter_bound_cursors) ... ok +test_partial_archive_write_disk_full_is_not_downloadable (test_m6.HistoryTests.test_partial_archive_write_disk_full_is_not_downloadable) ... ok +test_same_request_concurrency_idempotency_and_content_conflict (test_m6.HistoryTests.test_same_request_concurrency_idempotency_and_content_conflict) ... ok +test_single_owner_and_busy_different_request_do_not_create_claim (test_m6.HistoryTests.test_single_owner_and_busy_different_request_do_not_create_claim) ... ok +test_snapshot_consistency_with_writer_after_backup_and_ack_update (test_m6.HistoryTests.test_snapshot_consistency_with_writer_after_backup_and_ack_update) ... ok +test_symlink_image_and_download_are_denied (test_m6.HistoryTests.test_symlink_image_and_download_are_denied) ... skipped 'Host lacks symlink privilege; POSIX CI requires this test' +test_v6_migration_preserves_history_and_verified_preupgrade_backup (test_m6.HistoryTests.test_v6_migration_preserves_history_and_verified_preupgrade_backup) ... ok +test_verified_jpeg_manifest_and_legacy_unknown_source (test_m6.HistoryTests.test_verified_jpeg_manifest_and_legacy_unknown_source) ... ok + +---------------------------------------------------------------------- +Ran 25 tests in 26.524s + +OK (skipped=1) diff --git a/docs/evidence/m8/m7-storage-backup.txt b/docs/evidence/m8/m7-storage-backup.txt new file mode 100644 index 0000000..a758c14 --- /dev/null +++ b/docs/evidence/m8/m7-storage-backup.txt @@ -0,0 +1,27 @@ +test_host_boundary_inventory_jobs_verify_restore_and_download (test_m7.StorageHttpTests.test_host_boundary_inventory_jobs_verify_restore_and_download) ... ok +test_archive_traversal_absolute_reserved_case_and_zip_symlinks_denied (test_m7.StorageTests.test_archive_traversal_absolute_reserved_case_and_zip_symlinks_denied) ... ok +test_complete_backup_manifest_database_and_jpeg_integrity (test_m7.StorageTests.test_complete_backup_manifest_database_and_jpeg_integrity) ... ok +test_corrupt_image_and_changed_image_cannot_make_usable_backup (test_m7.StorageTests.test_corrupt_image_and_changed_image_cannot_make_usable_backup) ... ok +test_corrupted_archive_hash_verify_and_restore_refuse (test_m7.StorageTests.test_corrupted_archive_hash_verify_and_restore_refuse) ... ok +test_disk_full_quota_deadline_and_partial_backup_never_delete (test_m7.StorageTests.test_disk_full_quota_deadline_and_partial_backup_never_delete) ... ok +test_export_and_backup_are_independent_and_gateway_is_not_locked (test_m7.StorageTests.test_export_and_backup_are_independent_and_gateway_is_not_locked) ... ok +test_idempotent_concurrent_requests_and_single_owner (test_m7.StorageTests.test_idempotent_concurrent_requests_and_single_owner) ... ok +test_insufficient_restore_space_fails_before_offline_copy (test_m7.StorageTests.test_insufficient_restore_space_fails_before_offline_copy) ... ok +test_inventory_reports_failed_database_reads_without_fabricated_estimate (test_m7.StorageTests.test_inventory_reports_failed_database_reads_without_fabricated_estimate) ... ok +test_isolated_restore_preserves_live_database_images_and_permissions (test_m7.StorageTests.test_isolated_restore_preserves_live_database_images_and_permissions) ... ok +test_live_writes_after_snapshot_never_enter_backup_or_restore (test_m7.StorageTests.test_live_writes_after_snapshot_never_enter_backup_or_restore) ... ok +test_missing_image_backup_is_explicitly_incomplete_and_not_downloadable (test_m7.StorageTests.test_missing_image_backup_is_explicitly_incomplete_and_not_downloadable) ... ok +test_observed_inventory_estimate_capacity_and_no_camera_reads (test_m7.StorageTests.test_observed_inventory_estimate_capacity_and_no_camera_reads) ... ok +test_partial_archive_write_and_restore_failure_are_retained (test_m7.StorageTests.test_partial_archive_write_and_restore_failure_are_retained) ... ok +test_power_loss_after_publication_before_receipt_is_interrupted_on_restart (test_m7.StorageTests.test_power_loss_after_publication_before_receipt_is_interrupted_on_restart) ... ok +test_preexisting_restore_files_never_overwritten (test_m7.StorageTests.test_preexisting_restore_files_never_overwritten) ... ok +test_restore_power_loss_after_copy_before_receipt_does_not_adopt_files (test_m7.StorageTests.test_restore_power_loss_after_copy_before_receipt_does_not_adopt_files) ... ok +test_schema_mismatch_schema_drift_fk_corruption_and_missing_db (test_m7.StorageTests.test_schema_mismatch_schema_drift_fk_corruption_and_missing_db) ... ok +test_symlink_source_and_restore_root_are_rejected (test_m7.StorageTests.test_symlink_source_and_restore_root_are_rejected) ... skipped 'Windows symlink privilege unavailable; POSIX CI must pass' +test_unexpected_missing_and_inconsistent_members_are_rejected (test_m7.StorageTests.test_unexpected_missing_and_inconsistent_members_are_rejected) ... ok +test_v7_upgrade_backup_preserves_records_and_validates_current_schema (test_m7.StorageTests.test_v7_upgrade_backup_preserves_records_and_validates_current_schema) ... ok + +---------------------------------------------------------------------- +Ran 22 tests in 18.086s + +OK (skipped=1) diff --git a/docs/evidence/m8/m8-offline-usability.txt b/docs/evidence/m8/m8-offline-usability.txt new file mode 100644 index 0000000..bde5147 --- /dev/null +++ b/docs/evidence/m8/m8-offline-usability.txt @@ -0,0 +1,27 @@ +test_seven_screens_local_assets_headers_status_recovery_and_production_denial (test_m8.LifecycleHttpTests.test_seven_screens_local_assets_headers_status_recovery_and_production_denial) ... ok +test_blocked_worker_prevents_release_and_duplicate_recovery (test_m8.LifecycleTests.test_blocked_worker_prevents_release_and_duplicate_recovery) ... ok +test_camera_schedule_restart_hold_preserves_claims_and_generation (test_m8.LifecycleTests.test_camera_schedule_restart_hold_preserves_claims_and_generation) ... ok +test_corrupt_existing_database_is_not_repaired_or_replaced (test_m8.LifecycleTests.test_corrupt_existing_database_is_not_repaired_or_replaced) ... ok +test_current_synthetic_samples_expire_instead_of_becoming_real_values (test_m8.LifecycleTests.test_current_synthetic_samples_expire_instead_of_becoming_real_values) ... ok +test_database_failure_never_auto_heals_or_grants_permission (test_m8.LifecycleTests.test_database_failure_never_auto_heals_or_grants_permission) ... ok +test_detected_worker_exit_latches_recovery_inhibit (test_m8.LifecycleTests.test_detected_worker_exit_latches_recovery_inhibit) ... ok +test_duplicate_instance_and_duplicate_start_do_not_duplicate_workers (test_m8.LifecycleTests.test_duplicate_instance_and_duplicate_start_do_not_duplicate_workers) ... ok +test_gateway_and_model_owners_cannot_be_reused_across_restart (test_m8.LifecycleTests.test_gateway_and_model_owners_cannot_be_reused_across_restart) ... ok +test_inflight_mutation_lease_blocks_shutdown_until_teardown (test_m8.LifecycleTests.test_inflight_mutation_lease_blocks_shutdown_until_teardown) ... ok +test_logging_failure_isolated_and_requires_explicit_recovery (test_m8.LifecycleTests.test_logging_failure_isolated_and_requires_explicit_recovery) ... ok +test_missing_database_is_never_recreated_after_initialized_workspace (test_m8.LifecycleTests.test_missing_database_is_never_recreated_after_initialized_workspace) ... ok +test_no_outgoing_internet_connections_for_start_tick_or_snapshot (test_m8.LifecycleTests.test_no_outgoing_internet_connections_for_start_tick_or_snapshot) ... ok +test_non_synthetic_adapter_or_camera_rejected_without_dispatch (test_m8.LifecycleTests.test_non_synthetic_adapter_or_camera_rejected_without_dispatch) ... ok +test_optional_synthetic_camera_no_model_honestly_degraded (test_m8.LifecycleTests.test_optional_synthetic_camera_no_model_honestly_degraded) ... ok +test_repeated_restarts_preserve_history_and_never_permissions (test_m8.LifecycleTests.test_repeated_restarts_preserve_history_and_never_permissions) ... ok +test_required_synthetic_sensor_provider_rejects_untrusted_callback (test_m8.LifecycleTests.test_required_synthetic_sensor_provider_rejects_untrusted_callback) ... ok +test_restart_recovers_interrupted_artifact_receipts_without_execution (test_m8.LifecycleTests.test_restart_recovers_interrupted_artifact_receipts_without_execution) ... ok +test_running_export_blocks_shutdown_and_new_workspace_owner (test_m8.LifecycleTests.test_running_export_blocks_shutdown_and_new_workspace_owner) ... ok +test_stale_worker_heartbeat_fails_closed (test_m8.LifecycleTests.test_stale_worker_heartbeat_fails_closed) ... ok +test_startup_dependency_order_restricted_defaults_and_shutdown (test_m8.LifecycleTests.test_startup_dependency_order_restricted_defaults_and_shutdown) ... ok +test_unmarked_existing_database_is_not_adopted_or_overwritten (test_m8.LifecycleTests.test_unmarked_existing_database_is_not_adopted_or_overwritten) ... ok + +---------------------------------------------------------------------- +Ran 22 tests in 23.223s + +OK diff --git a/docs/evidence/m8/offline-javascript-parse.txt b/docs/evidence/m8/offline-javascript-parse.txt new file mode 100644 index 0000000..e69de29 diff --git a/docs/evidence/m8/phase0-contracts.txt b/docs/evidence/m8/phase0-contracts.txt new file mode 100644 index 0000000..e9550e0 --- /dev/null +++ b/docs/evidence/m8/phase0-contracts.txt @@ -0,0 +1,29 @@ +test_acknowledgement_does_not_call_condition_clear (test_phase0.APIContractTests.test_acknowledgement_does_not_call_condition_clear) ... ok +test_all_documented_paths_have_matching_methods (test_phase0.APIContractTests.test_all_documented_paths_have_matching_methods) ... ok +test_capture_index_and_disk_failure (test_phase0.APIContractTests.test_capture_index_and_disk_failure) ... ok +test_control_log_failure_keeps_ack_and_emits_diagnostic (test_phase0.APIContractTests.test_control_log_failure_keeps_ack_and_emits_diagnostic) ... ok +test_disconnected_controller_returns_503 (test_phase0.APIContractTests.test_disconnected_controller_returns_503) ... ok +test_ml_and_alert_exceptions_stay_explicit (test_phase0.APIContractTests.test_ml_and_alert_exceptions_stay_explicit) ... ok +test_offline_pages_and_unavailable_data (test_phase0.APIContractTests.test_offline_pages_and_unavailable_data) ... ok +test_safe_off_examples_keep_physical_state_unverified (test_phase0.APIContractTests.test_safe_off_examples_keep_physical_state_unverified) ... ok +test_capture_hash_and_module_restart_recovery (test_phase0.CameraAndPlaceholderTests.test_capture_hash_and_module_restart_recovery) ... ok +test_unavailable_adapters_never_claim_durability_or_model (test_phase0.CameraAndPlaceholderTests.test_unavailable_adapters_never_claim_durability_or_model) ... ok +test_fixtures_record_observed_quality_and_known_gaps (test_phase0.SensorTests.test_fixtures_record_observed_quality_and_known_gaps) ... ok +test_uninstalled_values_are_explicit (test_phase0.SensorTests.test_uninstalled_values_are_explicit) ... ok +test_expiry_and_copy (test_phase0.SerialContractTests.test_expiry_and_copy) ... ok +test_invalid_packets_and_overflow_are_rejected (test_phase0.SerialContractTests.test_invalid_packets_and_overflow_are_rejected) ... ok +test_matched_ack_and_error_reply (test_phase0.SerialContractTests.test_matched_ack_and_error_reply) ... ok +test_newline_injection_never_opens_port (test_phase0.SerialContractTests.test_newline_injection_never_opens_port) ... ok +test_no_ack_timeout_invalidates_report (test_phase0.SerialContractTests.test_no_ack_timeout_invalidates_report) ... ok +test_partial_and_malformed_frames (test_phase0.SerialContractTests.test_partial_and_malformed_frames) ... ok +test_ack_does_not_clear_and_restart_restore_retains_records (test_phase0.StorageFixtureTests.test_ack_does_not_clear_and_restart_restore_retains_records) ... ok +test_fk_quality_and_event_deduplication (test_phase0.StorageFixtureTests.test_fk_quality_and_event_deduplication) ... ok +test_jpeg_and_inference_linkage (test_phase0.StorageFixtureTests.test_jpeg_and_inference_linkage) ... ok +test_sample_builder_refuses_overwrite_and_contains_all_entities (test_phase0.StorageFixtureTests.test_sample_builder_refuses_overwrite_and_contains_all_entities) ... ok +test_schema_settings_integrity_and_all_entities (test_phase0.StorageFixtureTests.test_schema_settings_integrity_and_all_entities) ... ok +test_wal_reader_during_uncommitted_write (test_phase0.StorageFixtureTests.test_wal_reader_during_uncommitted_write) ... ok + +---------------------------------------------------------------------- +Ran 24 tests in 1.187s + +OK diff --git a/docs/evidence/m8/preserved-root-app.txt b/docs/evidence/m8/preserved-root-app.txt new file mode 100644 index 0000000..61e234e --- /dev/null +++ b/docs/evidence/m8/preserved-root-app.txt @@ -0,0 +1,14 @@ +test_compile_failure_does_not_flash_or_disconnect (test_hmi.HMITest.test_compile_failure_does_not_flash_or_disconnect) ... ok +test_connect (test_hmi.HMITest.test_connect) ... ok +test_control_serial_commands (test_hmi.HMITest.test_control_serial_commands) ... ok +test_custom_upload_is_not_executed_as_host_script (test_hmi.HMITest.test_custom_upload_is_not_executed_as_host_script) ... ok +test_flash_success_without_protocol_is_reported (test_hmi.HMITest.test_flash_success_without_protocol_is_reported) ... ok +test_invalid_controls_never_reach_device (test_hmi.HMITest.test_invalid_controls_never_reach_device) ... ok +test_upload_compiles_then_releases_port_and_flashes (test_hmi.HMITest.test_upload_compiles_then_releases_port_and_flashes) ... ok +test_write_requires_page_token (test_hmi.HMITest.test_write_requires_page_token) ... ok +test_fragmented_response_and_write (test_hmi.SerialTest.test_fragmented_response_and_write) ... ok + +---------------------------------------------------------------------- +Ran 9 tests in 0.206s + +OK diff --git a/docs/evidence/m8/storage-javascript-parse.txt b/docs/evidence/m8/storage-javascript-parse.txt new file mode 100644 index 0000000..e69de29 diff --git a/docs/phase0/API_ENDPOINTS.json b/docs/phase0/API_ENDPOINTS.json index e0c2e37..3917b94 100644 --- a/docs/phase0/API_ENDPOINTS.json +++ b/docs/phase0/API_ENDPOINTS.json @@ -430,5 +430,23 @@ "errors": "400 incomplete/corrupt/non-backup; 404 unknown; 503 file/storage unavailable", "producer": "M7 storage blueprint/shared retained artifact jobs; unchanged POST boundary", "consumer": "Settings HMI / host tests" + }, + { + "path": "/api/services", + "method": "GET", + "request": "No mutation; configured synthetic host only", + "success": "200 observed dependency/worker/readiness/restart states; no permissions restored", + "errors": "503 unconfigured/status unavailable", + "producer": "M8 local lifecycle blueprint; existing mutation boundary", + "consumer": "Seven-screen local service status / host tests" + }, + { + "path": "/api/services/recover", + "method": "POST", + "request": "{} only; trusted host/token; no paths/configuration/permission flags", + "success": "200 recovered core services with restart required and schedules unarmed; optional missing adapters explicit", + "errors": "400 invalid body; 403 boundary/token; 503 busy/failed recovery", + "producer": "M8 local lifecycle blueprint; existing mutation boundary", + "consumer": "Seven-screen local service status / host tests" } ] diff --git a/docs/phase0/HMI_API_CHECKLIST.json b/docs/phase0/HMI_API_CHECKLIST.json index 6a29608..1d64993 100644 --- a/docs/phase0/HMI_API_CHECKLIST.json +++ b/docs/phase0/HMI_API_CHECKLIST.json @@ -1,5 +1,5 @@ { - "version": "m7-host-review-1", + "version": "m8-host-review-1", "requirements_baseline": "REQUIREMENTS_BASELINE.json", "endpoint_catalog": "API_ENDPOINTS.json", "note": "Current fields/routes are observed; null backend/command is an explicit missing contract, not an invented endpoint. Acceptance cases are planned unless evidence explicitly records execution. Hardware confirmation pending.", @@ -1036,6 +1036,28 @@ "gap": "Host implemented; retention/security/physical/off-device/target recovery approval unresolved", "owner": "HMI with backend contract review", "evidence": "M7 storage host and Chromium evidence: docs/evidence/m7/" + }, + { + "id": "U01", + "screen": "Shared", + "source": "Tasks 125/132; SR-UI-02; SR-AUT-02", + "display": "Offline connection, host service health and explicit recovery", + "backend": { + "path": "/api/services", + "method": "GET", + "field": "dependency states/readiness/restart/worker health" + }, + "quality": "No cached permissions or offline command replay; unavailable/stale data explicit", + "command": { + "path": "/api/services/recover", + "method": "POST" + }, + "confirmation": "explicit recovery confirmation; schedules remain inhibited", + "acceptance_case": "All seven screens with external requests blocked; keyboard/focus/touch; localhost loss/reconnect; worker/DB crash recovery without permissions", + "status": "Partial", + "gap": "Host-only scripted usability; novice/target/security/physical acceptance unresolved", + "owner": "Backend/API + HMI review", + "evidence": "M8 lifecycle/offline/Chromium evidence: docs/evidence/m8/" } ] } diff --git a/docs/phase0/HMI_API_CHECKLIST.md b/docs/phase0/HMI_API_CHECKLIST.md index ec96978..f47917d 100644 --- a/docs/phase0/HMI_API_CHECKLIST.md +++ b/docs/phase0/HMI_API_CHECKLIST.md @@ -1,6 +1,6 @@ # Task 128 seven-screen HMI/API checklist -Version `m7-host-review-1`; 52 rows. Structured authority: [HMI_API_CHECKLIST.json](HMI_API_CHECKLIST.json); routes/errors: [API_ENDPOINTS.json](API_ENDPOINTS.json). M0 accepted scope remains the [recorded verdict](M0_REVIEW_VERDICT.md). Current host implementation/evidence: [M1 guide](M1_IMPLEMENTATION.md). +Version `m8-host-review-1`; 53 rows. Structured authority: [HMI_API_CHECKLIST.json](HMI_API_CHECKLIST.json); routes/errors: [API_ENDPOINTS.json](API_ENDPOINTS.json). M0 accepted scope remains the [recorded verdict](M0_REVIEW_VERDICT.md). Current host implementation/evidence: [M1 guide](M1_IMPLEMENTATION.md). Product and physical acceptance remain partial/missing as recorded below. Synthetic test success does not establish physical behavior or measured two-second UI acceptance. Null backend fields are explicit gaps. @@ -58,5 +58,6 @@ Product and physical acceptance remain partial/missing as recorded below. Synthe | P07 | Plant | SR-ML-01/03 | Capture journal and orphan recovery | GET /api/media: camera / ml / recent / requests | Partial: Host camera/ML contract implemented; physical camera and validated plant model remain unapproved | Repeat rollback ticks/restart; journal recovery cannot clear fault; UTC recovery + explicit ack waits for future slot; persisted claims retained | | T04 | Trends | SR-DAT-02; SO-5 AC-2 | Interrupted/failed export recovery | GET /api/exports/: durable job status and attempt | Partial: Host-only recovery; target power-cut/product acceptance unresolved | Restart marks incomplete receipts interrupted; retry preserves old files; at most three attempts | | S06 | Settings | SO-5 AC-2/3/4; SR-DAT-02 | Interrupted storage job recovery | GET /api/storage/jobs/: durable receipt and recovery report | Partial: Host implemented; retention/security/physical/off-device/target recovery approval unresolved | Power loss before receipt; restart marks interrupted; retry retains prior paths; max three attempts | +| U01 | Shared | Tasks 125/132; SR-UI-02; SR-AUT-02 | Offline connection, host service health and explicit recovery | GET /api/services: dependency states/readiness/restart/worker health | Partial: Host-only scripted usability; novice/target/security/physical acceptance unresolved | All seven screens with external requests blocked; keyboard/focus/touch; localhost loss/reconnect; worker/DB crash recovery without permissions | Confirmation, quality, evidence and review ownership for each row are retained in the structured JSON. Hardware dependencies, durable restart/logging and unresolved requirements remain open in the M1 guide. diff --git a/docs/phase0/M7_REVIEW_VERDICT.md b/docs/phase0/M7_REVIEW_VERDICT.md new file mode 100644 index 0000000..c5766f3 --- /dev/null +++ b/docs/phase0/M7_REVIEW_VERDICT.md @@ -0,0 +1,9 @@ +# M7 review — accepted with restrictions + +Recorded 2026-11-16 (America/Chicago). User accepted GERM PR #12 at `55d69c558f5c134540299128aa23f4415550f9fa`: **ACCEPTED WITH RESTRICTIONS — HOST-ONLY**. Task 124 observed storage inventory, verified backups, strict preflight, isolated offline restore and interruption/retry satisfy the host scope. [M7 evidence](../evidence/m7/README.md), tested implementation `2a593390b8d746b078ed44a84e9b4e43fb317f53`; final PR CI [43894299238](https://github.com/turtle-robotics/GERM/actions/runs/43894299238) and push [43894285815](https://github.com/turtle-robotics/GERM/actions/runs/43894285815). + +Retain the [M7 limits](M7_IMPLEMENTATION.md): current-schema offline copies only, no runtime adoption/permissions, logical versus physical size distinction, resource quotas, same-volume/off-device limitations and simulated versus actual power loss. The [retention proposal](RETENTION_POLICY_PROPOSAL.md) remains unapproved; M7 acceptance does not authorize deletion. + +M8 Tasks 125/132 offline operation and usability are authorized on a separate branch directly above this reviewed head, with its own PR targeting `codex/m7-storage-backup`. Host coding and synthetic tests may proceed; return for M8 review before M9. Preserve the unmerged #5–#12 → M8 stack, M1 architecture, M2–M7 contracts, all prior tests, 15 original hashes and untracked work. + +No Pi deployment/system service installation, real sensors/camera/actuators/models, firmware, physical safety claims, production POST enablement, new network exposure, historical deletion/retention enforcement, PR merges or Gantt changes. Electrical/sensor/crop approval, authentication/network/security, controlled requirements release, retention, real camera/model and target performance/power-loss/usability gates stay open. diff --git a/docs/phase0/M8_HOST_OPERATION.md b/docs/phase0/M8_HOST_OPERATION.md new file mode 100644 index 0000000..17e3e3f --- /dev/null +++ b/docs/phase0/M8_HOST_OPERATION.md @@ -0,0 +1,24 @@ +# M8 synthetic offline host operating instructions + +These commands run a local host simulation, not the Pi or production services. Install the repository's pinned host dependencies in the existing virtual environment first; offline installation requires previously available local packages. No runtime internet access or model download is required. Do not point the launcher at deployed data or copy over a live DB/image directory. + +From the repository root, initialize a **new** disposable host workspace: + +```powershell +New-Item -ItemType Directory -Force build/offline-demo +.venv/Scripts/python.exe pi_hmi/offline_host.py --workspace build/offline-demo --create --port 5055 +``` + +Open `http://127.0.0.1:5055`. The seven screens use local assets. The built-in adapter only acknowledges synthetic STATUS/OFF; sensors, physical camera/model and crop timing approvals are absent. The CLI deliberately leaves the POST authorizer unset: it does not enable command, export, backup or recovery POSTs. Trusted test harnesses explicitly provide their synthetic input/authorizer; no CLI/env/browser option turns those tests into production controls. + +For a later run use the same command without `--create`. Startup remains inhibited and no schedule resumes automatically. `--create` cannot recreate a missing marked database or adopt a pre-existing unmarked database. An unavailable/corrupt database needs a separately reviewed repair/restore procedure into a new offline location; do not delete/rewrite it or remove the marker to suppress the fault. Existing M7 restores remain isolated copies and are never auto-adopted. + +The collapsed service summary shows local connection and host readiness. Expand it for dependencies and recovery guidance. Internet loss should not affect the loopback HMI. If the browser cannot reach this local server, values/permission status become unknown, commands are not queued, and reconnect only refreshes state. A missing camera/model/sensor is not evidence of healthy data. Historical exports/results remain historical, not current measurements. + +In an explicitly authorized synthetic harness, **Recover host services** stops/quiesces old owners and rebuilds dependencies. If a worker/request/export/backup/inference is still active, recovery refuses rather than creating a duplicate worker. Wait for the existing job to finish and inspect its durable receipt. After recovery, recheck fresh inputs; grow schedules require a separate confirmed Start, camera scheduling requires explicit reconfiguration and the existing M5 clock recovery rule still applies. Never use an old confirmation/status as permission. + +Before Ctrl+C, let exports/backups/inference finish. Shutdown inhibits first and requests STOP only through M1, then releases idle owners. A forced process exit can leave incomplete stages/running receipts; the next startup reports them interrupted and does not replay them. Retry only explicitly using the existing M6/M7 interfaces, which preserve previous attempts. Do not clear quotas by deleting historical data; the retention proposal is still awaiting approval. + +For keyboard use, Tab to the visible skip link and Enter to focus page content. Navigation identifies the current page; controls show a visible focus outline. Command dialogs initially focus Cancel; Escape cancels. Scroll each screen for all controls at 739×447. Scripted checks do not replace target/human accessibility and usability acceptance. + +Run the complete host campaign with `python pi_hmi/tests/run_host_checks.py --root-app --output build/m8-evidence`; run the six M1/M4/M5/M6/M7/M8 Chromium flows as in CI. No firmware flashing, hardware access, production installation/deployment, history deletion, PR merging or Gantt updates is part of this procedure. diff --git a/docs/phase0/M8_IMPLEMENTATION.md b/docs/phase0/M8_IMPLEMENTATION.md new file mode 100644 index 0000000..3299e41 --- /dev/null +++ b/docs/phase0/M8_IMPLEMENTATION.md @@ -0,0 +1,40 @@ +# M8 — Tasks 125 and 132 offline host operation and usability + +2026-11-16. Authorized by the [M7 host verdict](M7_REVIEW_VERDICT.md), reviewed `55d69c558f5c134540299128aa23f4415550f9fa`. Branch `codex/m8-offline-usability` targets `codex/m7-storage-backup`; previous PRs remain unmerged. No M9 implementation is authorized. Requirements remain `M0-provisional-2026-11-15`, controlled release unresolved. + +## Offline service graph and conservative lifecycle + +`HostLifecycle` explicitly owns one marked host workspace and one core worker, with an OS file lease. Default application import still starts no hardware, workers or configured data services. The optional `offline_host.py` launcher binds only `127.0.0.1`, has no host/network exposure option, uses a pure synthetic STATUS/OFF adapter, no sensor provider, no camera or model and leaves the POST authorizer unset. No environment/HTTP flag can select physical interfaces. The earlier unmanaged `start_simulation_workers` entry point now refuses operation rather than creating unowned acquisition loops. M1 gateway/permission code is unchanged. + +Startup order is explicit: synthetic gateway → verified M2 SQLite repository → M2/M4 restart/grow recovery → initial M3 durable logging → explicit synthetic sensor provider state → injectable M5 camera/local-ML adapters and journal recovery → M6 history/export → M7 backup → owned worker. HMI rendering is independent and can explain missing/degraded dependencies. The default synthetic adapter never emulates an energizing command; only STATUS/OFF acknowledgement is available. Trusted tests may inject separately labelled synthetic adapters/providers. Gateway reuse across startups and ML service reuse with an old capture owner are refused. Camera and ML retain their existing synthetic/local manifest contracts; no models are downloaded or inferred healthy by default. Missing sensors/camera/model remain unavailable/degraded, never fabricated measurements. + +Initialization requires an explicit new workspace with `HOST_SIMULATION.json`; an unmarked pre-existing DB is never adopted or overwritten. Once marked, a missing/corrupt DB causes degraded recovery and is never silently recreated, even if the first launch used `--create`. The lifecycle keeps its lease through failed startup until explicit stop/recovery. Duplicate instances/starts fail; a worker with stale heartbeat or an observed exit causes a latched service fault and gateway inhibition. Readiness is distinct from lifecycle `running`: optional adapters and required input gaps can make readiness degraded while local history/HMI still work. + +Startup/recovery creates a fresh gateway, discards confirmations/authority objects/old sensor health and preserves M2 durable profile/maintenance/E-stop restrictions. M4 recovery pauses any previously running cycle, clears armed/grant state and requires a separate confirmed Start with current inputs. M5 persisted capture schedules keep generation/anchor/claims/clock guards but acquire an additional host restart hold. Only explicit capture reconfiguration after startup can lift that hold; M5 future-boundary/clock-fault checks still apply. Automatic catch-up or resumption is not introduced. The worker may tick an actuator schedule only after an explicit M4 arm and current M1 permissions; every actual command still passes the existing gateway. No scheduler path reaches an adapter directly. + +The owned worker checks the DB, checkpoints/drains M3, obtains only explicit synthetic input samples, polls synthetic controller STATUS through M1 and runs permitted scheduling/outbox work. A required DB/logging/worker failure latches degraded state, invalidates startup/confirmations and requests STOP through the gateway; it never retries itself into permission. Optional camera/model failures stay explicit and cannot diagnose a plant. Host recovery POST accepts only `{}` and reuses the existing simulation/authorizer/token restriction. It does not accept paths, permission flags, production settings or adapter selections. + +Shutdown first inhibits/revokes and requests central STOP, then stops the core worker and waits for request/job/media quiescence. Data-mutating HTTP requests hold a lifecycle lease; while recovering/stopped, new data mutations are refused. Actuator/STOP/confirmation paths retain M1's boundary rather than being wrapped in a new dispatcher. Busy requests, inference/capture workers, exports or backups keep ownership and produce an explicit shutdown-waiting state; another runtime cannot start over them. Completed resources close in reverse order and configured services detach. Clean logging flush can fail and remains queued/error under M3; no unconditional persistence claim is added. Actual process death leaves M6/M7 running receipts for existing interrupted-on-startup recovery; files alone do not confer completion or runtime activation. + +## Offline HMI and usability + +All seven screens and prior navigation remain. Assets are same-origin files; CSP restricts connect/font/script/image origins to local resources (legacy inline script/style allowance is retained, not claimed as security certification). API responses are no-store. Runtime does not need internet, a cloud API, CDN, DNS or remote inference after dependencies are locally installed. No service worker or health/permission cache is added. Local Flask/loopback availability is still required to load pages: loss of that connection is distinct from loss of internet. Browser tests block every external origin and still exercise every screen; a separate full browser transport-loss simulation proves current status becomes unknown, commands disable and reconnect never replays POSTs. + +The local service summary and optional details expose running/recovering/degraded/unavailable/stopped dependencies, current adapter/worker health and recovery guidance. Missing runtime is labelled unconfigured, not healthy. Sensor/camera freshness remains M1/M5-authoritative; stale camera images are hidden and no placeholder is substituted. A failed state poll clears the cached client permission/status reference and hides the camera. Recovery confirmation explicitly says permissions are discarded and schedules require separate action. Safe Stop/actuator requests retain their original server behavior. + +Usability changes add a keyboard skip link, main focus target, current-page indication, visible focus, Cancel-focused/described command dialog with Escape cancellation, larger controls/touch targets, readable text, wrapping toolbars and scrollable content at 739×447. No claim of full accessibility conformance or novice acceptance follows from scripts. Recovery/status details are collapsible so established workflows and all seven screens remain available. Native browser confirmations retain keyboard handling. Error/loading/empty states remain explicit, and durable versus queued records are unchanged. + +## Tests and limits + +New host tests cover dependency order, no outgoing sockets/HTTP during runtime, marked/unmarked/missing/corrupt DB handling, duplicate owners/workers, detected/stale worker failure, blocked worker/request/job shutdown, logging/DB failures, current-to-stale synthetic inputs, missing camera/model, repeated restart/history/authority preservation, camera schedule restart holds, interrupted job receipts and production denial. Browser tests cover all seven screens with external origins blocked, local assets/CSP, no horizontal overflow, keyboard focus/navigation, Cancel/Escape without dispatch, touch size, local connection loss, no POST replay, explicit DB/core-worker recovery, paused/unarmed restart and stale images. Existing C++ and M1/M4/M5/M6/M7 suites remain required. [Evidence](../evidence/m8/README.md) records exact SHA, commands, dependencies, source/log hashes, CI and screenshots. + +Open limits: Flask singleton/global injection is a single-host application, not a multi-tenant server or production authentication boundary. Read-only status observes worker health; host/Python hangs can delay watchdog processing, so no real-time or physical safety deadline is claimed. Some filesystem/SQLite/inference calls cannot be preempted; blocked owners remain held until completion/process exit. Sensor/adapter factories and authorizer are trusted Python code, not an untrusted plug-in sandbox. Installation/wheel/browser availability and target OS/system services are separate deployment gates. Offline browser shell caching, unattended recovery, physical interfaces, external model validation and automatic retention are not implemented. The proposed retention policy remains unapproved and no historical deletion occurs. + +| Requirement | Implementation / evidence | +| --- | --- | +| Task 125; SR-DAT-01 local/offline operation | Explicit local service graph, loopback launcher, no internet sockets; all seven screens with blocked external origins | +| Task 132; SR-UI-02 | Keyboard/focus/touch/layout/status/dialog improvements; 739×447 Chromium workflows; human usability remains open | +| SR-AUT-02 / M1 permission architecture | Fresh inhibited restart, paused cycles, discarded confirmations/input health, no automatic schedules; faults never grant permission | +| SR-DAT-02/03 / M2–M7 provenance | Reused persistence/journals/receipts, interrupted jobs, no deletion; schema/storage/retention restrictions unchanged | + +No Pi deployment, production service installation, hardware, firmware, real model/camera, production POST enabling, new network exposure, historical deletion, merges or Gantt updates. All 15 original hashes and untracked work remain preserved. Electrical/sensor/crop, production authentication/network/security, controlled requirements release, retention, target power-loss/performance and novice usability remain unresolved. diff --git a/docs/phase0/README.md b/docs/phase0/README.md index 141e40a..d8bcd88 100644 --- a/docs/phase0/README.md +++ b/docs/phase0/README.md @@ -1,6 +1,6 @@ # Phase 0 baseline and review package -Current gate: [M6 accepted with host-only restrictions](M6_REVIEW_VERDICT.md). [M7 Task 124 implementation](M7_IMPLEMENTATION.md) and [retention proposal](RETENTION_POLICY_PROPOSAL.md) await review. Physical interfaces, production controls, deletion, deployment and merging remain restricted; M8 is not authorized. +Current gate: [M7 accepted with host-only restrictions](M7_REVIEW_VERDICT.md). [M8 offline/usability implementation](M8_IMPLEMENTATION.md) and [host operating instructions](M8_HOST_OPERATION.md) await review. Physical interfaces, production controls, deletion, deployment and merging remain restricted; M9 is not authorized. The retention proposal remains unapproved. Current M5 host review: [Task 123 implementation](M5_IMPLEMENTATION.md), [model/camera dependency register](M5_DEPENDENCIES.md), above [M4 accepted with restrictions](M4_REVIEW_VERDICT.md). No physical camera/model validation, merge, deployment or M6 approval is implied. diff --git a/pi_hmi/app.py b/pi_hmi/app.py index ca0cc0a..1ad62fa 100644 --- a/pi_hmi/app.py +++ b/pi_hmi/app.py @@ -13,6 +13,7 @@ from services.database_service import repository from services.history_http import history_routes from services.storage_http import storage_routes +from services.lifecycle_http import lifecycle_routes app = Flask(__name__) app.config.update(GERM_CONTROL_AUTHORIZER=None, GERM_SIMULATION=False, MAX_CONTENT_LENGTH=1024 * 1024) @@ -20,6 +21,7 @@ cam = None app.register_blueprint(history_routes) app.register_blueprint(storage_routes) +app.register_blueprint(lifecycle_routes) @app.errorhandler(413) @@ -48,6 +50,25 @@ def restrict_mutations(): if not secrets.compare_digest(request.headers.get('X-GERM-Token', ''), control_token): return jsonify(status='restricted', error='Reload the local HMI before requesting a command'), 403 g.control_authority = get_gateway().operator_authority + runtime=app.config.get('GERM_HOST_LIFECYCLE') + data_paths=('/api/camera/','/api/media/','/api/ml/','/api/grow/','/api/exports','/api/storage/') + if runtime and request.path.startswith(data_paths): + if not runtime.begin_data_request():return jsonify(error='Host services are recovering/stopped; no data mutation started'),503 + g.host_data_lease=runtime + + +@app.teardown_request +def release_host_request(error=None): + runtime=getattr(g,'host_data_lease',None) + if runtime: + g.host_data_lease=None;runtime.end_data_request() + + +@app.after_request +def local_response_policy(response): + response.headers['Content-Security-Policy']="default-src 'self'; connect-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; font-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'" + if request.path.startswith('/api/'):response.headers['Cache-Control']='no-store' + return response def send_command(command, **context): @@ -291,14 +312,7 @@ def grow_mutation(): def start_simulation_workers(camera, dht_device): - if not app.config['GERM_SIMULATION'] or not get_gateway().adapter.simulated: - raise RuntimeError('Explicit simulated runtime required') - global cam - cam = camera - import dht11_reader - dht11_reader.dhtDevice = dht_device - threading.Thread(target=read_dht, daemon=True).start() - threading.Thread(target=read_serial, daemon=True).start() + raise RuntimeError('Unmanaged acquisition workers are disabled; use the explicit offline host lifecycle') if __name__ == '__main__': diff --git a/pi_hmi/offline_host.py b/pi_hmi/offline_host.py new file mode 100644 index 0000000..85d3c98 --- /dev/null +++ b/pi_hmi/offline_host.py @@ -0,0 +1,24 @@ +"""Opt-in synthetic host launcher. No production install or network exposure.""" +import argparse +from pathlib import Path +from werkzeug.serving import make_server +from services.host_lifecycle import HostLifecycle + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--workspace',required=True,type=Path) + parser.add_argument('--create',action='store_true',help='Initialize a new marked synthetic workspace; never adopt/replace an existing DB') + parser.add_argument('--port',type=int,default=5055) + args=parser.parse_args() + if not 1024<=args.port<=65535:parser.error('Use an unprivileged loopback port 1024–65535') + if args.create:args.workspace.mkdir(parents=True,exist_ok=True) + import app + host=HostLifecycle(args.workspace,create=args.create);host.bind(app.app);host.start() + # GERM_CONTROL_AUTHORIZER stays None: launcher never enables POST controls. + server=make_server('127.0.0.1',args.port,app.app,threaded=True) + print('Synthetic host only at http://127.0.0.1:'+str(args.port)+' · no physical devices or POST controls',flush=True) + try:server.serve_forever() + except KeyboardInterrupt:pass + finally:server.server_close();host.stop() + +if __name__=='__main__':main() diff --git a/pi_hmi/services/artifact_jobs.py b/pi_hmi/services/artifact_jobs.py index 4895eb8..3d786f2 100644 --- a/pi_hmi/services/artifact_jobs.py +++ b/pi_hmi/services/artifact_jobs.py @@ -4,6 +4,7 @@ from pathlib import PurePosixPath from services.media_repository import request_uuid from services.sqlite_repository import canonical +from services.file_lease import FileLease def now():return datetime.now(timezone.utc).isoformat() class ExportBusy(RuntimeError):pass @@ -17,17 +18,9 @@ def __init__(self,repository,root,*,software_version,table='export_jobs',url='/a self.retry_states=('failed','interrupted') if table=='export_jobs' else ('failed','interrupted','incomplete') self.lock=threading.Lock();self.active=False;self.thread=None suffix='export-owner.lock' if table=='export_jobs' else 'storage-owner.lock' - self.owner=repository.scoped(repository.path.with_name(repository.path.name+'.'+suffix)).open('a+b') try: - if self.owner.seek(0,2)==0:self.owner.write(b'0');self.owner.flush() - self.owner.seek(0) - if os.name=='nt': - import msvcrt - msvcrt.locking(self.owner.fileno(),msvcrt.LK_NBLCK,1) - else: - import fcntl - fcntl.flock(self.owner.fileno(),fcntl.LOCK_EX|fcntl.LOCK_NB) - except Exception:self.owner.close();raise ExportBusy('Another artifact service owns this journal') from None + self.owner=FileLease(repository.scoped(repository.path.with_name(repository.path.name+'.'+suffix))) + except Exception:raise ExportBusy('Another artifact service owns this journal') from None try:self.repo._write(f"UPDATE {self.table} SET status='interrupted',error='Process restart before durable completion',updated_at_utc=? WHERE status IN ('queued','running')",(now(),)) except Exception:self.close();raise diff --git a/pi_hmi/services/capture_service.py b/pi_hmi/services/capture_service.py index 23379c1..191b532 100644 --- a/pi_hmi/services/capture_service.py +++ b/pi_hmi/services/capture_service.py @@ -18,6 +18,7 @@ def __init__(self,state,repository,camera,image_root): self.lock=threading.RLock();self.schedule_lock=threading.Lock() self.last_error=None;self.recovery_report=None self.scheduling_error=None;self.reported_clock_fault=False + self.lifecycle_inhibit=None # Optional M8 host gate; default M5 behavior is unchanged. def path(self,relative): if not isinstance(relative,str) or PurePosixPath(relative).is_absolute() or '..' in PurePosixPath(relative).parts or '\\' in relative or ':' in relative:raise ValueError('Invalid image path') @@ -182,6 +183,7 @@ def _observe_schedule(self,now=None): return row def _check_scheduled_acquisition(self,generation,scheduled_at,*,missed=False): + if self.lifecycle_inhibit and self.lifecycle_inhibit():raise ValueError('Host lifecycle inhibits capture scheduling') now=self.state.utc_now() row=self._observe_schedule(now.isoformat()) if not row or row['generation']!=generation or capture_schedule_state(row,now.isoformat())!='ready':raise ValueError('Capture scheduling is inhibited or configuration changed') @@ -204,6 +206,7 @@ def scheduler_tick(self): try: schedule=self._observe_schedule() self.scheduling_error=None + if self.lifecycle_inhibit and self.lifecycle_inhibit():return None if not schedule or not schedule['enabled']:return None now=self.state.utc_now() if capture_schedule_state(schedule,now.isoformat())!='ready':return None @@ -223,6 +226,12 @@ def scheduler_tick(self): def scheduling_snapshot(self): schedule=self.repo.capture_schedule() + hold=self.lifecycle_inhibit() if self.lifecycle_inhibit else None + if hold: + return dict(state='clock_fault' if schedule and schedule['clock_fault'] else 'host_inhibited',inhibited=True, + clock_fault=bool(schedule and schedule['clock_fault']),high_water_utc=schedule['last_observed_utc'] if schedule else None, + resume_not_before_utc=schedule['resume_not_before_utc'] if schedule else None, + operator_recovery_required=True,error=hold) return dict(state=capture_schedule_state(schedule,self.state.utc_now().isoformat()) if schedule and schedule['clock_fault'] else ('unavailable' if self.scheduling_error else capture_schedule_state(schedule,self.state.utc_now().isoformat())), inhibited=bool(self.scheduling_error) or capture_schedule_state(schedule,self.state.utc_now().isoformat())!='ready', clock_fault=bool(schedule and schedule['clock_fault']),high_water_utc=schedule['last_observed_utc'] if schedule else None, diff --git a/pi_hmi/services/file_lease.py b/pi_hmi/services/file_lease.py new file mode 100644 index 0000000..72f0a0e --- /dev/null +++ b/pi_hmi/services/file_lease.py @@ -0,0 +1,20 @@ +"""Process-owned host file lease; close/crash releases it, no files are deleted.""" +import os + +class FileLease: + def __init__(self,path): + if path.is_symlink():raise ValueError('Lease symlink denied') + self.stream=path.open('a+b') + try: + if self.stream.seek(0,2)==0:self.stream.write(b'0');self.stream.flush() + self.stream.seek(0) + if os.name=='nt': + import msvcrt + msvcrt.locking(self.stream.fileno(),msvcrt.LK_NBLCK,1) + else: + import fcntl + fcntl.flock(self.stream.fileno(),fcntl.LOCK_EX|fcntl.LOCK_NB) + except Exception:self.stream.close();raise + @property + def closed(self):return self.stream.closed + def close(self):self.stream.close() diff --git a/pi_hmi/services/host_lifecycle.py b/pi_hmi/services/host_lifecycle.py new file mode 100644 index 0000000..67c4740 --- /dev/null +++ b/pi_hmi/services/host_lifecycle.py @@ -0,0 +1,206 @@ +"""Explicit offline synthetic host lifecycle. No daemon install, cloud or hardware.""" +from datetime import datetime,timezone +import json +from pathlib import Path +import threading +import time +from services.artifact_jobs import ExportBusy +from services.file_lease import FileLease +from services.media_repository import MediaRepository +from services.grow_service import GrowService +from services.camera_adapter import CameraOwner +from services.media_runtime import MediaRuntime +from services.local_ml_service import LocalMLService +from services.ml_service import MLUnavailable +from services.history_export import HistoryService +from services.storage_service import StorageService +from services.control_runtime import install_simulation_gateway +from sim.offline_adapters import offline_gateway + +DEPENDENCIES={'gateway':[],'database':['gateway'],'restart_grow':['database'],'logging':['restart_grow'],'sensors':['gateway'], + 'camera_ml':['logging'],'history_export':['database'],'backup':['history_export'],'worker':['restart_grow','logging','sensors','camera_ml','backup']} + +class HostLifecycle: + def __init__(self,root,*,create=False,gateway_factory=offline_gateway,camera_factory=None,ml_factory=None,sensor_provider=None,interval=.5): + self.root=Path(root) + if self.root.is_symlink():raise ValueError('Host workspace symlink denied') + self.root=self.root.resolve(strict=True) + if not .1<=interval<=5:raise ValueError('Host worker interval must be 0.1–5 seconds') + if sensor_provider is not None and getattr(sensor_provider,'synthetic',False) is not True:raise ValueError('Explicit synthetic sensor provider required') + self.create,self.gateway_factory,self.camera_factory,self.ml_factory,self.sensor_provider=create,gateway_factory,camera_factory,ml_factory,sensor_provider + self.interval=interval;self.lock=threading.RLock();self.worker=None;self.stop_event=threading.Event();self.ready=threading.Event() + self.lease=None;self.gateway=offline_gateway();self.repo=None;self.grow=None;self.media=None;self.history=None;self.storage=None;self.app=None + self.status='stopped';self.error=None;self.components={};self.order=[];self.heartbeat=None;self.epoch=0;self.camera_generation=0;self.background=True + self.data_requests=0 + + def begin_data_request(self): + with self.lock: + if self.status!='running':return False + self.data_requests+=1;return True + + def end_data_request(self): + with self.lock:self.data_requests=max(0,self.data_requests-1) + + def _component(self,name,state,error=None): + self.components[name]=dict(state=state,error=error,dependencies=DEPENDENCIES.get(name,[]),observed_at_utc=datetime.now(timezone.utc).isoformat()) + if name not in self.order:self.order.append(name) + + def _revoke(self,reason): + if self.gateway: + with self.gateway.state.lock: + self.gateway.state.restart_required=True;self.gateway.state.startup_complete=False + self.gateway.state.service_inhibits.add(reason);self.gateway.confirmations.clear() + if self.grow:self.grow.armed=False;self.grow._grant=None + return self.gateway.command('STOP',source='safety',authority=self.gateway.safety_authority) + + def _fault(self,name,exc): + self.status='degraded';self.error=type(exc).__name__+': '+str(exc)[:180] + self._component(name,'unavailable',self.error);self._revoke('host_service_unavailable') + + def bind(self,app): + self.app=app + if self.gateway:install_simulation_gateway(self.gateway) + app.config.update(GERM_HOST_LIFECYCLE=self,GERM_HISTORY_SERVICE=self.history,GERM_STORAGE_SERVICE=self.storage,GERM_SIMULATION=True) + + def start(self,*,background=True): + with self.lock: + if self.lease is not None:raise ExportBusy('Host workspace already started; stop/recover explicitly') + try:self.lease=FileLease(self.root/'.host-owner.lock') + except OSError:raise ExportBusy('Another host owns this workspace') from None + self.status='recovering';self.error=None;self.components={};self.order=[];self.epoch+=1;self.background=background + self.stop_event.clear();self.ready.clear();self.heartbeat=None + try: + candidate=self.gateway_factory() + if getattr(candidate.adapter,'synthetic_host_only',False) is not True or candidate.adapter.simulated is not True:raise ValueError('Only explicitly synthetic host adapters may run') + if getattr(candidate,'_host_lifecycle_claimed',False):raise ValueError('Fresh unowned gateway required for each startup') + candidate._host_lifecycle_claimed=True + self.gateway=candidate + self._revoke('host_recovering');self._component('gateway','restricted') + if self.app:self.bind(self.app) + marker=self.root/'HOST_SIMULATION.json';database=self.root/'host.sqlite' + fresh=not marker.exists() and self.create and not database.exists() + if fresh: + with marker.open('x',encoding='utf-8') as stream:json.dump({'format':'germ-host-simulation-v1'},stream) + if marker.is_symlink() or not marker.is_file() or json.loads(marker.read_text())!={'format':'germ-host-simulation-v1'}:raise ValueError('Explicit marked host workspace required; no existing DB adoption') + self.repo=MediaRepository(database,workspace_root=self.root,create=fresh);self._component('database','ready') + self.grow=GrowService(self.gateway,self.repo) + if not self.grow.persistence.restart.checkpoint() or not self.grow.recover():raise OSError('Conservative restart recovery failed') + self._component('restart_grow','paused_restart_required') + if not self.grow.persistence.tick():raise OSError('Initial event persistence not durable') + self._component('logging','ready') + self._component('sensors','recovering' if self.sensor_provider else 'unavailable') + adapter=self.camera_factory() if self.camera_factory else None + owner=CameraOwner(adapter,utc_now=self.gateway.state.utc_now) + self.media=MediaRuntime(self.gateway,self.repo,owner,self.root/'images',self.ml_factory) + if not isinstance(self.media.ml,(MLUnavailable,LocalMLService)) or (isinstance(self.media.ml,LocalMLService) and self.media.ml.captures is not self.media.captures):raise ValueError('Current local synthetic ML ownership required') + interrupted=self.repo.recover_ml_jobs() + if interrupted:self.media.captures.emit('ml_recovery',{'interrupted_jobs':interrupted,'rerun':False}) + self._component('camera_ml','synthetic_optional' if adapter else 'unavailable','No physical camera or model is configured') + schedule=self.repo.capture_schedule();self.camera_generation=schedule['generation'] if schedule else 0 + self.media.captures.lifecycle_inhibit=self._camera_inhibit + self.history=HistoryService(self.repo,self.root/'images',self.root/'exports',software_version='m8-host-simulation') + self._component('history_export','ready') + self.storage=StorageService(self.history,self.root/'storage',software_version='m8-host-simulation');self._component('backup','ready') + if self.app:self.bind(self.app) + self.status='running' + if background: + self.worker=threading.Thread(target=self._loop,daemon=True,name='germ-offline-services');self.worker.start() + if not self.ready.wait(2) or not self.worker.is_alive():raise RuntimeError('Host worker did not start') + else:self.worker=None;self._component('worker','manual_test_only') + with self.gateway.state.lock: + self.gateway.state.service_inhibits.discard('host_recovering') + if not self.gateway.state.validator.policies:self.gateway.state.service_inhibits.add('host_sensor_policy_unreviewed') + if self.status=='running':self.gateway.state.complete_startup() + return self.snapshot() + except Exception as exc: + self._fault(next((n for n in DEPENDENCIES if n not in self.components),'database'),exc) + if self.app:self.bind(self.app) + return self.snapshot() + + def _camera_inhibit(self): + if self.status!='running':return 'host_service_unavailable' + try:schedule=self.repo.capture_schedule() + except Exception:return 'host_database_unavailable' + return 'host_restart_requires_explicit_capture_schedule_configuration' if schedule and schedule['generation']<=self.camera_generation else None + + def step(self): + if self.status!='running':return False + stage='database' + try: + self.repo._rows('SELECT version FROM migration_history ORDER BY version DESC LIMIT 1') + if self.repo.status!='ready':raise OSError('Repository remains in error; explicit recovery required') + stage='logging' + if not self.grow.persistence.tick():raise OSError('Logging/restart persistence unavailable') + stage='sensors' + if self.sensor_provider:self.sensor_provider(self.gateway) + readings=self.gateway.state.validator.snapshot() + self._component('sensors','current_synthetic' if readings and all(r['state']=='fresh' for r in readings.values()) else 'unavailable_or_recovering') + stage='gateway' + if not self.gateway.poll_status():raise OSError('Synthetic gateway status unavailable') + stage='restart_grow' + if self.grow.armed and not self.gateway.state.restart_required:self.grow.scheduler_tick() + stage='camera_ml' + self.media.captures.scheduler_tick();self.media.captures.flush_outbox(self.gateway.event_pipeline) + self.heartbeat=time.monotonic();self._component('worker','running' if self.background else 'manual_test_only') + return True + except Exception as exc: + self._fault(stage,exc);self._component('worker','unavailable',self.error);return False + + def _loop(self): + self.ready.set() + try: + while not self.stop_event.is_set(): + if not self.step():break + self.stop_event.wait(self.interval) + except Exception as exc:self._fault('worker',exc) + + def snapshot(self): + if self.status=='running' and self.repo and self.repo.status!='ready':self._fault('database',OSError('Repository reports an unresolved error')) + if self.status=='running' and self.background: + if self.worker is None or not self.worker.is_alive():self._fault('worker',RuntimeError('Owned worker stopped; explicit recovery required')) + elif self.heartbeat and time.monotonic()-self.heartbeat>max(3,4*self.interval):self._fault('worker',TimeoutError('Owned worker heartbeat is stale')) + inputs=self.gateway.state.snapshot() if self.gateway else None + camera=self.media.captures.camera.snapshot(refresh=False) if self.media else {'state':'unavailable'} + model=getattr(self.media.ml,'status','unavailable') if self.media else 'unavailable' + readings=inputs.get('sensors',{}) if inputs else {} + sensors_current=bool(readings) and all(r['state']=='fresh' for r in readings.values()) + degraded=camera['state']!='ready' or model not in ('ready','completed') or not sensors_current + return dict(state=self.status,readiness='degraded' if degraded or self.status!='running' else 'host_ready',error=self.error,epoch=self.epoch,components=dict(self.components),startup_order=list(self.order), + camera=camera,model_state=model,sensor_state='current_synthetic_inputs' if sensors_current else 'unavailable_or_recovering', + worker_alive=bool(self.worker and self.worker.is_alive()),last_heartbeat_monotonic=self.heartbeat, + scope='synthetic host only',internet_dependency=False,production_controls_enabled=False, + restart_required=True if not self.gateway else self.gateway.state.restart_required, + schedules_armed=bool(self.grow and self.grow.armed),capture_restart_hold=bool(self.media and self._camera_inhibit()), + recovery_instruction='Restore missing dependencies, then explicitly Recover host services. Recheck current sensors; schedules require a separate confirmed action. No permissions are restored.') + + def stop(self,timeout=2): + with self.lock: + self.status='stopping';self._revoke('host_shutdown');self.stop_event.set() + if self.worker and self.worker is not threading.current_thread():self.worker.join(timeout) + if self.worker and self.worker.is_alive():self.status='shutdown_waiting_worker';return False + self._component('worker','stopped') + if self.data_requests:self.status='shutdown_waiting_requests';return False + if self.media: + inference=getattr(self.media.ml,'worker',None) + acquired=self.media.captures.lock.acquire(blocking=False) + if not acquired or (inference and inference.is_alive()): + if acquired:self.media.captures.lock.release() + self.status='shutdown_waiting_media';return False + self.media.captures.lock.release() + if any(service and (service.active or (service.thread and service.thread.is_alive())) for service in (self.storage,self.history)): + self.status='shutdown_waiting_jobs';return False + try: + if self.grow:self.grow.persistence.tick() + except Exception:pass # Existing M3 status retains failed/queued evidence; never assert a flush. + for service in (self.storage,self.history): + if service:service.close() + if self.gateway:self.gateway.grow_service=None;self.gateway.media_service=None + self.storage=self.history=self.media=self.grow=self.repo=None + if self.lease:self.lease.close();self.lease=None + self.status='stopped';self._component('worker','stopped') + if self.app:self.bind(self.app) + return True + + def recover(self): + if not self.stop():raise ExportBusy('Owned workers/jobs still active; no duplicate recovery is allowed') + return self.start(background=self.background) diff --git a/pi_hmi/services/lifecycle_http.py b/pi_hmi/services/lifecycle_http.py new file mode 100644 index 0000000..a500b75 --- /dev/null +++ b/pi_hmi/services/lifecycle_http.py @@ -0,0 +1,20 @@ +"""Read lifecycle status and explicitly recover synthetic host services only.""" +from flask import Blueprint,current_app,jsonify,request +from services.history_http import failed +lifecycle_routes=Blueprint('lifecycle',__name__) + +@lifecycle_routes.get('/api/services') +def services_status(): + lifecycle=current_app.config.get('GERM_HOST_LIFECYCLE') + if lifecycle is None:return jsonify(state='not_configured',readiness='unavailable',production_controls_enabled=False,recovery_instruction='No managed host runtime is configured. Physical integration remains disabled.'),503 + try:return jsonify(lifecycle.snapshot()) + except Exception as exc:return failed(exc) + +@lifecycle_routes.post('/api/services/recover') +def services_recover(): + lifecycle=current_app.config.get('GERM_HOST_LIFECYCLE') + if lifecycle is None:return jsonify(error='Host lifecycle is not configured'),503 + try: + if request.get_json(silent=True)!={}:raise ValueError('Expected empty object; no configuration or permissions can be supplied') + result=lifecycle.recover();return jsonify(result),200 if result['state']=='running' else 503 + except Exception as exc:return failed(exc) diff --git a/pi_hmi/sim/offline_adapters.py b/pi_hmi/sim/offline_adapters.py new file mode 100644 index 0000000..b4f38ef --- /dev/null +++ b/pi_hmi/sim/offline_adapters.py @@ -0,0 +1,17 @@ +"""No I/O adapter: only synthetic STATUS/OFF acknowledgements, never real devices.""" +from services.command_service import AdapterResult,CommandGateway +from services.state_service import StateManager +from collections import deque + +class OfflineAdapter: + simulated=True + synthetic_host_only=True + def __init__(self):self.commands=deque(maxlen=1024) # Bounded transient diagnostics; durable history stays in M3. + def send(self,command): + self.commands.append(command) + if command not in ('STATUS','STOP','PUMP_OFF','FAN_OFF','FAN_SPEED:0','LED_OFF','LED:0,0,0,0','MODE:normal'): + return AdapterResult(False,error='Offline host adapter does not emulate energizing commands') + return AdapterResult(True,dict(protocol=2,id=0,pump=False,fan=False,fan_speed=0,rgb=[0,0,0],lighting_mode='normal')) + +def offline_gateway(): + return CommandGateway(StateManager(),OfflineAdapter(),safe_commands=('STOP',),firmware_reviewed=False) diff --git a/pi_hmi/static/hmi.js b/pi_hmi/static/hmi.js index e3bc2ef..6a0f86b 100644 --- a/pi_hmi/static/hmi.js +++ b/pi_hmi/static/hmi.js @@ -149,6 +149,8 @@ async function pollState() { if (!response.ok) throw new Error(`HTTP ${response.status}`); renderState(await response.json()); } catch (error) { + latestState=null; + if(camera)camera.hidden=true; const state = byId('system-state'); state.textContent = 'STATUS UNAVAILABLE'; state.className = 'state-pill critical'; setText('arduino-head', 'Backend unavailable'); diff --git a/pi_hmi/static/offline.css b/pi_hmi/static/offline.css new file mode 100644 index 0000000..140fb50 --- /dev/null +++ b/pi_hmi/static/offline.css @@ -0,0 +1,2 @@ +/* Local usability layer: keyboard focus, readable text and scrolling touch UI. */ +:root{font-size:14px}.skip-link{position:fixed;left:8px;top:-100px;background:#fff;color:#102130;padding:12px;z-index:100}.skip-link:focus{top:8px}button,select,input:not([type=checkbox]):not([type=range]),nav a{min-height:44px}button:focus-visible,select:focus-visible,input:focus-visible,a:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline:3px solid #7fffb3;outline-offset:2px}.service-status{font-size:12px}.service-status summary{cursor:pointer;min-height:24px;padding:3px 0;color:#d9eef4}.service-status p{margin:6px 0;line-height:1.4}.service-status button{min-height:44px}.content{scroll-padding-top:8px;scroll-padding-bottom:16px}small{font-size:12px;line-height:1.35}.sensor-tile small,.system-tile small,.ml-row small{font-size:11px!important}.sliders label{min-height:44px}.sliders input[type=range]{min-height:30px}.controls-layout,.maintenance-grid{height:auto;min-height:100%;align-items:start}.control-card,.maintenance-grid .card{overflow:visible}.topbar .top-title{overflow-wrap:anywhere}.page-stack{height:auto;min-height:100%}.fill-card{min-height:150px}.toolbar{flex-wrap:wrap}.safety-panel{max-height:43vh;overflow:auto}.workflow-actions{gap:7px}.workflow-actions button{min-height:44px}.camera-error{font-size:13px}dialog{max-height:85vh;overflow:auto}dialog button{min-height:48px}#command-feedback{white-space:normal}.service-status[open]{padding-bottom:8px}.history-panel,.storage-panel{line-height:1.4} diff --git a/pi_hmi/static/offline.js b/pi_hmi/static/offline.js new file mode 100644 index 0000000..ddf240d --- /dev/null +++ b/pi_hmi/static/offline.js @@ -0,0 +1,43 @@ +/* Local host status only. No cloud, offline command queue or permission cache. */ +(()=>{ + const el=id=>document.getElementById(id);let checking=false,managed=false; + document.querySelector('nav a.active')?.setAttribute('aria-current','page'); + const dialog=el('confirm-dialog'); + dialog?.addEventListener('cancel',()=>{el('command-feedback').textContent='Command cancelled · nothing was sent';}); + function disconnected(){ + el('local-connection').textContent='Local service connection unavailable · current status unknown'; + el('service-health').textContent='Stored values and old permissions must not be treated as current.'; + el('recover-services').disabled=true; + el('service-guidance').textContent='Reconnect to this local host. Internet access is not needed. No commands are queued or replayed.'; + } + async function check(){ + if(checking)return;checking=true; + try{ + const response=await fetch('/api/services',{cache:'no-store'}),data=await response.json(); + if(data.state==='not_configured'){ + managed=false;el('local-connection').textContent='Local HMI connected · no managed host runtime · internet is not required'; + el('service-health').textContent='Default restricted mode; managed services are not configured.';el('recover-services').disabled=true;return; + } + if(!response.ok)throw Error(data.error || 'Host status unavailable');managed=true; + el('local-connection').textContent='Local host '+data.state+' · '+data.readiness+' · internet is not required'; + el('service-health').textContent=Object.entries(data.components).map(([name,item])=>name.replaceAll('_',' ')+': '+item.state).join(' · ')+` · camera ${data.camera.state} · model ${data.model_state} · ${data.sensor_state}`; + el('service-guidance').textContent=data.recovery_instruction; + const authorized=typeof latestState!=='undefined' && latestState?.control_boundary?.enabled===true; + el('recover-services').disabled=!authorized || ['recovering','stopping'].includes(data.state); + }catch{disconnected();} + finally{checking=false;} + } + el('recover-services').onclick=async()=>{ + if(!managed || !confirm('Recover synthetic host services? Existing permissions and confirmations are discarded. Schedules stay inhibited and require a separate reviewed action.'))return; + el('recover-services').disabled=true;el('service-health').textContent='Recovering dependencies · no permissions restored'; + try{ + const response=await fetch('/api/services/recover',{method:'POST',headers:{'Content-Type':'application/json','X-GERM-Token':controlToken},body:'{}'}); + const result=await response.json();if(!response.ok)throw Error(result.error || result.state || 'Recovery failed'); + el('command-feedback').textContent='Host recovery completed · permissions not restored · recheck current inputs'; + }catch(error){el('command-feedback').textContent='Recovery unavailable: '+error.message;} + finally{await check();} + }; + window.addEventListener('offline',()=>{disconnected();if(typeof pollState==='function')pollState();}); + window.addEventListener('online',()=>{check();if(typeof pollState==='function')pollState();}); + check();setInterval(check,2000); +})(); diff --git a/pi_hmi/templates/index.html b/pi_hmi/templates/index.html index 324f709..d171a69 100644 --- a/pi_hmi/templates/index.html +++ b/pi_hmi/templates/index.html @@ -5,10 +5,12 @@ GERM · {{ page|title }} + {% if page == 'trends' %}{% endif %} {% if page == 'settings' %}{% endif %} +
-

Confirm hardware command

+

Confirm host command

+ {% if page == 'trends' %}{% endif %} {% if page == 'settings' %}{% endif %} diff --git a/pi_hmi/tests/browser_m8.cjs b/pi_hmi/tests/browser_m8.cjs new file mode 100644 index 0000000..515504d --- /dev/null +++ b/pi_hmi/tests/browser_m8.cjs @@ -0,0 +1,57 @@ +/* Runtime network isolation, seven screens, keyboard UX and conservative recovery. */ +const {spawn}=require('node:child_process'),path=require('node:path'),fs=require('node:fs'),assert=require('node:assert/strict'); +const {chromium}=require(process.env.GERM_PLAYWRIGHT_MODULE || 'playwright'); +(async()=>{ + const root=path.resolve(__dirname,'../..'),output=path.resolve(process.env.GERM_BROWSER_OUTPUT || path.join(root,'build/m8-browser'));fs.mkdirSync(output,{recursive:true}); + const child=spawn(process.env.GERM_TEST_PYTHON || 'python',[path.join(__dirname,'browser_m8_host.py')],{cwd:root,env:{...process.env,PYTHONUTF8:'1',PYTHONDONTWRITEBYTECODE:'1'},stdio:['pipe','pipe','pipe']}); + let browser,page,logs='';child.stderr.on('data',c=>logs+=c); + try{ + const port=await new Promise((resolve,reject)=>{let text='';const timer=setTimeout(()=>reject(Error('Startup timeout '+logs)),25000);child.on('exit',code=>reject(Error('Host exited '+code+' '+logs)));child.stdout.on('data',c=>{text+=c;if(text.includes('\n')){clearTimeout(timer);resolve(JSON.parse(text.split('\n')[0]).port);}});}); + const base='http://127.0.0.1:'+port,external=[],errors=[],posts=[]; + browser=await chromium.launch({headless:true,executablePath:process.env.GERM_TEST_BROWSER || undefined}); + const context=await browser.newContext({viewport:{width:739,height:447}}); + await context.route('**/*',route=>{const url=new URL(route.request().url());if(url.origin!==base){external.push(url.origin);return route.abort();}return route.continue();}); + page=await context.newPage();page.on('pageerror',e=>errors.push(e.message));page.on('request',r=>{if(r.method()==='POST')posts.push(new URL(r.url()).pathname);}); + async function nativeConfirm(button){const opened=page.waitForEvent('dialog'),clicked=button.click();const dialog=await opened;await dialog.accept();await clicked;} + for(const route of ['/','/plant','/trends','/controls','/alerts','/maintenance','/settings']){ + await page.goto(base+route);await page.locator('#local-connection').filter({hasText:'Local host running'}).waitFor(); + assert.equal(await page.locator('nav a').count(),7);assert.equal(await page.locator('nav a[aria-current=page]').count(),1); + assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true); + await page.keyboard.press('Tab');assert.equal(await page.locator('.skip-link').evaluate(n=>n===document.activeElement),true); + const focusStyle=await page.locator('.skip-link').evaluate(n=>getComputedStyle(n).outlineStyle);assert.notEqual(focusStyle,'none'); + await page.keyboard.press('Enter');assert.equal(await page.locator('#main-content').evaluate(n=>n===document.activeElement),true); + } + await page.goto(base+'/');await page.locator('#grow-summary').filter({hasText:'paused'}).waitFor(); + await nativeConfirm(page.locator('[data-workflow=start]'));await page.locator('#grow-summary').filter({hasText:'armed for simulation'}).waitFor(); + await page.goto(base+'/controls');await page.locator('#boundary-status').filter({hasText:'SIMULATION'}).waitFor(); + await page.locator('[data-command=pump-on]').click();await page.locator('#confirm-dialog[open]').waitFor(); + assert.equal(await page.locator('#cancel-command').evaluate(n=>n===document.activeElement),true); + await page.keyboard.press('Escape');await page.locator('#confirm-dialog').waitFor({state:'hidden'}); + assert.equal(posts.filter(p=>p==='/api/pump').length,0); + const target=await page.locator('[data-command=pump-on]').boundingBox();assert.ok(target.height>=44); + const count=posts.length;await context.setOffline(true); + await page.locator('#system-state').filter({hasText:'STATUS UNAVAILABLE'}).waitFor(); + assert.equal(await page.locator('[data-command=pump-on]').isDisabled(),true); + await page.screenshot({path:path.join(output,'local-connection-lost.png'),fullPage:true}); + await context.setOffline(false);await page.locator('#local-connection').filter({hasText:'Local host running'}).waitFor(); + await page.waitForFunction(()=>document.querySelector('#system-state').textContent!=='STATUS UNAVAILABLE');assert.equal(posts.length,count); + child.stdin.write(JSON.stringify({fault:'database'})+'\n');await page.locator('#local-connection').filter({hasText:'Local host degraded'}).waitFor(); + await page.locator('.service-status').evaluate(n=>n.open=true); + await page.locator('#service-health').filter({hasText:'worker: unavailable'}).waitFor(); + await nativeConfirm(page.locator('#recover-services'));await page.locator('#command-feedback').filter({hasText:'permissions not restored'}).waitFor(); + const services=await (await page.request.get(base+'/api/services')).json();assert.equal(services.restart_required,true);assert.equal(services.schedules_armed,false); + const state=await (await page.request.get(base+'/api/state')).json();assert.equal(state.grow.cycle.status,'paused');assert.equal(state.operating_state.controller_feedback.pump,false); + await page.screenshot({path:path.join(output,'recovered-permissions-inhibited.png'),fullPage:true}); + await page.goto(base+'/plant');child.stdin.write(JSON.stringify({fault:'camera_stale'})+'\n'); + await page.locator('#camera-metadata').filter({hasText:'stale'}).waitFor();assert.equal(await page.locator('#camera-image').isHidden(),true); + await page.screenshot({path:path.join(output,'stale-camera-no-placeholder.png'),fullPage:true}); + assert.deepEqual(external,[]);assert.deepEqual(errors,[]); + fs.writeFileSync(path.join(output,'RESULTS.json'),JSON.stringify({status:'PASS',viewport:'739x447',externalRequests:external,pageErrors:errors,checks:['all seven screens with external requests blocked','same-origin assets and CSP','keyboard skip link and visible focus','current-page navigation','no horizontal overflow','touch target size','Cancel-focused dialog and Escape no dispatch','lost localhost clears status and disables commands','reconnect never replays POSTs','DB/core-worker failure requires explicit recovery','restart never restores permissions or armed schedules','stale camera hides image; no placeholder']},null,2)); + console.log('PASS: M8 offline seven-screen lifecycle, keyboard, disconnect and recovery browser flow'); + }catch(error){ + if(page){ + try{fs.writeFileSync(path.join(output,'failure-debug.json'),JSON.stringify({error:String(error),growText:await page.locator('#grow-summary').textContent(),state:await (await page.request.get(new URL('/api/state',page.url()).href)).json()},null,2));}catch{} + } + throw error; + }finally{if(browser)await browser.close();child.kill();fs.writeFileSync(path.join(output,'server-output.txt'),logs);} +})().catch(error=>{console.error(error);process.exitCode=1;}); diff --git a/pi_hmi/tests/browser_m8_host.py b/pi_hmi/tests/browser_m8_host.py new file mode 100644 index 0000000..3067a82 --- /dev/null +++ b/pi_hmi/tests/browser_m8_host.py @@ -0,0 +1,41 @@ +"""Loopback-only real lifecycle fixture; healthy inputs explicitly synthetic.""" +import json +from pathlib import Path +import tempfile +import threading +from werkzeug.serving import make_server +from m1_http_harness import app +from m1_fixtures import fixture,feed +from services.host_lifecycle import HostLifecycle +from sim.media_fakes import SyntheticCamera + +def factory(): + clock,state,adapter,gateway=fixture(started=False) + adapter.synthetic_host_only=True;gateway.fixture_clock=clock;return gateway + +class Provider: + synthetic=True + def __call__(self,gateway):gateway.fixture_clock.advance(.2);feed(gateway) + +if __name__=='__main__': + with tempfile.TemporaryDirectory() as directory: + host=HostLifecycle(directory,create=True,gateway_factory=factory,sensor_provider=Provider()) + host.camera_factory=lambda:SyntheticCamera(host.gateway.state.utc_now) + host.bind(app.app);host.start(background=False) + host.grow.create_cycle('basil','M8 synthetic offline cycle',host.gateway.operator_authority) + host.grow.configure([dict(target='lighting',enabled=True,start_utc='00:00',end_utc='23:59',rgb=[1,2,3])],host.gateway.operator_authority) + host.stop();host.start(background=True) + app.app.config.update(TESTING=True,GERM_CONTROL_AUTHORIZER=lambda request:True) + def faults(): + import sys,sqlite3 + for line in sys.stdin: + data=json.loads(line) + if data.get('fault')=='database':host.repo._rows=lambda *a,**k:(_ for _ in ()).throw(sqlite3.OperationalError('Injected host DB loss')) + if data.get('fault')=='camera_stale': + from datetime import timedelta + host.media.captures.camera.adapter.timestamp=(host.gateway.state.utc_now()-timedelta(seconds=10)).isoformat() + threading.Thread(target=faults,daemon=True).start() + server=make_server('127.0.0.1',0,app.app,threaded=True) + print(json.dumps({'port':server.server_port,'scope':'M8 SYNTHETIC OFFLINE HOST ONLY'}),flush=True) + try:server.serve_forever() + finally:server.server_close();host.stop() diff --git a/pi_hmi/tests/run_host_checks.py b/pi_hmi/tests/run_host_checks.py index dcd4e54..f235459 100644 --- a/pi_hmi/tests/run_host_checks.py +++ b/pi_hmi/tests/run_host_checks.py @@ -1,7 +1,7 @@ """Reproduce host-only checks and record exact logs without importing devices. Run from any directory: python pi_hmi/tests/run_host_checks.py -Outputs go to build/m7-evidence, never to production paths. Optional --root-app +Outputs go to build/m8-evidence, never to production paths. Optional --root-app checks the preserved, untracked protocol-1 app separately when it exists. """ import argparse @@ -47,6 +47,7 @@ def check(name, args, cwd): check('m5-clock-recovery', [sys.executable, '-m', 'unittest', 'discover', '-s', 'tests', '-p', 'test_m5_clock.py', '-v'], pi) check('m6-history-export', [sys.executable, '-m', 'unittest', 'discover', '-s', 'tests', '-p', 'test_m6.py', '-v'], pi) check('m7-storage-backup', [sys.executable, '-m', 'unittest', 'discover', '-s', 'tests', '-p', 'test_m7.py', '-v'], pi) + check('m8-offline-usability', [sys.executable, '-m', 'unittest', 'discover', '-s', 'tests', '-p', 'test_m8.py', '-v'], pi) if include_root: check('preserved-root-app', [sys.executable, '-m', 'unittest', 'discover', '-s', 'tests', '-v'], ROOT) parsed = sorted(pi.rglob('*.py')) @@ -59,6 +60,7 @@ def check(name, args, cwd): check('javascript-parse', [node, '--check', 'static/hmi.js'], pi) check('history-javascript-parse', [node, '--check', 'static/history.js'], pi) check('storage-javascript-parse', [node, '--check', 'static/storage.js'], pi) + check('offline-javascript-parse', [node, '--check', 'static/offline.js'], pi) else: results.append(dict(name='javascript-parse', skipped='node not available')) compiler = shutil.which('g++') @@ -84,7 +86,7 @@ def check(name, args, cwd): if __name__ == '__main__': parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument('--output', type=Path, default=ROOT / 'build/m7-evidence') + parser.add_argument('--output', type=Path, default=ROOT / 'build/m8-evidence') parser.add_argument('--root-app', action='store_true') args = parser.parse_args() raise SystemExit(run(args.output.resolve(), args.root_app)) diff --git a/pi_hmi/tests/test_m8.py b/pi_hmi/tests/test_m8.py new file mode 100644 index 0000000..6929938 --- /dev/null +++ b/pi_hmi/tests/test_m8.py @@ -0,0 +1,223 @@ +"""Offline lifecycle/permissions and local seven-screen runtime, temporary hosts only.""" +from contextlib import ExitStack +from pathlib import Path +import json +import socket +import sqlite3 +import sys +import tempfile +import threading +import time +import unittest +from unittest.mock import patch +import uuid +sys.path.insert(0,str(Path(__file__).resolve().parents[1])) +from services.host_lifecycle import HostLifecycle,DEPENDENCIES +from services.artifact_jobs import ExportBusy +from services.media_repository import MediaRepository +from services.command_service import CommandGateway +from services.state_service import StateManager +from sim.offline_adapters import OfflineAdapter +from sim.media_fakes import SyntheticCamera + +class LifecycleTests(unittest.TestCase): + def setUp(self): + self.temp=tempfile.TemporaryDirectory();self.addCleanup(self.temp.cleanup);self.root=Path(self.temp.name) + self.host=HostLifecycle(self.root,create=True);self.addCleanup(self.host.stop) + + def start(self,**kwargs):return self.host.start(background=False,**kwargs) + + def test_startup_dependency_order_restricted_defaults_and_shutdown(self): + status=self.start();self.assertEqual(status['state'],'running');self.assertEqual(status['readiness'],'degraded') + self.assertEqual(status['startup_order'],list(DEPENDENCIES)) + self.assertTrue(status['restart_required']);self.assertFalse(status['schedules_armed']);self.assertFalse(status['production_controls_enabled']) + self.assertEqual(status['camera']['state'],'unavailable');self.assertNotIn(status['model_state'],('ready','completed')) + self.assertTrue(self.host.step());self.assertEqual(set(self.host.gateway.adapter.commands)-{'STATUS','STOP'},set()) + self.assertTrue(self.host.stop());self.assertIsNone(self.host.repo);self.assertEqual(self.host.status,'stopped') + + def test_no_outgoing_internet_connections_for_start_tick_or_snapshot(self): + with patch('socket.create_connection',side_effect=AssertionError('Internet access attempted')),patch('urllib.request.urlopen',side_effect=AssertionError('HTTP attempted')),patch.object(socket.socket,'connect',side_effect=AssertionError('Network attempted')): + self.assertEqual(self.start()['state'],'running');self.assertTrue(self.host.step());self.host.snapshot();self.assertTrue(self.host.stop()) + + def test_repeated_restarts_preserve_history_and_never_permissions(self): + self.start();self.host.repo._write("INSERT INTO experiments(name,plant_profile,status,start_time_utc) VALUES('retained','basil','paused','2026-11-15T00:00:00Z')") + old=self.host.gateway;old.confirmations['old-token']={'synthetic':'expired on recovery'} + for _ in range(4): + status=self.host.recover();self.assertTrue(status['restart_required']);self.assertFalse(status['schedules_armed']);self.assertIsNot(self.host.gateway,old) + self.assertEqual(len(self.host.repo.get_experiments()),1);self.assertEqual(set(self.host.gateway.adapter.commands)-{'STOP','STATUS'},set()) + self.assertEqual(old.confirmations,{}) + result=self.host.gateway.execute(self.host.gateway.intent('start'),old.operator_authority) + self.assertFalse(result['allowed']);self.assertEqual(result['http_status'],403) + + def test_duplicate_instance_and_duplicate_start_do_not_duplicate_workers(self): + self.host.start();worker=self.host.worker + with self.assertRaises(ExportBusy):self.host.start() + other=HostLifecycle(self.root) + with self.assertRaises(ExportBusy):other.start() + self.assertIs(self.host.worker,worker);self.assertTrue(worker.is_alive()) + + def test_detected_worker_exit_latches_recovery_inhibit(self): + self.host.start();self.host.stop_event.set();self.host.worker.join(3) + result=self.host.snapshot();self.assertEqual(result['state'],'degraded');self.assertTrue(self.host.gateway.state.restart_required) + self.assertFalse(self.host.gateway.state.startup_complete);self.assertFalse(self.host.step()) + self.assertEqual(self.host.recover()['state'],'running');self.assertTrue(self.host.gateway.state.restart_required) + self.host.repo.status='error' + self.assertEqual(self.host.snapshot()['state'],'degraded');self.assertEqual(self.host.components['database']['state'],'unavailable') + + def test_stale_worker_heartbeat_fails_closed(self): + self.start();self.host.background=True;self.host.worker=threading.current_thread();self.host.heartbeat=time.monotonic()-20 + self.assertEqual(self.host.snapshot()['state'],'degraded');self.host.worker=None + self.assertIn('host_service_unavailable',self.host.gateway.state.service_inhibits) + + def test_blocked_worker_prevents_release_and_duplicate_recovery(self): + entered=threading.Event();release=threading.Event() + def blocked():entered.set();release.wait(5);return False + with patch.object(self.host,'step',side_effect=blocked): + self.host.start();self.assertTrue(entered.wait(2));self.assertFalse(self.host.stop(timeout=.01)) + self.assertEqual(self.host.status,'shutdown_waiting_worker') + with self.assertRaises(ExportBusy):HostLifecycle(self.root).start() + release.set();self.host.worker.join(3) + self.assertTrue(self.host.stop()) + + def test_database_failure_never_auto_heals_or_grants_permission(self): + self.start() + with patch.object(self.host.repo,'_rows',side_effect=sqlite3.OperationalError('simulated DB failure')): + self.assertFalse(self.host.step());self.assertEqual(self.host.snapshot()['state'],'degraded') + self.assertFalse(self.host.step());self.assertFalse(self.host.gateway.state.startup_complete) + self.assertEqual(self.host.recover()['state'],'running');self.assertTrue(self.host.gateway.state.restart_required) + + def test_logging_failure_isolated_and_requires_explicit_recovery(self): + self.start() + with patch.object(self.host.grow.persistence,'tick',return_value=False):self.assertFalse(self.host.step()) + self.assertEqual(self.host.status,'degraded');self.assertEqual(self.host.gateway.adapter.commands[-1],'STOP') + self.assertFalse(self.host.gateway.state.startup_complete) + self.host.recover() + with patch.object(self.host.gateway,'poll_status',return_value=False):self.assertFalse(self.host.step()) + self.assertEqual(self.host.components['gateway']['state'],'unavailable') + + def test_missing_database_is_never_recreated_after_initialized_workspace(self): + self.start();database=self.host.repo.path;self.host.stop();database.unlink() # owned temporary failure fixture + self.assertEqual(self.host.recover()['state'],'degraded');self.assertFalse(database.exists()) + MediaRepository(database,workspace_root=self.root,create=True) + self.assertEqual(self.host.recover()['state'],'running') + + def test_unmarked_existing_database_is_not_adopted_or_overwritten(self): + path=self.root/'host.sqlite';path.write_bytes(b'keep existing bytes') + self.assertEqual(self.start()['state'],'degraded');self.assertEqual(path.read_bytes(),b'keep existing bytes') + + def test_non_synthetic_adapter_or_camera_rejected_without_dispatch(self): + adapter=OfflineAdapter();adapter.synthetic_host_only=False + self.host.gateway_factory=lambda:CommandGateway(StateManager(),adapter,safe_commands=('STOP',)) + self.assertEqual(self.start()['state'],'degraded');self.assertFalse(adapter.commands) + self.host.stop();self.host.gateway_factory=lambda:CommandGateway(StateManager(),OfflineAdapter(),safe_commands=('STOP',)) + self.host.camera_factory=lambda:object() + self.assertEqual(self.start()['state'],'degraded');self.assertIsNone(self.host.media) + + def test_optional_synthetic_camera_no_model_honestly_degraded(self): + self.host.camera_factory=SyntheticCamera;status=self.start();self.assertEqual(status['readiness'],'degraded') + self.assertNotIn(status['model_state'],('ready','completed'));self.assertFalse(status['production_controls_enabled']) + self.assertEqual(self.host.media.captures.camera.adapter.reads,0) + + def test_camera_schedule_restart_hold_preserves_claims_and_generation(self): + self.host.camera_factory=SyntheticCamera;self.start();self.host.grow.create_cycle('basil','Synthetic cycle',self.host.gateway.operator_authority) + anchor=self.host.gateway.state.utc_now().isoformat();self.host.media.captures.configure_schedule(True,3600,anchor);self.host.step() + before=self.host.repo.recent_capture_requests();self.assertEqual(len(before),1);generation=self.host.repo.capture_schedule()['generation'] + self.host.recover();self.host.step() + self.assertEqual(self.host.repo.capture_schedule()['generation'],generation);self.assertEqual(len(self.host.repo.recent_capture_requests()),1) + self.assertEqual(self.host.media.captures.camera.adapter.reads,0);self.assertEqual(self.host.media.captures.scheduling_snapshot()['state'],'host_inhibited') + self.assertFalse(self.host.grow.armed) + + def test_running_export_blocks_shutdown_and_new_workspace_owner(self): + self.start();entered=threading.Event();release=threading.Event();original=self.host.repo.backup + def blocked(path):entered.set();release.wait(5);return original(path) + history=self.host.history + with patch.object(self.host.repo,'backup',side_effect=blocked): + history.start(str(uuid.uuid4()),{'resources':['experiments']});self.assertTrue(entered.wait(2)) + self.assertFalse(self.host.stop());self.assertEqual(self.host.status,'shutdown_waiting_jobs') + with self.assertRaises(ExportBusy):HostLifecycle(self.root).start() + release.set();history.wait() + self.assertTrue(self.host.stop()) + + def test_inflight_mutation_lease_blocks_shutdown_until_teardown(self): + self.start();self.assertTrue(self.host.begin_data_request());self.assertFalse(self.host.stop()) + self.assertEqual(self.host.status,'shutdown_waiting_requests');self.assertFalse(self.host.begin_data_request()) + self.host.end_data_request();self.assertTrue(self.host.stop()) + + def test_restart_recovers_interrupted_artifact_receipts_without_execution(self): + import hashlib + from services.model_contract import ModelManifest + self.host.camera_factory=SyntheticCamera;self.start();request_id=str(uuid.uuid4()) + self.host.grow.create_cycle('basil','Synthetic interruption fixture',self.host.gateway.operator_authority) + image=self.host.media.captures.capture(str(uuid.uuid4()))['image'] + manifest=ModelManifest('synthetic-contract','fixture-1',hashlib.sha256(b'SYNTHETIC CONTRACT; NOT MODEL WEIGHTS').hexdigest(),('fixture_normal','fixture_abnormal'),32,24) + self.host.repo.register_model(manifest);ml_request=str(uuid.uuid4()) + self.host.repo.claim_ml_job(ml_request,image['image_id'],manifest.digest,'{}',hashlib.sha256(b'{}').hexdigest(),self.host.gateway.state.utc_now().isoformat()) + self.host.repo._write("INSERT INTO storage_jobs VALUES(?,?,'running',1,?,?,NULL,NULL)",(request_id,'{"kind":"backup"}','2026-11-15T00:00:00Z','2026-11-15T00:00:00Z')) + self.host.recover();job=self.host.storage.job(request_id) + self.assertEqual(job['status'],'interrupted');self.assertFalse(self.host.storage.active);self.assertIsNone(job['download_url']) + self.assertEqual(self.host.repo._rows('SELECT status FROM ml_jobs WHERE request_id=?',(ml_request,))[0]['status'],'interrupted') + self.assertNotIn(self.host.snapshot()['model_state'],('ready','completed')) + + def test_required_synthetic_sensor_provider_rejects_untrusted_callback(self): + with self.assertRaises(ValueError):HostLifecycle(self.root,sensor_provider=lambda gateway:None) + + def test_current_synthetic_samples_expire_instead_of_becoming_real_values(self): + from m1_fixtures import fixture,feed + def factory(): + clock,state,adapter,gateway=fixture(started=False);adapter.synthetic_host_only=True;gateway.fixture_clock=clock;return gateway + class Provider: + synthetic=True + def __call__(self,gateway):gateway.fixture_clock.advance(.2);feed(gateway) + self.host.gateway_factory=factory;self.host.sensor_provider=Provider();self.start();self.host.step() + reading=self.host.gateway.state.snapshot()['sensors']['air_temperature'];self.assertEqual(reading['fault_reason'],'recovering') + self.host.step();reading=self.host.gateway.state.snapshot()['sensors']['air_temperature'];self.assertEqual(reading['value'],24) + self.host.sensor_provider=None;self.host.gateway.fixture_clock.advance(10);self.host.step() + reading=self.host.gateway.state.snapshot()['sensors']['air_temperature'];self.assertEqual(reading['quality_flag'],'stale') + self.assertIsNone(reading['value']);self.assertTrue(self.host.gateway.state.restart_required) + + def test_corrupt_existing_database_is_not_repaired_or_replaced(self): + self.start();path=self.host.repo.path;self.host.stop() + with path.open('r+b') as stream:stream.write(b'corrupt-snapshot') + self.assertEqual(self.host.recover()['state'],'degraded');self.assertTrue(path.read_bytes().startswith(b'corrupt-snapshot')) + + def test_gateway_and_model_owners_cannot_be_reused_across_restart(self): + shared=CommandGateway(StateManager(),OfflineAdapter(),safe_commands=('STOP',)) + self.host.gateway_factory=lambda:shared;self.assertEqual(self.start()['state'],'running') + self.assertEqual(self.host.recover()['state'],'degraded');self.assertTrue(self.host.gateway.state.restart_required) + self.host.stop();self.host.gateway_factory=lambda:CommandGateway(StateManager(),OfflineAdapter(),safe_commands=('STOP',)) + self.host.ml_factory=lambda captures:object() + self.assertEqual(self.start()['state'],'degraded') + + +class LifecycleHttpTests(unittest.TestCase): + def test_seven_screens_local_assets_headers_status_recovery_and_production_denial(self): + import app + from services.control_runtime import get_gateway,install_simulation_gateway + old=dict(app.app.config);old_gateway=get_gateway() + with tempfile.TemporaryDirectory() as directory: + host=HostLifecycle(directory,create=True);host.bind(app.app);host.start(background=False) + try: + client=app.app.test_client();headers={'X-GERM-Token':app.control_token} + for route in ('/','/plant','/trends','/controls','/alerts','/maintenance','/settings'): + response=client.get(route);self.assertEqual(response.status_code,200);self.assertIn(b'Skip navigation',response.data) + self.assertIn("connect-src 'self'",response.headers['Content-Security-Policy']) + for asset in ('hmi.css','hmi.js','offline.css','offline.js','history.js','storage.js'): + response=client.get('/static/'+asset) + try:self.assertEqual(response.status_code,200) + finally:response.close() + self.assertEqual(client.get('/api/services').json['state'],'running');self.assertEqual(client.get('/api/services').headers['Cache-Control'],'no-store') + app.app.config['GERM_CONTROL_AUTHORIZER']=None + self.assertEqual(client.post('/api/services/recover',json={},headers=headers).status_code,403) + app.app.config['GERM_CONTROL_AUTHORIZER']=lambda request:True + response=client.post('/api/services/recover',json={},headers=headers);self.assertEqual(response.status_code,200) + self.assertTrue(response.json['restart_required']);self.assertFalse(response.json['schedules_armed']) + self.assertEqual(client.post('/api/services/recover',json={'enable_hardware':True},headers=headers).status_code,400) + app.app.config['GERM_SIMULATION']=False + self.assertEqual(client.post('/api/services/recover',json={},headers=headers).status_code,403) + with self.assertRaises(RuntimeError):app.start_simulation_workers(object(),object()) + finally: + host.stop();app.app.config.update(old) + import services.control_runtime as control_runtime + control_runtime._gateway=old_gateway # Restore the original test-process default, including its unavailable adapter. + +if __name__=='__main__':unittest.main(verbosity=2)