Repository navigation
Check in the movement API what the app's wizard requires - #925
Merged
Merged
Conversation
The app hides the runway for helicopters where the aerodrome sets aerodrome.noRunwayIfHelicopter. The movement API is to check the runway like the app's wizard, so it needs the same setting: generateServerConfig emits it as a boolean (false when absent, a non-boolean fails the deploy) and the movement policy carries it. It is not part of the database rules.
The database rules (and so the movement domain) require neither a runway nor a flight type that fits the aircraft category, the app's wizard does. Other API clients, the Open Digital MCP hub first, could record movements the app would not: a departure through Claude had no runway. checkAppRules adds both checks to saveMovement, for the API only: - a runway, except for helicopters where noRunwayIfHelicopter is set - a flight type with an airstat code for the category's aircraft type (getEnabledFlightTypes), reason not-for-aircraft-category; tables from reports/airstat/tables.js, which has client parity tests Not in the rules, since movements stored before may lack a runway or carry another category's flight type: a create is checked as a whole, an update only in what it writes (payment method and customs saves are unaffected). Test inputs now send a runway like the app does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The movement API (#922) checks writes against the database rules. The rules require neither a runway nor a flight
type that fits the aircraft category, but the app's wizard does. A client other than the app could therefore record
movements the app would not. That happened through the Open Digital MCP hub (#923): a departure recorded in Claude
had no runway. The hub now asks for both itself (odch/mcp-hub
17897fa). This PR makes the API check the same rules,so that no client can skip them.
Commits
Pass noRunwayIfHelicopter to the functions. The app hides the runway for helicopters where
aerodrome.noRunwayIfHelicopteris set (lsze, lspl, lspv, lszi, lszm, lszo).generateServerConfignow emitsit as a boolean in the aerodrome:
falsewhen absent, and a non-boolean fails the deploy. The movement policycarries it too. It does not go into the database rules.
Check in the movement API what the app's wizard requires. The new
functions/movements/domain/checkAppRules.jsis called bysaveMovementaftervalidateMovement:required), except for helicopters wherenoRunwayIfHelicopteris set. This mirrorsvalidate.tsxand the flight page containers.getEnabledFlightTypes).Otherwise the reason is the new
not-for-aircraft-category:glider_*only for gliders, no aerotow forhelicopters,
saronly for helicopters, and so on. The tables come fromreports/airstat/tables.js, whichalready has parity tests against the client.
Unknown flight types and categories stay
validateMovement's job (not-allowed).Why not in the rules
Movements stored before may lack a runway or carry a flight type of another category. Therefore:
runwayoraircraftCategoryis written, theflight type when
flightTypeoraircraftCategoryis written.The domain/rules parity table (
movementCases,decide) is unchanged in meaning. Its inputs now carry a runwaylike the app sends, which the rules accept.
Test plan
checkAppRules.spec.js:runway or category;
validateMovement.saveMovement.spec.js:movementRoutes.spec.js: 400 with both validation errors.policy.spec.jsandgenerateServerConfig.spec.js: the flag, including client__CONF__parity for everyproject.
npm test: 354 suites / 7873 testsnpm run typechecknpm run test:functions: 109 suites / 4639 testsnpm run test:rules(database emulator): rule assertions; domain/rules parity lsze 596/596, lszt 578/578,lspv 578/578, lsze-lockOnDateTime 596/596; movement API writes
e2e/run.sh): the real movement routes of this branch behind the reallogin and hub, 18/18
Generated by Claude Code