Add apl-feed CLI improvements#10
Merged
Merged
Conversation
Replaces the never-invoked claim_secret_register.sh helper with a single dispatcher implementing the Phase 3 commands: status, claim register/show/rotate/rotate --abort, backup, restore. update.sh now installs apl-feed and runs claim registration after service health checks; failures soft-warn and the install continues.
Splits the 1000-line apl-feed dispatcher into 5 sourced lib modules under scripts/apl-feed/ (common, http, claim, status, backup). Lifts the update.sh registration wrapper into scripts/lib/claim-registration.sh so it can be unit-tested. New surface: status --json (machine-readable output), status 'Website feed' check using last_seen_at from the website status response, restore --check to validate a backup file without writing, created_at field in backup files, explicit rejection of inapplicable flags per subcommand. Cross-repo contract fixture at test/contracts/feeder-api-v1.json (mirrored on the website) is the canonical request/response source. Both the bats suites and the website's DRF contract test load the same JSON; drift between client and server fails one or the other test. Adds test/test_update_claim_registration.bats covering both the helper's stub-success/stub-fail behavior and the structural invariant that update.sh sources the lib and calls register_claim_secret after the service health checks.
common.sh: SERVER_URL, MAX_RETRY_TIME, DRY_RUN, FORCE are written here and read by sibling modules sourced from the dispatcher. Standalone shellcheck doesn't follow the source graph so the per-file analysis flags them as unused. Per-line disables document the cross-module read. test_apl_feed_cli.bats: the status test asserted Result text that depends on whether the host runner has systemctl, an active feed service, and an established socket on port 31090. Stub systemctl, nc, and ss in setup so checks resolve to ok regardless of host. Updated assertion to match the now-deterministic 'feeding looks healthy' result.
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
Replaces the never-invoked
claim_secret_register.shhelper with a structuredapl-feedCLI installed at/usr/local/bin/apl-feed, and wires it intoupdate.shso installs/updates auto-register the feeder's claim secret with airplanes.live.CLI surface