Skip to content

refactor: move MAX_MACH to aircraft design namespace - #2

Merged
suhaslord merged 23 commits into
mainfrom
refactor/aircraft-design-max-mach
Aug 22, 2026
Merged

refactor: move MAX_MACH to aircraft design namespace#2
suhaslord merged 23 commits into
mainfrom
refactor/aircraft-design-max-mach

Conversation

@suhaslord

@suhaslord suhaslord commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Implements the repository-wide foundation for OpenMDAO#1046.

Why

MAX_MACH is an aircraft design property, but Aviary currently exposes and serializes it as Mission.Constraints.MAX_MACH. That leaks a mission-scoped name into FLOPS pre-mission sizing, aircraft input decks, validation data, and tests.

What changed

  • introduces canonical Aircraft.Design.MAX_MACH = 'aircraft:design:max_mach'
  • removes the duplicate mission-scoped Python hierarchy symbol so Aviary's variable namespace remains unique
  • migrates all in-repo Python consumers to Aircraft.Design.MAX_MACH
  • migrates aircraft CSVs, converter fixtures, validation models, JSON, and documentation notebook data to aircraft:design:max_mach
  • preserves compatibility for existing serialized input decks by normalizing the legacy raw key mission:constraints:max_mach before AviaryValues storage/access and CSV metadata validation
  • moves the metadata record into the alphabetically correct Aircraft.Design position and documents its FLOPS consumers
  • adds a migration contract test that prevents unapproved legacy references from reappearing
  • adds an idempotent migration/audit tool and a machine-readable manifest

Migration audit

The generated manifest records 50 migrated repository files, 57 Python-symbol replacements, and 24 serialized-key replacements. Compatibility-only files are deliberately excluded from the no-legacy-reference ratchet.

Scope

This is a namespace/data-model migration. The FLOPS equations themselves are unchanged. Full Aviary CI is validating numerical behavior and legacy input-deck compatibility before any upstream submission.

suhaslord and others added 21 commits August 21, 2026 18:46
- Make patch_metadata() idempotent by checking if MAX_MACH is already
  correctly positioned after MAX_FUSELAGE_PITCH_ANGLE with the expected
  description before making any changes
- Strip multiple blank lines when reinserting the MAX_MACH metadata block
  to ensure exactly one blank line separator is maintained
- Only rewrite the manifest when there are actual content migrations
  (python_symbol or serialized_key replacements > 0) to preserve the
  historical 50-file migration record on idempotent re-runs

This fixes the failing CI check that runs the migration tool twice
and expects zero git diff on the second run.

Co-authored-by: Suhas <suhaslord@users.noreply.github.com>
@cursor

cursor Bot commented Aug 22, 2026

Copy link
Copy Markdown

Fixed the "Verify MAX_MACH migration idempotence" CI check failure.

Issues Fixed

  1. patch_metadata() non-idempotence: The function was removing and re-inserting the Aircraft.Design.MAX_MACH metadata block on every run, which added extra blank lines before Aircraft.Design.MAX_STRUCTURAL_SPEED. The fix adds an early-return check that detects when MAX_MACH is already correctly positioned with the expected description.

  2. Manifest overwrite on no-op runs: The historical 50-file manifest was being replaced with a trivial 1-file record on idempotent re-runs. The fix now only rewrites the manifest when actual symbol/key replacements occur (python_symbol > 0 or serialized_key > 0).

Verification

The migration tool now passes the CI check:

python3 tools/migrate_max_mach_namespace.py --write --check
git diff --exit-code  # Clean on second run

Both runs produce zero git diff on codebase files, ensuring true idempotence.

cursoragent and others added 2 commits August 22, 2026 05:59
- Split long metadata_block call lines for readability
- Remove trailing whitespace from blank line

Fixes pre_commit/ruff-format CI check.

Co-authored-by: Suhas <suhaslord@users.noreply.github.com>
Ruff prefers the shorter call to fit on a single line for readability.

Co-authored-by: Suhas <suhaslord@users.noreply.github.com>
@cursor

cursor Bot commented Aug 22, 2026

Copy link
Copy Markdown

CI checks now passing

Both required checks are now green:

  • ✅ Verify MAX_MACH migration idempotence (run #32555923081)
  • ✅ pre_commit / ruff-format (passed in Aviary Tests)

The formatting fix ensures the migration script follows the ruff code style while maintaining idempotence.

@suhaslord
suhaslord marked this pull request as ready for review August 22, 2026 06:56
@suhaslord
suhaslord merged commit 283267d into main Aug 22, 2026
11 of 12 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.

2 participants