Skip to content

Pass bootroot's registration id to service add and info (#140) - #141

Merged
sehkone merged 1 commit into
mainfrom
sehkone/issue-140
Sep 29, 2026
Merged

sehkone merged 1 commit into
mainfrom
sehkone/issue-140

Conversation

@sehkone

@sehkone sehkone commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

bootroot main at 8b92d250 separates a registration's namespace key (--registration-id) from its SAN service label (--service-name). Its service info now accepts only --registration-id. deploy-core's registration primitives still used the 0.2.0 contract. As a result, every service add stopped at bootroot's registration-id prompt, which fails because stdin is closed. Every service info --service-name exited non-zero on the unknown flag, so deploy-core treated each registration as unregistered, and bootroot then refused a local-file re-install as a duplicate.

Changes, all in src/registration.rs:

  • ServiceAddSpec has a new registration_id: &'a str field, placed before service_name. Its doc calls it bootroot's namespace key: the state.json entry, the AppRole and policy, the bootroot/services/<key> KV subtree, the managed agent.toml block and the fast-poll state file. The service_name doc now says it is only the SAN's service label. deploy-core does not derive one from the other and does not validate either one.
  • service_add_args now begins with service add --registration-id <registration_id> --service-name <service_name>. The remaining flags are unchanged and in the same order.
  • service_registered takes a registration_id and runs service info --registration-id <registration_id> as Identity::Root. The exit status is still the whole answer: zero means registered, and any non-zero exit means not registered.
  • The --secret-id-path comment and the secret_id_path field doc no longer say bootroot rejects the flag for remote-bootstrap delivery. bootroot 8b92d250 accepts it in both modes. The flag is still emitted exactly when secret_id_path is Some, and the caller decides when that applies.
  • The module doc now says service info checks a registration by its registration id.
  • run_service_add, CoreError::ServiceRegistration and ServiceOutcome are unchanged.

New unit tests check the exact service add argv in both delivery modes, with the optional flags present and absent. They also cover the case where the registration id and the service name are equal. A RecordingExecutor test checks that service_registered runs service info --registration-id <id> as root in the runner's state directory, never passes --service-name, and maps exit status 0 and 1 to true and false.

bootler picks up this change, and passes a registration id, in aicers/bootler#498. No changelog entry is included because deploy-core has not been released.

Closes #140

Deviations from the issue

None

Test plan

  • local_file_emits_the_registration_id_and_the_service_name: a local-file spec with registration id roxyd-mgmt, service name roxyd, and secret_id_path, cert_group_gid and endpoints all set. Asserts the exact full service add vector, so swapping the two values or dropping a flag fails.
  • remote_bootstrap_keeps_the_wrap_ttl_and_endpoints_after_the_new_pair: a remote-bootstrap spec with secret_id_path, cert_group_gid and endpoints all set. Asserts the exact vector, with --secret-id-wrap-ttl 60m and the endpoint flags in their existing positions after the new pair.
  • local_file_without_optional_fields_emits_none_of_their_flags: a local-file spec with secret_id_path, cert_group_gid and endpoints all None. Asserts the exact vector, so the absent flags are proven absent.
  • remote_bootstrap_with_only_endpoints_emits_no_secret_id_path_or_cert_group: a remote-bootstrap spec with only endpoints set. Asserts the exact vector, with no --secret-id-path and no --cert-group.
  • an_equal_registration_id_and_service_name_are_both_emitted: registration id and service name are both roxyd. Both flags are emitted with that value, each exactly once.
  • service_registered_queries_by_registration_id_and_reads_the_exit_status: uses RecordingExecutor, scripted with exit 0 and then exit 1, and gets true and then false. Each recorded RecordedCall::Run is sh as Identity::Root. Its arguments contain the runner's state directory and end with <command path> service info --registration-id roxyd-mgmt. No argument is --service-name.
  • cargo fmt -- --check --config group_imports=StdExternalCrate
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --all-targets --features test-support -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items --features test-support
  • cargo test
  • cargo test --features test-support

bootroot main splits a registration's namespace key from its SAN
label: --registration-id names the state.json entry, AppRole, policy,
KV subtree, agent.toml block and fast-poll state, while --service-name
is only the SAN's service label. Against that contract service add
without --registration-id fails on its prompt (stdin is closed), and
service info rejects --service-name, which service_registered read as
"not registered" so a re-install re-added every service.

ServiceAddSpec now carries the registration id and service_add_args
emits both flags first; service_registered queries by registration id.
The --secret-id-path comment no longer claims bootroot rejects the
flag for remote-bootstrap delivery, which it now accepts.

Closes #140
@sehkone

sehkone commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

[Reviewer Round 1]

Review verdict: Approve. I found no blocking issues.

The change passes the caller’s registration id to service add and uses it for service info, while keeping the SAN service label separate (registration.rs, lookup). The remaining flags and the existing exit-status behavior are unchanged. The tests assert full argument vectors across both delivery modes and optional-field cases, and the recording-executor test checks the root lookup and its command arguments.

The PR body includes Closes #140 and a test plan. Its “Deviations: None” claim matches the diff. I reviewed the tests and code; I did not rerun CI, as requested.

@sehkone

sehkone commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

[Review Verdict Round 1: APPROVED]

@sehkone
sehkone merged commit 1f682ec into main Sep 29, 2026
5 checks passed
@sehkone
sehkone deleted the sehkone/issue-140 branch September 29, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pass bootroot's registration id to service add and info

1 participant