Skip to content

Add apl-feed CLI improvements#10

Merged
d4rken merged 3 commits into
devfrom
phase3-apl-feed-cli
Apr 29, 2026
Merged

Add apl-feed CLI improvements#10
d4rken merged 3 commits into
devfrom
phase3-apl-feed-cli

Conversation

@d4rken

@d4rken d4rken commented Apr 28, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the never-invoked claim_secret_register.sh helper with a structured apl-feed CLI installed at /usr/local/bin/apl-feed, and wires it into update.sh so installs/updates auto-register the feeder's claim secret with airplanes.live.

CLI surface

apl-feed status [--json]
apl-feed claim register
apl-feed claim show
apl-feed claim rotate [--abort]
apl-feed backup <file>
apl-feed restore <file> [--check] [--force]

d4rken added 3 commits April 28, 2026 21:14
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.
@d4rken d4rken changed the title Add apl-feed CLI for Phase 3 claim-secret + backup/restore Add apl-feed CLI improvements Apr 29, 2026
@d4rken d4rken marked this pull request as ready for review April 29, 2026 05:01
@d4rken d4rken added the enhancement New feature or request label Apr 29, 2026
@d4rken d4rken merged commit 0b2b2e6 into dev Apr 29, 2026
2 checks passed
@d4rken d4rken deleted the phase3-apl-feed-cli branch April 29, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant