Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Minor script improvements

laurenspriemfa1cef177380
diff --git a/infra/ml/ml-indexing-parity-test-plan.md b/infra/ml/ml-indexing-parity-test-plan.md
index c38a3d2e4e..7eedbffac4 100644
--- a/infra/ml/ml-indexing-parity-test-plan.md
+++ b/infra/ml/ml-indexing-parity-test-plan.md
@@ -268,7 +268,8 @@ Flags:
2. `--platforms all|desktop|android|ios`
3. `--update-golden`
4. `--fail-on-missing-platform`
-5. `--output-dir ...`
+5. `--allow-empty-comparison` (optional override when intentionally running without any platform outputs)
+6. `--output-dir ...`
Target runtime: 10-20 minutes for full local run (with caching).
@@ -315,5 +316,6 @@ No automatic run for unrelated PRs.
## Assumptions and Defaults
1. Corpus is maintained in `ente-io/test-fixtures` at `ml/indexing/v1`; `run_suite.sh` downloads fixture files to `infra/ml/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. Mobile behavior is the setup reference for ground-truth implementation details in this phase.
-4. Missing local platform support is reported clearly by default, not automatically fatal unless strict mode is enabled.
+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.
+5. Missing local platform support is reported clearly by default, not automatically fatal unless strict mode is enabled.
diff --git a/infra/ml/tools/run_suite.sh b/infra/ml/tools/run_suite.sh
index 2601473081..3c21bdd1ca 100755
--- a/infra/ml/tools/run_suite.sh
+++ b/infra/ml/tools/run_suite.sh
@@ -10,6 +10,7 @@ SUITE="smoke"
PLATFORMS="all"
UPDATE_GOLDEN=false
FAIL_ON_MISSING_PLATFORM=false
+ALLOW_EMPTY_COMPARISON=false
OUTPUT_DIR="$ROOT_DIR/infra/ml/out/parity"
usage() {
@@ -21,6 +22,7 @@ Flags:
--platforms all|desktop|android|ios
--update-golden
--fail-on-missing-platform
+ --allow-empty-comparison
--output-dir <path>
EOF
}
@@ -43,6 +45,10 @@ while (($# > 0)); do
FAIL_ON_MISSING_PLATFORM=true
shift
;;
+ --allow-empty-comparison)
+ ALLOW_EMPTY_COMPARISON=true
+ shift
+ ;;
--output-dir)
OUTPUT_DIR="$2"
shift 2
@@ -66,6 +72,7 @@ fi
mkdir -p "$OUTPUT_DIR"
OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd -P)"
PYTHON_OUTPUT_DIR="$OUTPUT_DIR/python"
+rm -rf "$PYTHON_OUTPUT_DIR"
mkdir -p "$PYTHON_OUTPUT_DIR"
echo "Running ML parity suite"
@@ -96,7 +103,19 @@ while IFS=$'\t' read -r source_rel source_url source_sha; do
mv "$tmp_path" "$target_path"
if [[ -n "$source_sha" ]]; then
- actual_sha="$(shasum -a 256 "$target_path" | awk '{print $1}')"
+ actual_sha="$(
+ python3 - "$target_path" <<'PY'
+import hashlib
+import sys
+
+path = sys.argv[1]
+digest = hashlib.sha256()
+with open(path, "rb") as file:
+ for chunk in iter(lambda: file.read(1024 * 1024), b""):
+ digest.update(chunk)
+print(digest.hexdigest())
+PY
+ )"
if [[ "$actual_sha" != "$source_sha" ]]; then
echo "SHA-256 mismatch for $source_rel: expected $source_sha got $actual_sha" >&2
exit 1
@@ -140,6 +159,13 @@ case "$PLATFORMS" in
;;
esac
+echo "Clearing stale platform output directories"
+for platform in "${selected_platforms[@]}"; do
+ platform_dir="$OUTPUT_DIR/$platform"
+ rm -rf "$platform_dir"
+ mkdir -p "$platform_dir"
+done
+
declare -a compare_args=()
missing_platform_count=0
@@ -159,6 +185,15 @@ if $FAIL_ON_MISSING_PLATFORM && ((missing_platform_count > 0)); then
exit 1
fi
+if ((${#compare_args[@]} == 0)); then
+ if $ALLOW_EMPTY_COMPARISON; then
+ echo "No platform outputs available; continuing because --allow-empty-comparison is set"
+ else
+ echo "No platform outputs available for comparison. Provide at least one platform result or use --allow-empty-comparison." >&2
+ exit 1
+ fi
+fi
+
compare_output="$OUTPUT_DIR/comparison_report.json"
compare_cmd=(
uv run --project "$ML_DIR" --no-sync python "$ML_DIR/tools/compare_parity_outputs.py"