π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Reorganize infra/ml and add test docs
laurenspriem65983257d06a
diff --git a/.github/workflows/ml-indexing-parity.yml b/.github/workflows/ml-indexing-parity.ymlindex 8a9c7a975e..431dff4a25 100644--- a/.github/workflows/ml-indexing-parity.yml+++ b/.github/workflows/ml-indexing-parity.yml@@ -156,7 +156,7 @@ jobs:args=(--suite "$PARITY_SUITE"--platforms "$PARITY_PLATFORMS"- --output-dir "infra/ml/out/parity"+ --output-dir "infra/ml/test/out/parity")if [[ "$PARITY_FAIL_ON_MISSING" == "true" ]]; thenargs+=(--fail-on-missing-platform)@@ -165,12 +165,12 @@ jobs:args+=(--allow-empty-comparison)fi- bash infra/ml/tools/run_suite.sh "${args[@]}"+ bash infra/ml/test/tools/run_suite.sh "${args[@]}"- name: Upload parity artifactsif: always()uses: actions/upload-artifact@v4with:name: "ml-indexing-parity-${{ github.run_id }}-${{ github.run_attempt }}"- path: "infra/ml/out/parity/**"+ path: "infra/ml/test/out/parity/**"if-no-files-found: ignorediff --git a/desktop/scripts/ml_parity_runner.ts b/desktop/scripts/ml_parity_runner.tsindex 9a1c957ef0..993137b67e 100755--- a/desktop/scripts/ml_parity_runner.ts+++ b/desktop/scripts/ml_parity_runner.ts@@ -56,17 +56,18 @@ interface PendingRequest {const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));const REPO_ROOT = path.resolve(SCRIPT_DIR, "..", "..");const DESKTOP_ROOT = path.join(REPO_ROOT, "desktop");-const ML_DIR = path.join(REPO_ROOT, "infra", "ml");+const ML_DIR = path.join(REPO_ROOT, "infra", "ml", "test");const DEFAULT_MANIFEST_PATH = path.join(REPO_ROOT,"infra","ml",+ "test","ground_truth","manifest.json",);-const DEFAULT_OUTPUT_DIR = path.join(REPO_ROOT, "infra", "ml", "out", "parity", "desktop");+const DEFAULT_OUTPUT_DIR = path.join(REPO_ROOT, "infra", "ml", "test", "out", "parity", "desktop");const DEFAULT_HOST_SCRIPT_PATH = path.join(REPO_ROOT, "desktop", "scripts", "ml_parity_host.js");const DEFAULT_ELECTRON_BIN_PATH = path.join(REPO_ROOT,@@ -75,7 +76,7 @@ const DEFAULT_ELECTRON_BIN_PATH = path.join(".bin","electron",);-const DEFAULT_USER_DATA_PATH = path.join(REPO_ROOT, "infra", "ml", ".cache", "desktop-user-data");+const DEFAULT_USER_DATA_PATH = path.join(REPO_ROOT, "infra", "ml", "test", ".cache", "desktop-user-data");const MODEL_FILE_NAMES: Record<string, string> = {clip: "mobileclip_s2_image_opset18_rgba_opt.onnx",@@ -86,7 +87,7 @@ const MODEL_FILE_NAMES: Record<string, string> = {const usage = () => {process.stderr.write(`Usage: desktop/scripts/ml_parity_runner.ts [flags]\n\n`);process.stderr.write(`Flags:\n`);- process.stderr.write(` --manifest <path> Path to parity manifest (default: infra/ml/ground_truth/manifest.json)\n`);+ process.stderr.write(` --manifest <path> Path to parity manifest (default: infra/ml/test/ground_truth/manifest.json)\n`);process.stderr.write(` --output-dir <path> Output directory for desktop parity JSONs\n`);process.stderr.write(` --electron-bin <path> Electron binary path\n`);process.stderr.write(` --host-script <path> Host script path\n`);diff --git a/infra/ml/.gitignore b/infra/ml/.gitignoreindex c30b5d8926..6fb28ed16c 100644--- a/infra/ml/.gitignore+++ b/infra/ml/.gitignore@@ -16,20 +16,25 @@ wheels/*.tflite# Imported repos-CLIP/mobileclip_repo/+playground/CLIP/mobileclip_repo/# Data-data/flickr8k_captions.txt+playground/data/flickr8k_captions.txt# Local parity run outputsout/+test/out/# Local fixture cache.cache/+test/.cache/# Runtime-downloaded fixture inputstest_data/+test/test_data/# Runtime parity JSON outputsground_truth/goldens/*.json!ground_truth/goldens/.gitkeep+test/ground_truth/goldens/*.json+!test/ground_truth/goldens/.gitkeepdiff --git a/infra/ml/README.md b/infra/ml/README.mdindex 6665920bfc..15a322ce42 100644--- a/infra/ml/README.md+++ b/infra/ml/README.md@@ -1,19 +1,18 @@-# Ente ML playground+# Infra ML Workspace-This is a central place to keep track of any (Python) code used for prepping our ML models. The purpose of storing it here is to have some kind of version control over the alterations made to the models.+`infra/ml` is split into two focused areas:-Most of the code is in [Jupyter Notebooks](https://jupyter.org/), which facilitates quick interation and good documentation.+- `playground/`: exploratory ML notebooks, model prep experiments, and sample assets.+- `test/`: ML indexing parity framework (Python ground truth, desktop/mobile runners, comparator, and CI entrypoints).-## Running any notebook+Shared Python project configuration stays at this root:-In case you're using VSCode, make sure you've installed the [Jupyter](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) extension and only have a [single window](https://github.com/microsoft/vscode/issues/125993#issuecomment-2099627960) open.+- `pyproject.toml`+- `uv.lock`+- `.python-version`+- `.gitignore`-1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)-2. Run `uv sync`-3. Run `uv venv`-4. In any notebook, make sure to select the virtual environment kernel from `.venv/bin/python` in the top (right corner on VSCode)+Use the directory-specific READMEs for day-to-day work:-## Notebooks and git--Please make sure to always clear output data inside a notebook before committing changes to git.-Jupyter notebooks are known to not always work nicely with Git versioning control when there is output in them.+- `infra/ml/playground/README.md`+- `infra/ml/test/README.md`diff --git a/infra/ml/CLIP/mobileclip_onnx.ipynb b/infra/ml/playground/CLIP/mobileclip_onnx.ipynbsimilarity index 100%rename from infra/ml/CLIP/mobileclip_onnx.ipynbrename to infra/ml/playground/CLIP/mobileclip_onnx.ipynbdiff --git a/infra/ml/playground/README.md b/infra/ml/playground/README.mdnew file mode 100644index 0000000000..144d9072fc--- /dev/null+++ b/infra/ml/playground/README.md@@ -0,0 +1,19 @@+# ML Playground++This directory is for exploratory and model-preparation work only.++Current contents include:++- `CLIP/`: CLIP/mobileclip notebooks and experiments.+- `YOLOv5Face/`: YOLOv5Face notebooks and related assets.+- `data/`: local sample images used by notebooks.++## Running notebooks++1. Install `uv`.+2. From repo root, run `uv sync --project infra/ml`.+3. In VS Code/Jupyter, use kernel `infra/ml/.venv/bin/python`.++## Notebook hygiene++Clear notebook outputs before committing to keep diffs readable and stable.diff --git a/infra/ml/YOLOv5Face/pytorch_weights/.gitkeep b/infra/ml/playground/YOLOv5Face/pytorch_weights/.gitkeepsimilarity index 100%rename from infra/ml/YOLOv5Face/pytorch_weights/.gitkeeprename to infra/ml/playground/YOLOv5Face/pytorch_weights/.gitkeepdiff --git a/infra/ml/YOLOv5Face/yoloface_onnx.ipynb b/infra/ml/playground/YOLOv5Face/yoloface_onnx.ipynbsimilarity index 100%rename from infra/ml/YOLOv5Face/yoloface_onnx.ipynbrename to infra/ml/playground/YOLOv5Face/yoloface_onnx.ipynbdiff --git a/infra/ml/data/man.jpeg b/infra/ml/playground/data/man.jpegsimilarity index 100%rename from infra/ml/data/man.jpegrename to infra/ml/playground/data/man.jpegdiff --git a/infra/ml/data/people.jpeg b/infra/ml/playground/data/people.jpegsimilarity index 100%rename from infra/ml/data/people.jpegrename to infra/ml/playground/data/people.jpegdiff --git a/infra/ml/data/singapore.jpg b/infra/ml/playground/data/singapore.jpgsimilarity index 100%rename from infra/ml/data/singapore.jpgrename to infra/ml/playground/data/singapore.jpgdiff --git a/infra/ml/test/README.md b/infra/ml/test/README.mdnew file mode 100644index 0000000000..916fbdd736--- /dev/null+++ b/infra/ml/test/README.md@@ -0,0 +1,65 @@+# ML Indexing Parity Test Suite++This directory contains the ML indexing parity framework for Android, iOS, desktop, and Python ground truth.++## Layout++- `ml-indexing-parity-test-plan.md`: rollout plan and progress tracker.+- `ground_truth/`: schema, manifest, and ONNX-backed Python pipeline.+- `comparator/`: parity comparison engine and threshold checks.+- `tools/`: suite orchestration and CLI entrypoints.+- `tests/`: pytest coverage for schema/comparator behavior.+- Runtime-only artifacts (gitignored): `test_data/`, `out/`, `.cache/`.++## Prerequisites++- Python + `uv`+- Node/Yarn (desktop parity)+- Flutter SDK (Android/iOS parity)+- Android emulator/device and iOS simulator/device when running mobile parity++## Local Run (One Command)++```bash+bash infra/ml/test/tools/run_suite.sh --suite smoke --platforms all+```++Common flags:++- `--suite smoke|full`+- `--platforms all|desktop|android|ios`+- `--fail-on-missing-platform`+- `--allow-empty-comparison`+- `--output-dir <path>`++Outputs go to `infra/ml/test/out/parity/` by default, including `comparison_report.json`.++## Manual CI Run++Workflow: `.github/workflows/ml-indexing-parity.yml`++Run via `workflow_dispatch` and choose:++- `suite`+- `platforms`+- strictness flags+- optional explicit Android/iOS device IDs++CI uploads artifacts from `infra/ml/test/out/parity/**`.++## Golden Update / Maintenance++Goldens are runtime artifacts and are not committed.++Use this process when corpus/threshold/model behavior changes intentionally:++1. Update corpus metadata or thresholds in `infra/ml/test/ground_truth/manifest.json` (and comparator logic if needed).+2. Regenerate and compare with a real run:++```bash+bash infra/ml/test/tools/run_suite.sh --suite full --platforms all --output-dir infra/ml/test/out/parity+```++3. Review `infra/ml/test/out/parity/comparison_report.json` and per-platform `results.json` files.+4. If drift is expected, adjust thresholds/known exceptions and rerun until stable.+5. Commit code/config/docs updates only; do not commit generated `out/`, `test_data/`, or cache artifacts.diff --git a/infra/ml/comparator/__init__.py b/infra/ml/test/comparator/__init__.pysimilarity index 100%rename from infra/ml/comparator/__init__.pyrename to infra/ml/test/comparator/__init__.pydiff --git a/infra/ml/comparator/compare.py b/infra/ml/test/comparator/compare.pysimilarity index 100%rename from infra/ml/comparator/compare.pyrename to infra/ml/test/comparator/compare.pydiff --git a/infra/ml/ground_truth/README.md b/infra/ml/test/ground_truth/README.mdsimilarity index 67%rename from infra/ml/ground_truth/README.mdrename to infra/ml/test/ground_truth/README.mdindex bad990d745..88c7ed1787 100644--- a/infra/ml/ground_truth/README.md+++ b/infra/ml/test/ground_truth/README.md@@ -9,7 +9,7 @@ This directory stores the Python ground-truth assets for the ML indexing parityflow using Pillow + OpenCV + ONNX Runtime.Runtime outputs (`goldens/*.json`, `goldens/results.json`, and-`infra/ml/out/parity/**`) are generated on demand and are gitignored.+`infra/ml/test/out/parity/**`) are generated on demand and are gitignored.## Dataset Source@@ -21,14 +21,14 @@ The default corpus is sourced from:`manifest.json` in this directory uses:-- `source`: local runtime path under `infra/ml/test_data/...`+- `source`: local runtime path under `infra/ml/test/test_data/...`- `source_url`: remote raw fixture URL used by `run_suite.sh` for download- `source_sha256`: integrity check value used during download and generation## ONNX Models`generate_goldens.py` downloads and caches the mobile indexing ONNX models under-`infra/ml/.cache/onnx_models/`:+`infra/ml/test/.cache/onnx_models/`:- `mobileclip_s2_image.onnx`- `yolov5s_face_640_640_dynamic.onnx`@@ -40,21 +40,21 @@ HEIC/HEIF decoding requires the `pillow-heif` plugin (declared in## Generate Goldens```bash-uv run --project infra/ml --no-sync --with pillow-heif python infra/ml/tools/generate_goldens.py \- --manifest infra/ml/ground_truth/manifest.json \- --output-dir infra/ml/out/parity/python+uv run --project infra/ml --no-sync --with pillow-heif python infra/ml/test/tools/generate_goldens.py \+ --manifest infra/ml/test/ground_truth/manifest.json \+ --output-dir infra/ml/test/out/parity/python````generate_goldens.py` expects fixture files to already be present locally.-`run_suite.sh` is responsible for clearing `infra/ml/test_data/ml-indexing/v1`,+`run_suite.sh` is responsible for clearing `infra/ml/test/test_data/ml-indexing/v1`,downloading fixtures, and then calling the generator.## Compare Against Platforms```bash-uv run --project infra/ml python infra/ml/tools/compare_parity_outputs.py \- --ground-truth infra/ml/out/parity/python/results.json \- --platform-result android=infra/ml/out/parity/android/results.json \- --platform-result ios=infra/ml/out/parity/ios/results.json \- --platform-result desktop=infra/ml/out/parity/desktop/results.json+uv run --project infra/ml python infra/ml/test/tools/compare_parity_outputs.py \+ --ground-truth infra/ml/test/out/parity/python/results.json \+ --platform-result android=infra/ml/test/out/parity/android/results.json \+ --platform-result ios=infra/ml/test/out/parity/ios/results.json \+ --platform-result desktop=infra/ml/test/out/parity/desktop/results.json```diff --git a/infra/ml/ground_truth/__init__.py b/infra/ml/test/ground_truth/__init__.pysimilarity index 100%rename from infra/ml/ground_truth/__init__.pyrename to infra/ml/test/ground_truth/__init__.pydiff --git a/infra/ml/ground_truth/_runtime.py b/infra/ml/test/ground_truth/_runtime.pysimilarity index 100%rename from infra/ml/ground_truth/_runtime.pyrename to infra/ml/test/ground_truth/_runtime.pydiff --git a/infra/ml/ground_truth/clip.py b/infra/ml/test/ground_truth/clip.pysimilarity index 100%rename from infra/ml/ground_truth/clip.pyrename to infra/ml/test/ground_truth/clip.pydiff --git a/infra/ml/ground_truth/face_alignment.py b/infra/ml/test/ground_truth/face_alignment.pysimilarity index 100%rename from infra/ml/ground_truth/face_alignment.pyrename to infra/ml/test/ground_truth/face_alignment.pydiff --git a/infra/ml/ground_truth/face_detection.py b/infra/ml/test/ground_truth/face_detection.pysimilarity index 100%rename from infra/ml/ground_truth/face_detection.pyrename to infra/ml/test/ground_truth/face_detection.pydiff --git a/infra/ml/ground_truth/face_embedding.py b/infra/ml/test/ground_truth/face_embedding.pysimilarity index 100%rename from infra/ml/ground_truth/face_embedding.pyrename to infra/ml/test/ground_truth/face_embedding.pydiff --git a/infra/ml/ground_truth/goldens/.gitkeep b/infra/ml/test/ground_truth/goldens/.gitkeepsimilarity index 100%rename from infra/ml/ground_truth/goldens/.gitkeeprename to infra/ml/test/ground_truth/goldens/.gitkeepdiff --git a/infra/ml/ground_truth/manifest.json b/infra/ml/test/ground_truth/manifest.jsonsimilarity index 100%rename from infra/ml/ground_truth/manifest.jsonrename to infra/ml/test/ground_truth/manifest.jsondiff --git a/infra/ml/ground_truth/pipeline.py b/infra/ml/test/ground_truth/pipeline.pysimilarity index 100%rename from infra/ml/ground_truth/pipeline.pyrename to infra/ml/test/ground_truth/pipeline.pydiff --git a/infra/ml/ground_truth/schema.py b/infra/ml/test/ground_truth/schema.pysimilarity index 100%rename from infra/ml/ground_truth/schema.pyrename to infra/ml/test/ground_truth/schema.pydiff --git a/infra/ml/ml-indexing-parity-test-plan.md b/infra/ml/test/ml-indexing-parity-test-plan.mdsimilarity index 65%rename from infra/ml/ml-indexing-parity-test-plan.mdrename to infra/ml/test/ml-indexing-parity-test-plan.mdindex a20bf8caf7..7a5856af8b 100644--- a/infra/ml/ml-indexing-parity-test-plan.md+++ b/infra/ml/test/ml-indexing-parity-test-plan.md@@ -86,14 +86,14 @@ This section is for implementation agents to keep a running log so handoffs stay### Workstream Checklist- [x] W1: Define shared output schema (`file_id`, clip vector, detections, face embeddings, metadata)- [x] W2: Implement Python ground truth pipeline (`clip.py`, `face_detection.py`, `face_alignment.py`, `face_embedding.py`, `pipeline.py`)-- [x] W3: Add/define corpus manifest and storage layout under `infra/ml/ground_truth`+- [x] W3: Add/define corpus manifest and storage layout under `infra/ml/test/ground_truth`- [x] W4: Implement desktop parity runner- [x] W5: Implement Android parity runner- [x] W6: Implement iOS parity runner- [x] W7: Implement comparator and report generator- [x] W8: Implement one-command local orchestration (`run_suite.sh`)- [x] W9: Add manual-only CI workflow (`workflow_dispatch` only, no automatic triggers)-- [ ] W10: Document usage and maintenance (`README`, golden update instructions)+- [x] W10: Document usage and maintenance (`README`, golden update instructions)Framework completion for this branch is W1-W10.Continuous corpus expansion/threshold tightening is tracked as ongoing maintenance (see Rollout), not as a completion-gated checklist item.@@ -101,30 +101,32 @@ Continuous corpus expansion/threshold tightening is tracked as ongoing maintenan### Implementation Log| Date (YYYY-MM-DD) | Agent | Change Summary | Files Touched | Validation Run | Next Step ||---|---|---|---|---|---|-| 2026-02-13 | Codex (GPT-5) | Implemented shared parity result schema, comparator/report engine, bootstrap corpus manifest + deterministic golden generator, comparator CLI, suite runner scaffold, and pytest coverage for schema/comparator behavior across python/android/ios/desktop fixtures. | `infra/ml/ground_truth/schema.py`, `infra/ml/ground_truth/manifest.json`, `infra/ml/ground_truth/README.md`, `infra/ml/comparator/compare.py`, `infra/ml/tools/generate_goldens.py`, `infra/ml/tools/compare_parity_outputs.py`, `infra/ml/tools/run_suite.sh`, `infra/ml/tests/conftest.py`, `infra/ml/tests/test_schema.py`, `infra/ml/tests/test_comparator.py`, `infra/ml/.gitignore` | `uv run --project infra/ml --no-sync python infra/ml/tools/generate_goldens.py --manifest infra/ml/ground_truth/manifest.json --output-dir infra/ml/ground_truth/goldens`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/tests/test_schema.py infra/ml/tests/test_comparator.py`; `uv run --project infra/ml --no-sync python infra/ml/tools/compare_parity_outputs.py --ground-truth infra/ml/ground_truth/goldens/results.json --platform-result desktop=infra/ml/ground_truth/goldens/results.json --output /tmp/ml_parity_compare_report.json`; `infra/ml/tools/run_suite.sh --suite smoke --platforms all --output-dir infra/ml/out/parity` | Implement real ONNX-backed Python pipeline modules (`clip.py`, `face_detection.py`, `face_alignment.py`, `face_embedding.py`, `pipeline.py`) and connect desktop/android/ios runners to emit schema outputs. |-| 2026-02-16 | Codex (GPT-5) | Switched bootstrap corpus source to the canonical fixtures dataset (`https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1`), expanded manifest entries, and updated bootstrap generator to load remote fixture URLs with local cache and SHA-256 verification. | `infra/ml/ground_truth/manifest.json`, `infra/ml/tools/generate_goldens.py`, `infra/ml/ground_truth/README.md`, `infra/ml/ml-indexing-parity-test-plan.md`, `infra/ml/.gitignore` | `uv run --project infra/ml --no-sync python infra/ml/tools/generate_goldens.py --manifest infra/ml/ground_truth/manifest.json --output-dir infra/ml/ground_truth/goldens`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/tests/test_schema.py infra/ml/tests/test_comparator.py`; `infra/ml/tools/run_suite.sh --suite smoke --platforms all --output-dir infra/ml/out/parity` | Keep using bootstrap outputs for parity harness bring-up until ONNX-backed Python pipeline modules land (W2). |-| 2026-02-16 | Codex (GPT-5) | Switched parity artifact policy to runtime-only outputs: removed checked-in per-file/result JSON artifacts and documented gitignored fixture-data + platform output directories generated by `run_suite.sh`. | `infra/ml/ground_truth/goldens/*.json`, `infra/ml/.gitignore`, `infra/ml/ml-indexing-parity-test-plan.md`, `infra/ml/tools/run_suite.sh`, `infra/ml/tools/generate_goldens.py`, `infra/ml/ground_truth/manifest.json` | `git status --short`; `ls infra/ml/ground_truth/goldens`; `infra/ml/tools/run_suite.sh --suite smoke --platforms all --output-dir infra/ml/out/parity` | Implement W4/W5/W6 runners to emit runtime output JSONs into `infra/ml/out/parity/<platform>/`. |-| 2026-02-16 | Codex (GPT-5) | Implemented W2 real ONNX-backed Python ground-truth pipeline with trusted library primitives: Pillow (+HEIF plugin) decode/orientation, OpenCV resize/warp/NMS, ONNX Runtime inference for CLIP + YOLOv5Face + MobileFaceNet, and integrated `generate_goldens.py` to emit schema outputs from live inference. | `infra/ml/ground_truth/_runtime.py`, `infra/ml/ground_truth/clip.py`, `infra/ml/ground_truth/face_detection.py`, `infra/ml/ground_truth/face_alignment.py`, `infra/ml/ground_truth/face_embedding.py`, `infra/ml/ground_truth/pipeline.py`, `infra/ml/tools/generate_goldens.py`, `infra/ml/tools/run_suite.sh`, `infra/ml/ground_truth/README.md`, `infra/ml/pyproject.toml`, `infra/ml/uv.lock`, `infra/ml/ml-indexing-parity-test-plan.md` | `uv run --project infra/ml --no-sync --with pillow-heif python infra/ml/tools/generate_goldens.py --manifest infra/ml/ground_truth/manifest.json --output-dir infra/ml/out/parity/python`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/tests/test_schema.py infra/ml/tests/test_comparator.py`; `infra/ml/tools/run_suite.sh --suite smoke --platforms all --allow-empty-comparison --output-dir infra/ml/out/parity` | Implement W4 desktop parity runner next, then wire W5/W6 mobile runners into `run_suite.sh`. |-| 2026-02-16 | Codex (GPT-5) | Implemented W4 desktop parity runner using production desktop ML runtime paths: added Electron host that drives the compiled `ml-worker` utility process for ONNX inference/model downloads, added desktop parity runner that invokes web `indexFaces`/`indexCLIP` logic and emits shared-schema outputs, and wired `run_suite.sh` to compile desktop sources and run desktop parity generation when dependencies are present. | `desktop/scripts/ml_parity_host.js`, `desktop/scripts/ml_parity_runner.ts`, `infra/ml/tools/run_suite.sh`, `infra/ml/ml-indexing-parity-test-plan.md` | `bash -n infra/ml/tools/run_suite.sh`; `node --check desktop/scripts/ml_parity_host.js`; `node --experimental-strip-types --check desktop/scripts/ml_parity_runner.ts`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/tests/test_schema.py infra/ml/tests/test_comparator.py`; `infra/ml/tools/run_suite.sh --suite smoke --platforms desktop --allow-empty-comparison --output-dir /tmp/ml_parity_desktop_smoke` | Implement W5/W6 mobile parity runners and then mark W8 complete once all platform runners are fully orchestrated by `run_suite.sh`. |-| 2026-02-16 | Codex (GPT-5) | Hardened desktop decode parity to use the exact production decode helper source: extracted `createImageBitmapAndData` into shared web ML module, reused by production via `blob.ts`, and injected that exact function source into the parity host renderer decode path. | `web/packages/new/photos/services/ml/decode.ts`, `web/packages/new/photos/services/ml/blob.ts`, `desktop/scripts/ml_parity_host.js`, `desktop/scripts/ml_parity_runner.ts`, `infra/ml/tools/run_suite.sh`, `infra/ml/ml-indexing-parity-test-plan.md` | `node --check desktop/scripts/ml_parity_host.js`; `node --experimental-strip-types --check desktop/scripts/ml_parity_runner.ts`; `node --experimental-strip-types --check web/packages/new/photos/services/ml/decode.ts`; `bash -n infra/ml/tools/run_suite.sh`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/tests/test_schema.py infra/ml/tests/test_comparator.py`; `infra/ml/tools/run_suite.sh --suite smoke --platforms desktop --allow-empty-comparison --output-dir /tmp/ml_parity_desktop_smoke` | Run full desktop parity locally once `desktop/node_modules` + `web/node_modules` are installed, then proceed with W5/W6. |-| 2026-02-16 | Codex (GPT-5) | Implemented W5/W6 mobile parity runners with shared harness that executes the production mobile isolate ML pipeline (`IsolateOperation.analyzeImage` -> `analyzeImageStatic`) on Android and iOS, emits shared-schema outputs through an integration-test driver, and wired `run_suite.sh` to launch platform-specific Flutter drive targets and persist `results.json` under `infra/ml/out/parity/<platform>/`. | `mobile/apps/photos/integration_test/ml_parity_shared.dart`, `mobile/apps/photos/integration_test/ml_parity_android_test.dart`, `mobile/apps/photos/integration_test/ml_parity_ios_test.dart`, `mobile/apps/photos/test_driver/ml_parity_driver.dart`, `infra/ml/tools/run_suite.sh`, `infra/ml/ml-indexing-parity-test-plan.md` | `dart format mobile/apps/photos/integration_test/ml_parity_shared.dart mobile/apps/photos/integration_test/ml_parity_android_test.dart mobile/apps/photos/integration_test/ml_parity_ios_test.dart mobile/apps/photos/test_driver/ml_parity_driver.dart`; `flutter analyze mobile/apps/photos/integration_test/ml_parity_shared.dart mobile/apps/photos/integration_test/ml_parity_android_test.dart mobile/apps/photos/integration_test/ml_parity_ios_test.dart mobile/apps/photos/test_driver/ml_parity_driver.dart`; `bash -n infra/ml/tools/run_suite.sh`; `infra/ml/tools/run_suite.sh --suite smoke --platforms android --allow-empty-comparison --output-dir /tmp/ml_parity_android_smoke3`; `infra/ml/tools/run_suite.sh --suite smoke --platforms ios --allow-empty-comparison --output-dir /tmp/ml_parity_ios_smoke2` (fails in this environment with missing iOS module `receive_sharing_intent`) | Implement W9 selective parity CI workflow and W10 maintenance/docs updates. |-| 2026-02-17 | Codex (GPT-5) | Made Android/iOS parity runners robust to per-file inference/decode failures so runs still emit `results.json` and proceed to comparison; regenerated missing Flutter Rust Bridge artifacts required by Android builds; validated both Android and iOS parity runners now execute end-to-end against real emulator/simulator devices and write outputs. | `mobile/apps/photos/integration_test/ml_parity_shared.dart`, `mobile/apps/photos/ios/Podfile`, `mobile/apps/photos/ios/Podfile.lock`, `mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj`, generated FRB artifacts under gitignored `mobile/apps/photos/lib/src/rust/*` and `mobile/packages/rust/rust/src/frb_generated.rs` | `dart run melos run codegen:rust:photos`; `dart run melos run codegen:rust:packages`; `dart format mobile/apps/photos/integration_test/ml_parity_shared.dart`; `flutter analyze mobile/apps/photos/integration_test/ml_parity_shared.dart`; `ML_PARITY_ANDROID_DEVICE_ID=emulator-5554 infra/ml/tools/run_suite.sh --suite smoke --platforms android --output-dir /tmp/ml_parity_android_live`; `ML_PARITY_IOS_DEVICE_ID=78739D64-4BF5-4A4F-89CA-5F538B5FF68D infra/ml/tools/run_suite.sh --suite smoke --platforms ios --output-dir /tmp/ml_parity_ios_live` | Move to W9 (selective CI workflow) and W10 (maintenance docs), then tune thresholds/known exceptions for currently failing HEIC edge cases surfaced by parity reports. |-| 2026-02-17 | Codex (GPT-5) | Clarified rollout semantics so framework completion is explicitly W1-W10, and reframed Phase 4 as ongoing maintenance (continuous corpus expansion/threshold tightening) rather than a release-gated checklist item. | `infra/ml/ml-indexing-parity-test-plan.md` | `nl -ba infra/ml/ml-indexing-parity-test-plan.md` | Complete W9 selective CI workflow and W10 docs to declare the initial framework done. |-| 2026-02-17 | Codex (GPT-5) | Implemented W9 by adding a parity CI workflow that is explicitly manual-only (`workflow_dispatch` only): it wires parity inputs (`suite`, `platforms`, strictness flags, optional device IDs), provisions CI dependencies, runs `infra/ml/tools/run_suite.sh`, and uploads parity artifacts for inspection. | `.github/workflows/ml-indexing-parity.yml`, `infra/ml/ml-indexing-parity-test-plan.md` | `ruby -e 'require "yaml"; YAML.load_file(".github/workflows/ml-indexing-parity.yml")'`; `nl -ba .github/workflows/ml-indexing-parity.yml`; `nl -ba infra/ml/ml-indexing-parity-test-plan.md` | Implement W10 usage and maintenance docs (runner prerequisites, manual workflow usage, and golden update guidance). |+| 2026-02-13 | Codex (GPT-5) | Implemented shared parity result schema, comparator/report engine, bootstrap corpus manifest + deterministic golden generator, comparator CLI, suite runner scaffold, and pytest coverage for schema/comparator behavior across python/android/ios/desktop fixtures. | `infra/ml/test/ground_truth/schema.py`, `infra/ml/test/ground_truth/manifest.json`, `infra/ml/test/ground_truth/README.md`, `infra/ml/test/comparator/compare.py`, `infra/ml/test/tools/generate_goldens.py`, `infra/ml/test/tools/compare_parity_outputs.py`, `infra/ml/test/tools/run_suite.sh`, `infra/ml/test/tests/conftest.py`, `infra/ml/test/tests/test_schema.py`, `infra/ml/test/tests/test_comparator.py`, `infra/ml/.gitignore` | `uv run --project infra/ml --no-sync python infra/ml/test/tools/generate_goldens.py --manifest infra/ml/test/ground_truth/manifest.json --output-dir infra/ml/test/ground_truth/goldens`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/test/tests/test_schema.py infra/ml/test/tests/test_comparator.py`; `uv run --project infra/ml --no-sync python infra/ml/test/tools/compare_parity_outputs.py --ground-truth infra/ml/test/ground_truth/goldens/results.json --platform-result desktop=infra/ml/test/ground_truth/goldens/results.json --output /tmp/ml_parity_compare_report.json`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms all --output-dir infra/ml/test/out/parity` | Implement real ONNX-backed Python pipeline modules (`clip.py`, `face_detection.py`, `face_alignment.py`, `face_embedding.py`, `pipeline.py`) and connect desktop/android/ios runners to emit schema outputs. |+| 2026-02-16 | Codex (GPT-5) | Switched bootstrap corpus source to the canonical fixtures dataset (`https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1`), expanded manifest entries, and updated bootstrap generator to load remote fixture URLs with local cache and SHA-256 verification. | `infra/ml/test/ground_truth/manifest.json`, `infra/ml/test/tools/generate_goldens.py`, `infra/ml/test/ground_truth/README.md`, `infra/ml/test/ml-indexing-parity-test-plan.md`, `infra/ml/.gitignore` | `uv run --project infra/ml --no-sync python infra/ml/test/tools/generate_goldens.py --manifest infra/ml/test/ground_truth/manifest.json --output-dir infra/ml/test/ground_truth/goldens`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/test/tests/test_schema.py infra/ml/test/tests/test_comparator.py`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms all --output-dir infra/ml/test/out/parity` | Keep using bootstrap outputs for parity harness bring-up until ONNX-backed Python pipeline modules land (W2). |+| 2026-02-16 | Codex (GPT-5) | Switched parity artifact policy to runtime-only outputs: removed checked-in per-file/result JSON artifacts and documented gitignored fixture-data + platform output directories generated by `run_suite.sh`. | `infra/ml/test/ground_truth/goldens/*.json`, `infra/ml/.gitignore`, `infra/ml/test/ml-indexing-parity-test-plan.md`, `infra/ml/test/tools/run_suite.sh`, `infra/ml/test/tools/generate_goldens.py`, `infra/ml/test/ground_truth/manifest.json` | `git status --short`; `ls infra/ml/test/ground_truth/goldens`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms all --output-dir infra/ml/test/out/parity` | Implement W4/W5/W6 runners to emit runtime output JSONs into `infra/ml/test/out/parity/<platform>/`. |+| 2026-02-16 | Codex (GPT-5) | Implemented W2 real ONNX-backed Python ground-truth pipeline with trusted library primitives: Pillow (+HEIF plugin) decode/orientation, OpenCV resize/warp/NMS, ONNX Runtime inference for CLIP + YOLOv5Face + MobileFaceNet, and integrated `generate_goldens.py` to emit schema outputs from live inference. | `infra/ml/test/ground_truth/_runtime.py`, `infra/ml/test/ground_truth/clip.py`, `infra/ml/test/ground_truth/face_detection.py`, `infra/ml/test/ground_truth/face_alignment.py`, `infra/ml/test/ground_truth/face_embedding.py`, `infra/ml/test/ground_truth/pipeline.py`, `infra/ml/test/tools/generate_goldens.py`, `infra/ml/test/tools/run_suite.sh`, `infra/ml/test/ground_truth/README.md`, `infra/ml/pyproject.toml`, `infra/ml/uv.lock`, `infra/ml/test/ml-indexing-parity-test-plan.md` | `uv run --project infra/ml --no-sync --with pillow-heif python infra/ml/test/tools/generate_goldens.py --manifest infra/ml/test/ground_truth/manifest.json --output-dir infra/ml/test/out/parity/python`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/test/tests/test_schema.py infra/ml/test/tests/test_comparator.py`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms all --allow-empty-comparison --output-dir infra/ml/test/out/parity` | Implement W4 desktop parity runner next, then wire W5/W6 mobile runners into `run_suite.sh`. |+| 2026-02-16 | Codex (GPT-5) | Implemented W4 desktop parity runner using production desktop ML runtime paths: added Electron host that drives the compiled `ml-worker` utility process for ONNX inference/model downloads, added desktop parity runner that invokes web `indexFaces`/`indexCLIP` logic and emits shared-schema outputs, and wired `run_suite.sh` to compile desktop sources and run desktop parity generation when dependencies are present. | `desktop/scripts/ml_parity_host.js`, `desktop/scripts/ml_parity_runner.ts`, `infra/ml/test/tools/run_suite.sh`, `infra/ml/test/ml-indexing-parity-test-plan.md` | `bash -n infra/ml/test/tools/run_suite.sh`; `node --check desktop/scripts/ml_parity_host.js`; `node --experimental-strip-types --check desktop/scripts/ml_parity_runner.ts`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/test/tests/test_schema.py infra/ml/test/tests/test_comparator.py`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms desktop --allow-empty-comparison --output-dir /tmp/ml_parity_desktop_smoke` | Implement W5/W6 mobile parity runners and then mark W8 complete once all platform runners are fully orchestrated by `run_suite.sh`. |+| 2026-02-16 | Codex (GPT-5) | Hardened desktop decode parity to use the exact production decode helper source: extracted `createImageBitmapAndData` into shared web ML module, reused by production via `blob.ts`, and injected that exact function source into the parity host renderer decode path. | `web/packages/new/photos/services/ml/decode.ts`, `web/packages/new/photos/services/ml/blob.ts`, `desktop/scripts/ml_parity_host.js`, `desktop/scripts/ml_parity_runner.ts`, `infra/ml/test/tools/run_suite.sh`, `infra/ml/test/ml-indexing-parity-test-plan.md` | `node --check desktop/scripts/ml_parity_host.js`; `node --experimental-strip-types --check desktop/scripts/ml_parity_runner.ts`; `node --experimental-strip-types --check web/packages/new/photos/services/ml/decode.ts`; `bash -n infra/ml/test/tools/run_suite.sh`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/test/tests/test_schema.py infra/ml/test/tests/test_comparator.py`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms desktop --allow-empty-comparison --output-dir /tmp/ml_parity_desktop_smoke` | Run full desktop parity locally once `desktop/node_modules` + `web/node_modules` are installed, then proceed with W5/W6. |+| 2026-02-16 | Codex (GPT-5) | Implemented W5/W6 mobile parity runners with shared harness that executes the production mobile isolate ML pipeline (`IsolateOperation.analyzeImage` -> `analyzeImageStatic`) on Android and iOS, emits shared-schema outputs through an integration-test driver, and wired `run_suite.sh` to launch platform-specific Flutter drive targets and persist `results.json` under `infra/ml/test/out/parity/<platform>/`. | `mobile/apps/photos/integration_test/ml_parity_shared.dart`, `mobile/apps/photos/integration_test/ml_parity_android_test.dart`, `mobile/apps/photos/integration_test/ml_parity_ios_test.dart`, `mobile/apps/photos/test_driver/ml_parity_driver.dart`, `infra/ml/test/tools/run_suite.sh`, `infra/ml/test/ml-indexing-parity-test-plan.md` | `dart format mobile/apps/photos/integration_test/ml_parity_shared.dart mobile/apps/photos/integration_test/ml_parity_android_test.dart mobile/apps/photos/integration_test/ml_parity_ios_test.dart mobile/apps/photos/test_driver/ml_parity_driver.dart`; `flutter analyze mobile/apps/photos/integration_test/ml_parity_shared.dart mobile/apps/photos/integration_test/ml_parity_android_test.dart mobile/apps/photos/integration_test/ml_parity_ios_test.dart mobile/apps/photos/test_driver/ml_parity_driver.dart`; `bash -n infra/ml/test/tools/run_suite.sh`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms android --allow-empty-comparison --output-dir /tmp/ml_parity_android_smoke3`; `infra/ml/test/tools/run_suite.sh --suite smoke --platforms ios --allow-empty-comparison --output-dir /tmp/ml_parity_ios_smoke2` (fails in this environment with missing iOS module `receive_sharing_intent`) | Implement W9 selective parity CI workflow and W10 maintenance/docs updates. |+| 2026-02-17 | Codex (GPT-5) | Made Android/iOS parity runners robust to per-file inference/decode failures so runs still emit `results.json` and proceed to comparison; regenerated missing Flutter Rust Bridge artifacts required by Android builds; validated both Android and iOS parity runners now execute end-to-end against real emulator/simulator devices and write outputs. | `mobile/apps/photos/integration_test/ml_parity_shared.dart`, `mobile/apps/photos/ios/Podfile`, `mobile/apps/photos/ios/Podfile.lock`, `mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj`, generated FRB artifacts under gitignored `mobile/apps/photos/lib/src/rust/*` and `mobile/packages/rust/rust/src/frb_generated.rs` | `dart run melos run codegen:rust:photos`; `dart run melos run codegen:rust:packages`; `dart format mobile/apps/photos/integration_test/ml_parity_shared.dart`; `flutter analyze mobile/apps/photos/integration_test/ml_parity_shared.dart`; `ML_PARITY_ANDROID_DEVICE_ID=emulator-5554 infra/ml/test/tools/run_suite.sh --suite smoke --platforms android --output-dir /tmp/ml_parity_android_live`; `ML_PARITY_IOS_DEVICE_ID=78739D64-4BF5-4A4F-89CA-5F538B5FF68D infra/ml/test/tools/run_suite.sh --suite smoke --platforms ios --output-dir /tmp/ml_parity_ios_live` | Move to W9 (selective CI workflow) and W10 (maintenance docs), then tune thresholds/known exceptions for currently failing HEIC edge cases surfaced by parity reports. |+| 2026-02-17 | Codex (GPT-5) | Clarified rollout semantics so framework completion is explicitly W1-W10, and reframed Phase 4 as ongoing maintenance (continuous corpus expansion/threshold tightening) rather than a release-gated checklist item. | `infra/ml/test/ml-indexing-parity-test-plan.md` | `nl -ba infra/ml/test/ml-indexing-parity-test-plan.md` | Complete W9 selective CI workflow and W10 docs to declare the initial framework done. |+| 2026-02-17 | Codex (GPT-5) | Implemented W9 by adding a parity CI workflow that is explicitly manual-only (`workflow_dispatch` only): it wires parity inputs (`suite`, `platforms`, strictness flags, optional device IDs), provisions CI dependencies, runs `infra/ml/test/tools/run_suite.sh`, and uploads parity artifacts for inspection. | `.github/workflows/ml-indexing-parity.yml`, `infra/ml/test/ml-indexing-parity-test-plan.md` | `ruby -e 'require "yaml"; YAML.load_file(".github/workflows/ml-indexing-parity.yml")'`; `nl -ba .github/workflows/ml-indexing-parity.yml`; `nl -ba infra/ml/test/ml-indexing-parity-test-plan.md` | Implement W10 usage and maintenance docs (runner prerequisites, manual workflow usage, and golden update guidance). |+| 2026-02-17 | Codex (GPT-5) | Completed W10 by reorganizing `infra/ml` into explicit `playground/` and `test/` scopes, adding branch-level usage and maintenance docs (including golden update guidance), and retargeting parity tooling/workflow defaults to `infra/ml/test/*`. | `infra/ml/README.md`, `infra/ml/playground/README.md`, `infra/ml/test/README.md`, `infra/ml/test/ground_truth/README.md`, `infra/ml/test/tools/generate_goldens.py`, `infra/ml/test/tools/run_suite.sh`, `desktop/scripts/ml_parity_runner.ts`, `.github/workflows/ml-indexing-parity.yml`, `infra/ml/.gitignore`, `infra/ml/test/ml-indexing-parity-test-plan.md` | `bash -n infra/ml/test/tools/run_suite.sh`; `uv run --project infra/ml --no-sync --with pytest pytest infra/ml/test/tests/test_schema.py infra/ml/test/tests/test_comparator.py`; `node --experimental-strip-types --check desktop/scripts/ml_parity_runner.ts`; `ruby -e 'require \"yaml\"; YAML.load_file(\".github/workflows/ml-indexing-parity.yml\")'` | Continue with Phase 4 maintenance: tune thresholds/known exceptions and expand corpus coverage. |### Decisions and Rationale Log| Date | Decision | Rationale | Impacted Files ||---|---|---|---|-| 2026-02-13 | Start with strict schema + comparator + contract tests before platform runner wiring. | Provides immediate, automated parity coverage and a stable JSON contract while platform-specific runner implementations are still pending. | `infra/ml/ground_truth/schema.py`, `infra/ml/comparator/compare.py`, `infra/ml/tests/test_schema.py`, `infra/ml/tests/test_comparator.py` |-| 2026-02-13 | Use deterministic bootstrap golden generation from manifest-defined corpus metadata for initial suite bring-up. | Allows end-to-end tool validation (`generate_goldens` -> comparator -> report) without waiting for full Python model pipeline completion. | `infra/ml/tools/generate_goldens.py`, `infra/ml/ground_truth/manifest.json`, `infra/ml/tools/run_suite.sh` |-| 2026-02-16 | Point default parity corpus to `https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1` and verify each fixture by SHA-256 during bootstrap generation. | Aligns suite inputs with the dedicated maintained fixture set while preserving deterministic generation and reducing local corpus drift risk. | `infra/ml/ground_truth/manifest.json`, `infra/ml/tools/generate_goldens.py`, `infra/ml/ground_truth/README.md` |-| 2026-02-16 | Keep all parity outputs ephemeral (gitignored), generated fresh on each suite run. | Avoids stale checked-in artifacts and ensures every comparison is based on current runner outputs over the same fixture set. | `infra/ml/.gitignore`, `infra/ml/ground_truth/goldens/`, `infra/ml/tools/run_suite.sh` |-| 2026-02-16 | Implement Python ground truth using trusted library primitives (Pillow/OpenCV/ORT), avoiding handwritten interpolation and NMS logic. | Keeps the reference pipeline easier to audit and maintain while still mirroring the mobile `analyzeImageStatic` flow and model behavior. | `infra/ml/ground_truth/_runtime.py`, `infra/ml/ground_truth/clip.py`, `infra/ml/ground_truth/face_detection.py`, `infra/ml/ground_truth/face_alignment.py`, `infra/ml/ground_truth/face_embedding.py`, `infra/ml/ground_truth/pipeline.py` |-| 2026-02-16 | Desktop runner orchestration is dependency-aware and non-fatal by default when desktop/web node installs are absent. | Preserves one-command suite usability in Python-only environments while still auto-running real desktop parity when prerequisites exist; strict mode can still fail on missing outputs. | `infra/ml/tools/run_suite.sh`, `desktop/scripts/ml_parity_runner.ts`, `desktop/scripts/ml_parity_host.js` |-| 2026-02-16 | Desktop parity decode must use the same conversion+bitmap decode path as production (`renderableImageBlob` then `createImageBitmapAndData` semantics), sourced from one shared implementation. | Decode differences can hide regressions in orientation/format handling; parity coverage is only trustworthy if decode semantics match production and stay coupled as code evolves. | `web/packages/new/photos/services/ml/decode.ts`, `web/packages/new/photos/services/ml/blob.ts`, `desktop/scripts/ml_parity_host.js`, `desktop/scripts/ml_parity_runner.ts`, `infra/ml/tools/run_suite.sh` |+| 2026-02-13 | Start with strict schema + comparator + contract tests before platform runner wiring. | Provides immediate, automated parity coverage and a stable JSON contract while platform-specific runner implementations are still pending. | `infra/ml/test/ground_truth/schema.py`, `infra/ml/test/comparator/compare.py`, `infra/ml/test/tests/test_schema.py`, `infra/ml/test/tests/test_comparator.py` |+| 2026-02-13 | Use deterministic bootstrap golden generation from manifest-defined corpus metadata for initial suite bring-up. | Allows end-to-end tool validation (`generate_goldens` -> comparator -> report) without waiting for full Python model pipeline completion. | `infra/ml/test/tools/generate_goldens.py`, `infra/ml/test/ground_truth/manifest.json`, `infra/ml/test/tools/run_suite.sh` |+| 2026-02-16 | Point default parity corpus to `https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1` and verify each fixture by SHA-256 during bootstrap generation. | Aligns suite inputs with the dedicated maintained fixture set while preserving deterministic generation and reducing local corpus drift risk. | `infra/ml/test/ground_truth/manifest.json`, `infra/ml/test/tools/generate_goldens.py`, `infra/ml/test/ground_truth/README.md` |+| 2026-02-16 | Keep all parity outputs ephemeral (gitignored), generated fresh on each suite run. | Avoids stale checked-in artifacts and ensures every comparison is based on current runner outputs over the same fixture set. | `infra/ml/.gitignore`, `infra/ml/test/ground_truth/goldens/`, `infra/ml/test/tools/run_suite.sh` |+| 2026-02-16 | Implement Python ground truth using trusted library primitives (Pillow/OpenCV/ORT), avoiding handwritten interpolation and NMS logic. | Keeps the reference pipeline easier to audit and maintain while still mirroring the mobile `analyzeImageStatic` flow and model behavior. | `infra/ml/test/ground_truth/_runtime.py`, `infra/ml/test/ground_truth/clip.py`, `infra/ml/test/ground_truth/face_detection.py`, `infra/ml/test/ground_truth/face_alignment.py`, `infra/ml/test/ground_truth/face_embedding.py`, `infra/ml/test/ground_truth/pipeline.py` |+| 2026-02-16 | Desktop runner orchestration is dependency-aware and non-fatal by default when desktop/web node installs are absent. | Preserves one-command suite usability in Python-only environments while still auto-running real desktop parity when prerequisites exist; strict mode can still fail on missing outputs. | `infra/ml/test/tools/run_suite.sh`, `desktop/scripts/ml_parity_runner.ts`, `desktop/scripts/ml_parity_host.js` |+| 2026-02-16 | Desktop parity decode must use the same conversion+bitmap decode path as production (`renderableImageBlob` then `createImageBitmapAndData` semantics), sourced from one shared implementation. | Decode differences can hide regressions in orientation/format handling; parity coverage is only trustworthy if decode semantics match production and stay coupled as code evolves. | `web/packages/new/photos/services/ml/decode.ts`, `web/packages/new/photos/services/ml/blob.ts`, `desktop/scripts/ml_parity_host.js`, `desktop/scripts/ml_parity_runner.ts`, `infra/ml/test/tools/run_suite.sh` || 2026-02-17 | Mobile parity runners should not abort the full platform run on single-fixture decode/inference errors; they should continue and emit partial results plus per-file errors. | This preserves runner reliability and enables comparator-based reporting (`missing_files` + drift findings) instead of hard runner failure when platform-specific decode/plugin behavior differs. | `mobile/apps/photos/integration_test/ml_parity_shared.dart` |-| 2026-02-17 | Treat Phase 4 as ongoing maintenance, not as a completion gate for the initial parity framework rollout. | Allows the branch to be considered complete once W1-W10 are done, while keeping corpus growth and threshold tightening as continuous quality work over time. | `infra/ml/ml-indexing-parity-test-plan.md` |-| 2026-02-17 | Keep parity CI as explicit manual invocation only (`workflow_dispatch`) with no automatic PR/push/schedule triggers. | Matches branch policy for resource-intensive/device-dependent parity runs and prevents accidental automatic execution while W10 docs/maintenance hardening are still in progress. | `.github/workflows/ml-indexing-parity.yml`, `infra/ml/ml-indexing-parity-test-plan.md` |+| 2026-02-17 | Treat Phase 4 as ongoing maintenance, not as a completion gate for the initial parity framework rollout. | Allows the branch to be considered complete once W1-W10 are done, while keeping corpus growth and threshold tightening as continuous quality work over time. | `infra/ml/test/ml-indexing-parity-test-plan.md` |+| 2026-02-17 | Keep parity CI as explicit manual invocation only (`workflow_dispatch`) with no automatic PR/push/schedule triggers. | Matches branch policy for resource-intensive/device-dependent parity runs and prevents accidental automatic execution while W10 docs/maintenance hardening are still in progress. | `.github/workflows/ml-indexing-parity.yml`, `infra/ml/test/ml-indexing-parity-test-plan.md` |+| 2026-02-17 | Split `infra/ml` into `playground/` (experiments) and `test/` (parity framework), while keeping `pyproject.toml` at `infra/ml` as shared environment config. | Gives clean ownership boundaries for contributors and makes parity test commands/docs self-contained under `infra/ml/test` without introducing a second Python environment. | `infra/ml/README.md`, `infra/ml/playground/README.md`, `infra/ml/test/README.md`, `infra/ml/test/tools/run_suite.sh`, `infra/ml/test/tools/generate_goldens.py` |### Open Questions / Blockers| Date | Owner | Blocker | Unblocked By |@@ -204,11 +206,11 @@ This gives immediate safety without blocking on architectural alignment work.## Corpus and Ground Truth Storage1. Corpus source: `https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1`.2. Ground truth config in main repo:-- `infra/ml/ground_truth/README.md`-- `infra/ml/ground_truth/manifest.json`+- `infra/ml/test/ground_truth/README.md`+- `infra/ml/test/ground_truth/manifest.json`3. Runtime-only (gitignored) parity artifacts:-- `infra/ml/test_data/ml-indexing/v1/*` (downloaded fixture files)-- `infra/ml/out/parity/<platform>/results.json` and per-file outputs+- `infra/ml/test/test_data/ml-indexing/v1/*` (downloaded fixture files)+- `infra/ml/test/out/parity/<platform>/results.json` and per-file outputs4. Manifest includes:- corpus item id, source URL/path, SHA-256 (where available), file type, tags- expected face count ranges (optional)@@ -243,7 +245,7 @@ All runners emit the same schema:- Use desktop ML worker + web ML pipeline entrypoints.- Emit JSON in common schema.-4. Python runner (`infra/ml/tools/generate_goldens.py`)+4. Python runner (`infra/ml/test/tools/generate_goldens.py`)- Process the local fixture directory and emit python results in common schema to a gitignored output directory.## Comparator and Acceptance Rules@@ -270,13 +272,13 @@ All runners emit the same schema:3. Aggregate percentile gates must pass.## One-Command Local Execution-Entrypoint: `infra/ml/tools/run_suite.sh`+Entrypoint: `infra/ml/test/tools/run_suite.sh`Default behavior:-1. Create/clear a local gitignored fixture directory (for example `infra/ml/test_data/ml-indexing/v1`).+1. Create/clear a local gitignored fixture directory (for example `infra/ml/test/test_data/ml-indexing/v1`).2. Download all files from `https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1` into that directory.-3. Run/validate Python ground truth generation and write outputs under `infra/ml/out/parity/python/`.-4. Run desktop, Android, iOS parity runners (attempt all) and write outputs under `infra/ml/out/parity/<platform>/`.+3. Run/validate Python ground truth generation and write outputs under `infra/ml/test/out/parity/python/`.+4. Run desktop, Android, iOS parity runners (attempt all) and write outputs under `infra/ml/test/out/parity/<platform>/`.5. Compare outputs and print unified report.6. Clearly mark unavailable/failed platform runs.@@ -299,7 +301,7 @@ Trigger policy:Execution model:1. Single parity job on `macos-latest`.2. Job accepts manual inputs for `suite`, `platforms`, strictness flags, and optional device IDs.-3. Job runs `infra/ml/tools/run_suite.sh` and uploads `infra/ml/out/parity/**` artifacts.+3. Job runs `infra/ml/test/tools/run_suite.sh` and uploads `infra/ml/test/out/parity/**` artifacts.No automatic pull-request, push, or schedule triggers.@@ -329,7 +331,7 @@ No automatic pull-request, push, or schedule triggers.4. Phase 4 (ongoing maintenance, not a release gate): Expand corpus continuously and tighten thresholds where stable as fixtures and platform behavior evolve.## Assumptions and Defaults-1. Corpus is maintained in `https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1`; `run_suite.sh` downloads fixture files to `infra/ml/test_data/ml-indexing/v1` using each manifest item's `source_url`.+1. Corpus is maintained in `https://github.com/laurenspriem/test-fixtures/tree/ml_more_test_data/ml/indexing/v1`; `run_suite.sh` downloads fixture files to `infra/ml/test/test_data/ml-indexing/v1` using each manifest item's `source_url`.2. Parity outputs are runtime artifacts and are not committed; `run_suite.sh` regenerates them on each run.3. `run_suite.sh` fails if zero platform outputs are available for comparison, unless `--allow-empty-comparison` is passed.4. Mobile behavior is the setup reference for ground-truth implementation details in this phase.diff --git a/infra/ml/tests/conftest.py b/infra/ml/test/tests/conftest.pysimilarity index 100%rename from infra/ml/tests/conftest.pyrename to infra/ml/test/tests/conftest.pydiff --git a/infra/ml/tests/test_comparator.py b/infra/ml/test/tests/test_comparator.pysimilarity index 100%rename from infra/ml/tests/test_comparator.pyrename to infra/ml/test/tests/test_comparator.pydiff --git a/infra/ml/tests/test_schema.py b/infra/ml/test/tests/test_schema.pysimilarity index 100%rename from infra/ml/tests/test_schema.pyrename to infra/ml/test/tests/test_schema.pydiff --git a/infra/ml/tools/compare_parity_outputs.py b/infra/ml/test/tools/compare_parity_outputs.pysimilarity index 100%rename from infra/ml/tools/compare_parity_outputs.pyrename to infra/ml/test/tools/compare_parity_outputs.pydiff --git a/infra/ml/tools/generate_goldens.py b/infra/ml/test/tools/generate_goldens.pysimilarity index 87%rename from infra/ml/tools/generate_goldens.pyrename to infra/ml/test/tools/generate_goldens.pyindex 22098b2203..cb2aee7dbd 100755--- a/infra/ml/tools/generate_goldens.py+++ b/infra/ml/test/tools/generate_goldens.py@@ -30,6 +30,22 @@ def _git_revision(default: str = "local") -> str:return completed.stdout.strip() or default+def _repo_root(ml_dir: Path) -> Path:+ try:+ completed = subprocess.run(+ ["git", "-C", str(ml_dir), "rev-parse", "--show-toplevel"],+ capture_output=True,+ text=True,+ check=True,+ )+ except (subprocess.SubprocessError, FileNotFoundError):+ return ml_dir.parents[2]+ root = completed.stdout.strip()+ if not root:+ return ml_dir.parents[2]+ return Path(root)++def _resolve_repo_relative(path_value: str, *, repo_root: Path) -> Path:path = Path(path_value)if path.is_absolute():@@ -109,17 +125,17 @@ def main() -> int:)parser.add_argument("--manifest",- default="infra/ml/ground_truth/manifest.json",+ default="infra/ml/test/ground_truth/manifest.json",help="Path to manifest.json file.",)parser.add_argument("--output-dir",- default="infra/ml/ground_truth/goldens",+ default="infra/ml/test/ground_truth/goldens",help="Directory where generated parity files are written.",)parser.add_argument("--model-cache-dir",- default="infra/ml/.cache/onnx_models",+ default="infra/ml/test/.cache/onnx_models",help="Directory where ONNX models are cached locally.",)parser.add_argument(@@ -130,7 +146,7 @@ def main() -> int:args = parser.parse_args()ml_dir = Path(__file__).resolve().parents[1]- repo_root = ml_dir.parents[1]+ repo_root = _repo_root(ml_dir)manifest_path = _resolve_repo_relative(args.manifest, repo_root=repo_root)output_dir = _resolve_repo_relative(args.output_dir, repo_root=repo_root)diff --git a/infra/ml/tools/run_suite.sh b/infra/ml/test/tools/run_suite.shsimilarity index 95%rename from infra/ml/tools/run_suite.shrename to infra/ml/test/tools/run_suite.shindex 6763a726b6..d705647589 100755--- a/infra/ml/tools/run_suite.sh+++ b/infra/ml/test/tools/run_suite.sh@@ -1,9 +1,13 @@#!/usr/bin/env bashset -euo pipefail-ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"-ML_DIR="$ROOT_DIR/infra/ml"-MANIFEST_PATH="$ROOT_DIR/infra/ml/ground_truth/manifest.json"+ROOT_DIR="$(+ git -C "$(dirname "${BASH_SOURCE[0]}")" rev-parse --show-toplevel 2>/dev/null \+ || (cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)+)"+ML_DIR="$ROOT_DIR/infra/ml/test"+UV_PROJECT_DIR="$ROOT_DIR/infra/ml"+MANIFEST_PATH="$ROOT_DIR/infra/ml/test/ground_truth/manifest.json"TEST_DATA_DIR="$ML_DIR/test_data/ml-indexing/v1"SUITE="smoke"@@ -11,11 +15,11 @@ PLATFORMS="all"UPDATE_GOLDEN=falseFAIL_ON_MISSING_PLATFORM=falseALLOW_EMPTY_COMPARISON=false-OUTPUT_DIR="$ROOT_DIR/infra/ml/out/parity"+OUTPUT_DIR="$ROOT_DIR/infra/ml/test/out/parity"usage() {cat <<EOF-Usage: infra/ml/tools/run_suite.sh [flags]+Usage: infra/ml/test/tools/run_suite.sh [flags]Flags:--suite smoke|full@@ -152,8 +156,8 @@ PYecho "Downloaded fixture files: $downloaded_count"echo "Generating Python goldens"-uv run --project "$ML_DIR" --no-sync --with pillow-heif python "$ML_DIR/tools/generate_goldens.py" \- --manifest "infra/ml/ground_truth/manifest.json" \+uv run --project "$UV_PROJECT_DIR" --no-sync --with pillow-heif python "$ML_DIR/tools/generate_goldens.py" \+ --manifest "infra/ml/test/ground_truth/manifest.json" \--output-dir "$PYTHON_OUTPUT_DIR"declare -a selected_platforms=()@@ -515,7 +519,7 @@ ficompare_output="$OUTPUT_DIR/comparison_report.json"compare_cmd=(- uv run --project "$ML_DIR" --no-sync python "$ML_DIR/tools/compare_parity_outputs.py"+ uv run --project "$UV_PROJECT_DIR" --no-sync python "$ML_DIR/tools/compare_parity_outputs.py"--ground-truth "$PYTHON_OUTPUT_DIR/results.json"--output "$compare_output")diff --git a/mobile/apps/photos/integration_test/ml_parity_shared.dart b/mobile/apps/photos/integration_test/ml_parity_shared.dartindex ff95493487..eceebbc76c 100644--- a/mobile/apps/photos/integration_test/ml_parity_shared.dart+++ b/mobile/apps/photos/integration_test/ml_parity_shared.dart@@ -140,7 +140,7 @@ void _validatePlatform(String expectedPlatform) {List<_ManifestItem> _loadManifestItems() {if (_manifestB64.isEmpty) {throw StateError(- "Missing ML_PARITY_MANIFEST_B64 dart define; run via infra/ml/tools/run_suite.sh",+ "Missing ML_PARITY_MANIFEST_B64 dart define; run via infra/ml/test/tools/run_suite.sh",);}final manifestBytes = base64Decode(_manifestB64);