Add CI workflow and API sync test to catch command drift#18
Merged
Conversation
Adds a GitHub Actions CI workflow that runs lint and tests on every PR and push to main — previously only release tags triggered any CI. Adds src/api-sync.test.ts which fetches the live OpenAPI spec and hard-fails if: - client.ts has commands the server no longer exposes (stale) - the server has endpoints not yet in client.ts (missing) Undocumented-but-confirmed endpoints are tracked in UNDOCUMENTED_IN_SPEC (get_location, storage, deposit_credits, withdraw_credits, drone commands, v2 state commands). Running the test found and fixes several more stale/missing commands: - Removed: buy_ship, get_ships (explicitly deprecated by server), get_recipes, shipyard_showroom, set_anonymous (all 404) - Added: fleet, get_notifications, name_ship (in spec but missing from client) Skips gracefully on 429 (rate limiting) rather than failing CI. Set SKIP_API_SYNC=1 to skip locally.
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
.github/workflows/ci.yml— runs lint + tests on every PR and push to main (previously only release tags triggered any CI)src/api-sync.test.ts— fetches the live OpenAPI spec and hard-fails if client.ts has stale commands (not in API) or is missing commands (in API but not in client)How the API sync test works
Fetches
https://game.spacemolt.com/api/openapi.jsonand diffs it against theCOMMANDSblock inclient.ts. Two failure modes:Undocumented-but-verified endpoints (v2 state commands, drone commands,
get_location,storage, etc.) are tracked in a namedUNDOCUMENTED_IN_SPECset so they don't spuriously fail.Skips gracefully on HTTP 429 (rate limiting) rather than failing CI. Set
SKIP_API_SYNC=1to skip locally.Additional command fixes found by the test
Removed (all confirmed 404 or explicitly deprecated by server):
buy_ship— server says "use browse_ships or commission_ship"get_ships— server returns explicit deprecation messageget_recipes,shipyard_showroom,set_anonymousAdded (in spec but missing from client):
fleet— coordinated movement/combatget_notifications— fetch queued notificationsname_ship— set a custom ship nameInspired by PR #16
PR #16 by @rsned tried to build a similar thing but compared CLI output to raw API responses (wrong approach — the client intentionally formats data). This takes the right approach: structural comparison between client command list and API spec.