Compare commits

..

No commits in common. "3a5f0962de80cd98114979f1341fabe5bdebeebd" and "aab51eed2dea9daabb67d2a81af03186cc173513" have entirely different histories.

5 changed files with 3 additions and 134 deletions

View File

@ -138,14 +138,6 @@ repos:
- repo: local
hooks:
# Fails a commit that still points crdt_sync at a local path. Local
# tests would go green against a library CI has never seen, silently.
- id: crdt-sync-override
name: no local crdt_sync dependency_override
entry: bash scripts/check_no_crdt_sync_override.sh stronglift_replacement/workout_app/pubspec.yaml
language: system
pass_filenames: false
always_run: true
- id: shellcheck
name: shellcheck
entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n 40 shellcheck --severity=warning' --

View File

@ -57,14 +57,7 @@ class RunnerUpDbMixin:
root=True,
)
if not ok:
_logger.warning(
"Root DB pull failed for %s (%s) — this device likely has no "
"root/su access, so this fallback path cannot work here. "
"RunnerUp workouts can only be verified via TCX export files; "
"enable RunnerUp's File Synchronizer auto-export on-device.",
pkg,
err,
)
_logger.info("Failed to copy RunnerUp DB to sdcard: %s", err)
shutil.rmtree(tmp_dir, ignore_errors=True)
return None
@ -149,12 +142,7 @@ class RunnerUpDbMixin:
"""Verify today's run via root DB pull (fallback path)."""
db_path = self._pull_runnerup_db()
if db_path is None:
return (
"not_verified",
"No TCX export found and root DB access is unavailable on this "
"device — enable RunnerUp's File Synchronizer auto-export so "
"runs land in /sdcard/Documents/RunnerUp/",
)
return "not_verified", "Could not retrieve RunnerUp database from phone"
try:
run_data = self._query_todays_run(db_path)

View File

@ -138,14 +138,6 @@ class RunnerUpVerificationMixin(RunnerUpDbMixin):
today = datetime.now(tz=timezone.utc).strftime("%Y-%m-%d")
exports = self._find_runnerup_exports_for_date(today)
if not exports:
_logger.warning(
"No RunnerUp TCX export found for %s in %s — a run today will "
"not be verified unless RunnerUp's File Synchronizer "
"auto-export is enabled and the app stays enabled long enough "
"to sync (check it isn't disabled by focus mode).",
today,
RUNNERUP_EXPORT_DIRS,
)
return None
# Try each file; return the best result (verified > validation error).
@ -182,13 +174,6 @@ class RunnerUpVerificationMixin(RunnerUpDbMixin):
continue
status, msg = self._validate_runnerup_data(data)
if status != "verified":
_logger.warning(
"RunnerUp export %s for %s did not qualify (%s): %s",
remote,
date_str,
status,
msg,
)
continue
workout_data = {
"type": "runnerup_verified",
@ -300,6 +285,5 @@ class RunnerUpVerificationMixin(RunnerUpDbMixin):
return file_result
# Path 2: root DB pull (fallback when no export files found yet).
# On a non-rooted device this path cannot succeed; _verify_runnerup_via_db
# reports that plainly rather than as a generic failure.
_logger.info("No TCX exports found today; trying root DB pull...")
return self._verify_runnerup_via_db()

View File

@ -234,15 +234,8 @@ class ScreenLocker(
``workout-sync.timer`` unit calls. Sync used to happen only inside the
locker's startup path, so a workout finished after login stayed
invisible until the next login.
Also re-runs the RunnerUp TCX backfill here, not just at login: the
login-time scan gets exactly one shot, and if the phone isn't
adb-visible at that instant (e.g. USB debugging not yet
authorized), a same-day run stays uncredited until the next login.
Repeating it every 15 minutes closes that gap.
"""
self._ingest_synced_manual_workouts()
self._auto_fill_week_runnerup_bonus()
def _ingest_synced_manual_workouts(self) -> None:
"""Sync manual workouts: publish this PC's, ingest everyone else's.

View File

@ -1,88 +0,0 @@
#!/bin/bash
# ============================================================================
# Fail if a pubspec still overrides crdt_sync with a local path.
#
# The apps depend on crdt_sync as a *git dependency pinned to a tag*, so what
# CI builds is whatever that tag points at. A `dependency_overrides:` entry
# pointing at ~/utils/crdt_sync_dart is invaluable while developing an unreleased
# library change -- and catastrophic if it survives the commit: local tests go
# green against code CI has never seen, and the failure is silent in both
# directions.
#
# A comment in the pubspec asking someone to remember is deployment hygiene,
# not a fix. This is the gate.
#
# Usage: check_no_crdt_sync_override.sh [pubspec.yaml ...]
# With no arguments, checks ./pubspec.yaml.
# ============================================================================
set -euo pipefail
SCRIPT_NAME="$(basename "$0")"
readonly SCRIPT_NAME
usage() {
echo "Usage: $SCRIPT_NAME [pubspec.yaml ...]"
echo " Fails when a pubspec overrides crdt_sync with a local path."
exit 0
}
# Returns 0 (found) when the file has a crdt_sync entry under
# dependency_overrides. Deliberately a small state machine rather than a grep:
# `path:` appears under plenty of other keys, and a false positive here blocks
# a legitimate commit.
has_override() {
local file="$1"
awk '
# Track indent depth explicitly. An earlier version used an awk
# interval expression ({1,4}) to spot a sibling key, which plain awk
# does not enable by default -- so the check silently never fired and
# reported every file clean. A safety check that fails open is worse
# than none, so this version is written to be obvious instead of terse.
function indent(line, n) {
n = match(line, /[^ ]/)
return (n == 0) ? 0 : n - 1
}
/^[[:space:]]*#/ { next } # comments
/^[[:space:]]*$/ { next } # blank lines
/^dependency_overrides:[[:space:]]*$/ { in_overrides = 1; next }
/^[^[:space:]]/ { in_overrides = 0; in_crdt = 0; next }
in_overrides {
if ($0 ~ /^[[:space:]]+crdt_sync:[[:space:]]*$/) {
in_crdt = 1
crdt_indent = indent($0)
next
}
# Any key at or above crdt_sync{s} own indent ends its block.
if (in_crdt && indent($0) <= crdt_indent) { in_crdt = 0 }
if (in_crdt && $0 ~ /^[[:space:]]+path:/) { found = 1 }
}
END { exit(found ? 0 : 1) }
' "$file"
}
main() {
local -a files=("$@")
if [[ ${#files[@]} -eq 0 ]]; then
files=("pubspec.yaml")
fi
local failed=0
for file in "${files[@]}"; do
[[ -f "$file" ]] || continue
if has_override "$file"; then
echo "Error: $file still has a local crdt_sync dependency_override." >&2
echo " Remove it and bump the git 'ref:' to the released tag" >&2
echo " before committing, or CI will build different code." >&2
failed=1
fi
done
return "$failed"
}
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
usage
fi
main "$@"