Skip to content

Audit fixes: disk retention, prep/train UI, shared uploads, telemetry redaction - #33

Merged
pgodlews merged 4 commits into
mainfrom
claude/audit-fixes-a
Nov 12, 2026
Merged

pgodlews merged 4 commits into
mainfrom
claude/audit-fixes-a

Conversation

@pgodlews

Copy link
Copy Markdown
Owner

A full audit of the repository, written up as AUDIT_FIXES.md (instructions for coding agents), and the fixes for everything in it that did not need an owner's decision. Two commits.

Broken

  • Disk retention: stage directories left by failed or cancelled builds were in no cache entry, so nothing ever evicted them. They are now removed before any valid entry (no valid .done, no live lock, not protected, idle 10 min). QUEUE_RUN_KEEP_DAYS (30) prunes the large tars in runs/ of jobs that ended long ago.
  • Stitched perspective SfM: 32_pick_model.py counted images (12 per panorama), so the 50 % registration floor never fired. It now counts rig frames. New key term STITCHED_SFM, on perspective_* renders only; spherical and fisheye keys are unchanged.
  • Web UI on prep and train installs: new "Stop after" (run_until), defaulting to sfm on a prep install or a Mac; the train image shows an import panel for handoff bundles; a prep job links its bundle.
  • compose.yaml passes .env into the container (env_file, Compose 2.24+), with PORT pinned to 8090 inside.
  • Estimates zero the stages after run_until.
  • Resumed jobs get their stage rows at creation, so retention protects what they resume from.
  • One 90 % rig registration threshold, shared by 88_fisheye_sfm.py and 85_fisheye_dataset.py.
  • Telemetry keeps only the flag names of train.extra_args, never their values.
  • worker.exclusive() clears its hold if the GPU probe raises.

Checked, not a bug

  • --steps-scaler printed with %g: LichtFeld 09d33818 scales with lround in float32, which gives back every iter from 100 to 300000 exactly. A test now pins that.

Inconsistent

  • Stale two-pass SfM comments, docstrings and lab-notebook defaults.
  • Script worker pools follow SPLAT_THREADS; one _flag() parser.
  • deploy.sh ships every test suite; scripts/ is mirrored with --delete.
  • README presets match the UI; undocumented settings and routes documented.
  • app/osv.py loads the scripts/ .OSV readers and reports a failed import instead of failing silently.
  • Debug bundles blank the camera serial; the GPS reference in alignment.json is documented.

Inefficient

  • app/uploads.py replaces four copies of the upload code. The result tar is hashed while written and streamed, no longer read into memory.
  • GPU uuid map cached; VramSampler removed, the VRAM peak comes from the resource sampler.
  • /api/jobs reads stages and metrics in two queries per page.
  • detect_camera reads only the start of the telemetry, cached.
  • The frames stage no longer writes the unused telemetry.csv (GPS fixes).

Not verified here (no GPU, pycolmap or Docker on the machine that made this)

  • A perspective_* stitched job end to end (the 32_pick_model.py change).
  • docker compose config / up with settings in .env.
  • A fisheye job end to end with the calibration-only frames stage.

All 17 suites from AGENTS.md pass locally, as do the queue/app heavy-import guardrail and shellcheck. The web UI was checked in a browser against services started as the prep and train images.

Owner's call (left open, listed in AUDIT_FIXES.md)

B5 version text in the README, B6 measurements on LichtFeld 0.5.4, B13 the GPS reference in debug bundles, B14 the numpy pin, C5 and C7 (cache contents and keys), and whether scripts/detect_camera.py and QUEUE_MASK_PY stay.

… passthrough

Add AUDIT_FIXES.md (full audit as instructions for coding agents) and fix
its first items:

- A1: 32_pick_model.py counts registered rig frames, not images, so the
  stitched registration floor works for perspective_* renders. New key term
  STITCHED_SFM (perspective renders only) so entries cached without the
  check are rebuilt; spherical and fisheye keys are unchanged.
- A2: not a bug. LichtFeld scales steps with lround in float32, which
  recovers every iter from 100 to 300000 from the %g scaler; a test now
  pins that.
- A3: retention evicts stage dirs left by failed or cancelled builds (no
  valid .done, no live lock, not protected, idle 10 min) before any cache
  entry, plus stale handoff staging dirs. QUEUE_RUN_KEEP_DAYS (30) prunes
  large tars in runs/ of jobs that ended long ago.
- A4: web UI gets "Stop after" (run_until), defaulting to sfm on prep
  installs; the train image shows an import panel for handoff bundles; a
  prep job links its bundle.
- A5: compose.yaml passes .env into the container (env_file), with PORT
  pinned to 8090 inside.
- A6: estimates zero the stages after run_until.

A1 is not yet run against pycolmap and A5 not checked with docker compose.
…ead code

Broken:
- A7: jobs resumed from a restore point get their stage rows at creation
  (new app/jobrows.py), so retention protects what they resume from.
- A8: one 90 % rig registration threshold, passed from 88_fisheye_sfm.py
  to 85_fisheye_dataset.py, so 85-90 % fails before refinement.
- A9: telemetry keeps only the flag names of train.extra_args; mask
  prompts go through the log redactor.
- A10: worker.exclusive() clears its hold if the GPU probe raises.

Inconsistent:
- Stale two-pass SfM comments, docstrings and lab-notebook defaults fixed;
  the estimate's SfM seed is labelled as predating fisheye-sfm-4.
- Script worker pools follow SPLAT_THREADS; one _flag() parser in config.
- deploy.sh ships every test suite; deploy.sh and run_mac.sh mirror
  scripts/ with --delete; publish_image.sh shellcheck error fixed.
- README presets match the UI; undocumented settings and routes added to
  queue/README.md.
- Mask messages name the prompts, not "person".
- app/osv.py loads the scripts/ .OSV readers and reports a failed import
  at startup and as a 400 instead of failing silently.
- Telemetry reads cgroup memory (v1 and v2) and affinity from resources.py.
- Debug bundles blank the camera serial in calibration.json; the GPS
  reference in alignment.json is documented.

Inefficient:
- app/uploads.py replaces four copies of the upload code; the result tar
  is hashed while written and streamed instead of read into memory. A
  damaged-ETag result upload now backs off between retries like the others.
- GPU uuid map cached; VramSampler removed, the train VRAM peak comes from
  the resource sampler.
- /api/jobs reads stages and metrics in two queries per page.
- detect_camera reads only the start of the telemetry, cached by mtime.
- The frames stage asks osv_meta.py for the calibration only (no
  telemetry.csv with GPS fixes).
- Log streams end with their stage.

Dead code removed. AUDIT_FIXES.md marks what is left as the owner's call.
…ve detect_camera.py

- C5: 87_fisheye_masks.py deletes the panoramas it stitched for the
  detector once the masks are back on the fisheyes (success only). Nothing
  read them again; no cache key changes.
- C7: the select key hashes the field its mode does not read at its
  default (target_panos in window mode, window in target mode). Window-mode
  jobs with the default target_panos, which is every UI job, keep their
  keys; target-mode API jobs move once.
- scripts/detect_camera.py removed: nothing used it, and it printed the
  camera serial. The queue calls osv_meta.detect_camera directly.
- AUDIT_FIXES.md records these, and B5, B6 and B13 as decided.
@pgodlews
pgodlews merged commit 7637c8b into main Nov 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant