Skip to content

Add photo station capture and reuse workflow - #137

Draft
noobydp wants to merge 3 commits into
tracefinity:mainfrom
noobydp:codex/photo-stations-capture-reuse
Draft

Add photo station capture and reuse workflow#137
noobydp wants to merge 3 commits into
tracefinity:mainfrom
noobydp:codex/photo-stations-capture-reuse

Conversation

@noobydp

@noobydp noobydp commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds the full reusable photo-station workflow to tracing. Users can capture from a camera, crop the capture area, reuse a saved station's corners when the setup matches, save the current setup as a new station, and continue into a save-and-new loop for repeated captures.

The PR includes:

  • a /trace camera capture page
  • capture crop overlay controls
  • station-aware upload metadata
  • station suggestions in the trace corner step
  • one-click reuse of matching station corners
  • corner redetection from the trace page
  • save-as-station support while confirming corners
  • save-and-new flow for repeated station captures
  • frontend API tests for station request payloads and capture upload metadata

Dependency

This PR depends on #135 and #136.

Because these branches live in a fork and the base repository does not have the stacked base branches, this PR targets main. Until the earlier PRs land, GitHub's diff may include commits from those PRs as part of the stacked branch history.

Implementation Notes

This PR depends on the backend APIs and management UI from the previous two PRs.

The capture page can receive a selected station and pass that station id through upload. When the backend can apply the saved station during upload, the trace editor reflects that reused station state. If the station does not match the current image, the UI disables non-matching station options and reports a warning rather than silently applying bad corners.

The trace editor station logic was extracted into a dedicated usePhotoStations hook. That keeps station suggestions, reuse, redetect, active station state, save-as-station state, and station notices out of the already-large trace page component.

This also addresses review feedback from the original larger PR:

  • Wraps startCamera in useCallback.
  • Removes duplicated station-state logic from the trace page.
  • Adds frontend test coverage for the API request shapes used by the station workflow.

Tests

  • corepack pnpm@10.29.2 --dir frontend exec vitest run
  • corepack pnpm@10.29.2 --dir frontend lint
  • corepack pnpm@10.29.2 --dir frontend exec tsc --noEmit
  • python -m pytest backend/tests/test_photo_stations.py

Code and PR drafted with Codex

@jasonmadigan jasonmadigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @noobydp

Comment thread backend/app/api/routes.py Outdated
Comment thread backend/app/api/routes.py
Comment thread backend/app/models/schemas.py
Comment thread backend/app/models/schemas.py Outdated
Comment thread backend/app/services/photo_station_store.py Outdated
Comment thread backend/tests/test_photo_stations.py
Comment thread backend/app/api/routes.py
@noobydp
noobydp force-pushed the codex/photo-stations-capture-reuse branch from e308c71 to 77dbad3 Compare August 2, 2026 08:46
@noobydp

noobydp commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Updated this branch after review and rebased it onto current main, still stacked on PRs #135 and #136.

Changes made in this update:

  • Capture crop now runs before downscale through the ingestion path, so cropped station captures keep the intended resolution.
  • Station dimension mismatch is checked before upload persistence, preventing orphaned uploads when a saved station does not match the incoming image.
  • Capture and reuse flows respect the PHOTO_STATIONS feature flag and hide station-only UI when disabled.
  • Removed the unused station_image_path mirror from frontend types following the backend cleanup in Add photo station backend #135.
  • Added API coverage for capture upload params, station reuse params, and guarded station endpoints.
  • Added backend coverage for finite crop/corner validation, y-axis corner scaling, stale dimension rejection, and station suggestions.

Local validation:

  • python -m ruff check backend
  • python -m pytest tests/test_photo_stations.py
  • python -m pytest -k "not TestPermissionError" on Windows: 318 passed, 8 deselected for the existing Windows-only permission fixture issue.
  • corepack pnpm lint using the repo-declared pnpm@10.29.2: 0 errors, 9 existing warnings.
  • corepack pnpm exec tsc --noEmit

Code and PR drafted with Codex

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.

2 participants