Skip to content

Give the seeded fly-scan Plan real defaults, and its Method a real schema - #767

Merged
xmap merged 1 commit into
mainfrom
fly-scan-plan-defaults
Sep 2, 2026
Merged

Give the seeded fly-scan Plan real defaults, and its Method a real schema#767
xmap merged 1 commit into
mainfrom
fly-scan-plan-defaults

Conversation

@xmap

@xmap xmap commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Every witnessed Run at 2-BM binds 2BM_fly_scan_plan_v1, and that Plan's default_parameters was {} — measured live on 2026-09-01, all 2031 witnessed runs carried effective_parameters == {}.
  • Declares a parameters_schema on the fly_scan Method (required first: Plan.default_parameters validates STRICT against it) and non-empty default_parameters on the Plan, wired through seed_acquisition_recipe so a fresh deployment seeds both.
  • The ordering was verified live against arcturus before touching any code: PATCHing defaults before POSTing the schema returns 400.
  • Plan defaults are explicitly flagged UNCONFIRMED in the code comment — read from baseline PV observations on the live host, not declared by 2-BM staff. Needs confirmation before the 2026-09-09 beamtime.
  • repetitions is declared with no default on purpose: angle count varies per scan.

Test plan

  • New integration test test_fly_scan_plan_declares_non_empty_defaults, mutation-verified (reverting the seeder wiring turns it red)
  • Full tests/integration/test_pilot_seed_postgres.py green, including the existing re-run-changes-nothing idempotency test
  • tests/unit/api/test_pilot_seed.py + tests/unit/recipe/ green (1325 tests)
  • ruff / pyright / tach clean
  • Already applied live to arcturus's Method/Plan via the REST API (this PR brings the seeder for fresh deployments in line with that)

🤖 Generated with Claude Code

…hema

Every witnessed Run at 2-BM binds 2BM_fly_scan_plan_v1 (the one Plan
CAPTURE_WATCH_PLAN_ID names), and that Plan's default_parameters was {}.
record_witnessed_run merges the Plan's declared defaults into a Run's
effective_parameters unmodified, so an empty Plan produces an empty Run:
measured live on 2026-09-01, all 2031 witnessed runs carried effective_
parameters == {}. The record said "this followed the fly scan plan" and
the fly scan plan said nothing.

Fixing this needed two writes in order: the Method (fly_scan) declares
no parameters_schema, and Plan.default_parameters validates STRICT
against it, so a non-empty default is rejected until the schema exists.
Verified live against arcturus before touching the seeder: PATCHing
defaults before POSTing the schema returns 400, confirming the ordering
is load-bearing, not incidental.

seed_acquisition_recipe now accepts optional parameters_schema /
default_parameters and applies them via the existing update slices
(idempotent no-op when unchanged, so a re-run against an
already-seeded deployment converges rather than duplicating events).
Wired for fly_scan only; dark_field/flat_field are unaffected. The
Plan defaults are explicitly flagged UNCONFIRMED: they were read from
baseline PV observations on the live host, not declared by 2-BM staff,
and need confirmation before the 2026-09-09 beamtime.

repetitions is declared in the schema with no default, on purpose: the
angle count varies per scan, so no single number is honest as a
Plan-level default. Per-run Plan selection (letting different scan
kinds bind different Plans) is deferred until the first beamtime shows
what actually varies.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  apps/api/src/cora/api
  pilot_seed.py
Project Total  

This report was generated by python-coverage-comment-action

@xmap
xmap merged commit c878b1d into main Sep 2, 2026
19 checks passed
@xmap
xmap deleted the fly-scan-plan-defaults branch September 2, 2026 08:40
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