Repository navigation
feat(id): id serve loads ServerConfig + startup provisioning (#5119 slice 1) - #5187
Conversation
…lice 1) Adds --server-config <path> to id serve (cli.rs -> ServeOptions -> cmd_serve). When given, serve loads the config before any startup work via start_server_config: ServerConfig::load failures fail startup naming the parse error and path, and Provisioned::apply runs from the loaded config with the report on the startup status line. The loaded config/provisioning stay in startup scope for the pull-gate and freshness slices. No flag = no file read, behaviour unchanged. Without the world feature the flag fails loudly like --web does. Tests: provisioning applied (2 users/1 group/1 member, idempotent second apply), malformed and missing files fail startup, flag defaults to None.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 10 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30f0bf9857
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let mut provisioned = crate::server_config::Provisioned::new(); | ||
| let report = provisioned | ||
| .apply(&config) |
There was a problem hiding this comment.
Apply provisioning to the live server state
When --server-config declares users or groups, provisioning runs against a fresh, isolated Provisioned, and the returned state is retained only in the unused _started_server_config binding. The running server instead builds its state independently in ServeWorlds::open_world, loads durable accounts from directory.jsonl in world_store::open_world, and reads group membership through GroupLog. Consequently, startup reports successful provisioning without making the configured accounts or groups available to live serving, and each restart reports them newly created again. Apply provisioning to the actual serving state and persist it where appropriate; this is separate from the explicitly deferred pull-policy and freshness wiring.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed with the observation; dispositioned as a scoped follow-on rather than silently merged past. Slice 1 (this PR) implements exactly the boundary its packet defined (triage task 8786, packet on task 8839): serve loads the ServerConfig through --server-config, startup fails on a malformed file naming the parse error, and Provisioned::apply executes at startup — the first production caller either function has had, with the loaded state kept in startup scope for the wiring slices. Persisting provisioning into the live stores is a distinct design step (GroupLog has no append for already-formed events — provisioned events carry precomputed ids; directory state is applied from directory.jsonl records; config-derived events are unsigned because the config holds public keys only), so it is filed as slice 1b on #5119 with the full scope, evidence, and a packet draft, to land ahead of slices 2/3. This PR merges as the verified slice-1 foundation; 1b is tracked on the issue, not dropped.
Slice 1 of #5119 (task 8839): the foundation that lets
id serveconsumeServerConfigat all — previouslyServerConfig::loadandProvisioned::applyhad no production caller.What
--server-config <path>onid serve, in the existing CLI style (cli.rs → main.rs →ServeOptions→cmd_serve).start_server_config: read/parse failures fail startup naming theServerConfig::parseerror and the path (the parser's startup-failing contract), andProvisioned::applyruns from the loaded config, with the report (users/groups/members created) on the startup status line.StartedServerConfig) so slice 2 (pull gate fromconfig.pull_policy()) and slice 3 (freshness into seitan admission) wire in from this one load.worldfeature (which ownsserver_config), the flag fails loudly, mirroring the existing--webguard.Tests (laptop, pkgs/id)
cargo test --lib -- server_config— 60 passed, including the 4 new serve tests:start_server_config_applies_provisioning— a valid config loads; provisioning creates 2 users / 1 group / 1 member; a second apply over the same state creates nothing.start_server_config_fails_startup_on_a_malformed_file— the parse error is named, with the path.start_server_config_fails_startup_on_a_missing_file.serve_server_config_flag_defaults_to_none— flag absent =None;--server-config ops.tomlparses through.cargo test --lib -- commands::serve— 37 passed.rustfmt --edition 2024clean on the touched file.Out of scope per the slice definition: pull gate from config (slice 2), freshness wiring (slice 3), parse-surface changes.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.