Server gap pass: invite-partner subcommand, CLI and drain tests, push info log (D-113, D-114)

- kvitt-server invite-partner: a partner invite by the admin as E-12 does (cancels the pending one, 72 h, link with
  ?from=<admin>), exit 2 household full, 3 no admin; README lines in server/ and infra/.
- Tests: invite-partner, migrate (schema at SCHEMA_VERSION, idempotent), healthcheck (200, 503, nothing listening),
  serve SIGTERM drain (in-flight request finishes, new connections refused, exit 0; gives up after SHUTDOWN_DRAIN).
- Push sender: one info line "push sent" per message with push_type, devices_sent, devices_targeted and 8-character
  device-id tails (SPEC §8.7 aggregates); per-device line stays at debug.
- tools/contracts-check.py: stale TODO(spec) replaced by the §9.11 CS-5 citation; shapes updated for invite_kind
  (D-086), app_version_name (D-090) and fid (D-096), 134 checks pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
2026-10-18 22:12:21 +02:00
parent e70fe0d9fe
commit 8660b7fa16
9 changed files with 528 additions and 18 deletions
+5 -1
View File
@@ -1,8 +1,9 @@
//! `kvitt-server` subcommands (SPEC §10.4, exhaustive), all implemented: `serve`, `migrate` and `healthcheck` here,
//! `bootstrap` and `pair-device` (M3) and `rotate-epoch` (M4) in their own files.
//! `bootstrap` and `pair-device` (M3), `rotate-epoch` (M4) and `invite-partner` (D-113) in their own files.
pub mod bootstrap;
pub mod healthcheck;
pub mod invite_partner;
pub mod pair_device;
pub mod rotate_epoch;
@@ -47,6 +48,8 @@ pub enum Command {
#[arg(long = "user", value_name = "USER_ID")]
user: String,
},
/// Create a partner invite by the admin, as E-12 does (D-113). Exit 0 ok, 2 household full, 3 no admin.
InvitePartner,
/// Set a new random sync_epoch (SPEC §10.9).
RotateEpoch,
/// GET /health on this host; exit 0 if 200, 1 otherwise.
@@ -63,6 +66,7 @@ pub async fn run(command: Command, config: Config) -> ExitCode {
Command::Healthcheck => return healthcheck::run(&config).await,
Command::Bootstrap => return bootstrap::run(&config).await,
Command::PairDevice { user } => return pair_device::run(&config, &user).await,
Command::InvitePartner => return invite_partner::run(&config).await,
Command::RotateEpoch => return rotate_epoch::run(&config).await,
};
match result {