settings: every operator setting loads through one path - #38
Merged
Merged
Conversation
Startup read operator configuration as a sequence of hand-written blocks, one per setting, and adding one was optional. Two settings got their block — the action level and the OpenStack credential. Two did not: ConfigureInstanceProfile and ConfigureCubeCOS have no non-test caller, so a profile an operator writes reaches nothing and all twenty-one read-catalogue paths answer "not configured". Both features are documented, exercised by tests, and absent from the shipped binary. Lab validation on the 1cc R630 was the first thing to notice. Every test that found them green built its own Registry, so none of them ever asked whether anything builds one in production. configure(dir) walks a declared list and returns the registry; run calls it and reads no operator configuration itself. The two shipped settings move across unchanged — same files, same formats, same modes, same messages, same behaviour on absent, empty, malformed and group-writable input. Per-setting masks stay per-setting: the level is refused if others may write it, the credential if others may read it. The tests call configure, in two layers. One requires the declared list and the effect table to account for each other, catching a setting nothing loads. The other writes each setting's file into a temporary directory and asserts the returned registry changed, catching a setting loaded into nothing — which passes the first. Registry.Writers reports which backends have a write client wired, so a credential reaching the registry is observable without a network. ADR 0016 slice 1. Signed-off-by: Travis Wu <travis.wu@bigstack.co>
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.
What
configure(dir)walks a declared list of operator settings and returns theconfigured registry;
runcalls it and reads no operator configuration itself.The two shipped settings — the action level and the OpenStack credential — move
across unchanged.
ADR 0016 slice 1. No behaviour change: same files, same formats, same modes,
same messages, same handling of absent, empty, malformed and group-writable
input.
Why
Startup was a sequence of hand-written blocks, one per setting, and adding one
was optional. Two settings got their block. Two did not:
Registry.ConfigureInstanceProfilehas no non-test caller, so a profile anoperator writes reaches nothing and every create refuses with "this agent has
no flavor configured" — a good message an operator cannot act on.
Registry.ConfigureCubeCOSis likewise test-only, so all twenty-oneread-catalogue paths answer "not configured".
Both features are documented, exercised by tests, and absent from the shipped
binary. Lab validation on the 1cc R630 was the first thing to notice.
The reason every check passed is the part worth keeping: every test that found
them green built its own
Registry, so none of them ever asked whetheranything builds one in production. A test that does not run the startup path
cannot catch this, however thorough it is about everything else.
This slice does not fix either finding — slices 3 and 4 do. It makes them
unrepeatable, which is why it ships first.
Reviewer notes
Two test layers, and the second is not redundant.
TestEverySettingIsDeclaredAndAssertedrequires the declared list and anindependently-written effect table to account for each other in both directions.
It catches a setting nothing loads.
TestEverySettingReachesTheRegistryThroughConfigurewrites each setting's fileinto a temporary directory, calls
configure, and asserts the returned registrydiffers from the unconfigured one in the way that setting controls. It catches
a setting loaded into nothing — which passes the first layer.
Both breaks were run and watched:
settingsapplydroppedThe second row is why there are two layers.
Registry.Writers()is new and small.ConfigureWriter's observablecounterpart. Without it, a credential on disk reaching the registry is only
visible by making a call, so nothing could assert the wiring without a network —
which is how the two findings survived. It is also what the startup line can
grow into.
Per-setting masks stay per-setting. The level is refused if group- or
world-writable, the credential if group- or world-readable. ADR 0016 keeps a
directory of files rather than one config file precisely so these can disagree:
one is policy a customer should read without root, the other is a secret.
A broken setting disables what it enables and never more. The agent still
starts, and each setting prints one line — its value, "not configured", or the
reason it was rejected.
settingState.brokenexists for slice 2'sconfig checkexit code and is asserted here.Out of scope, noted once:
-web-targetsis a third operator-configured file(
console.LoadWebAllowlist), but it lives in a different directory andconfigures the console handler rather than the registry, so it is not in ADR
0016's set. Worth deciding on when the next setting lands.
Verification.
go test ./...exit 0, zero--- FAIL:lines, all packagesok.
go vetclean.gofmtclean on everything touched —cmd/agent/main_test.gois unclean on
developalready and is not part of this change.Docs
kb/cube-ai-advisor/architecture/read-only-plane-end-to-end.md— the as-built,beside the earlier slices.