feat(admin): guided tuning editor that sends only the changes
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / postgres-tools (push) Successful in 28s
Foundation / server-image (push) Successful in 4m48s
Foundation / image (push) Successful in 5m37s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / postgres-tools (push) Successful in 28s
Foundation / server-image (push) Successful in 4m48s
Foundation / image (push) Successful in 5m37s
DEV's ingress refuses request bodies over about 1 KB, so adopting a whole revamp file (5 KB) failed with a 413 the portal misreported as the API's 64 KiB limit. POST /api/tuning?base=baseline|REV now takes only changed `key = value` lines, applies them to the baseline file or the newest revision (409 stale_base for an older one), keeping its comments, then checks and stores as before. The Tuning page becomes a guided editor: sections, a field per setting with its unit, plain reading and comment, a changes list with Check and Apply (or Adopt as is), and loading a past revision or the baseline as changes. The full-text editor stays as Text mode and names a proxy refusal plainly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -748,6 +748,35 @@ void admin_api_tests(const Realm& realm) {
|
||||
CHECK(
|
||||
must(JsonValue::parse(read("/api/tuning").body)).member("revisions")->array()->size() ==
|
||||
1);
|
||||
|
||||
// The guided editor sends only changes against a base: the newest revision or the
|
||||
// baseline file. Values are replaced in place (comments kept), absent keys appended,
|
||||
// and a base that is no longer the newest is refused.
|
||||
const auto back = must(JsonValue::parse(
|
||||
send("/api/tuning?check=1&base=" + revision, "spent.drip_interval_ticks = 20\n").body));
|
||||
CHECK(back.member("rules_sha256")->string() == digest);
|
||||
CHECK(send("/api/tuning?check=1&base=baseline", "").status == 200);
|
||||
CHECK(send("/api/tuning?check=1&base=999999", "").status == 409);
|
||||
CHECK(send("/api/tuning?check=1&base=x", "").status == 400);
|
||||
CHECK(send("/api/tuning?check=1&base=baseline", "spent.drip_interval_ticks = 1 # x\n")
|
||||
.status == 400);
|
||||
CHECK(send("/api/tuning?check=1&base=baseline",
|
||||
"spent.drip_absorb = 1\nspent.drip_absorb = 0\n")
|
||||
.status == 400);
|
||||
const auto appended = must(
|
||||
JsonValue::parse(send("/api/tuning?check=1&base=baseline", "no.such_key = 1\n").body));
|
||||
CHECK(appended.member("kind")->string() == "unknown_key");
|
||||
const auto guided = must(JsonValue::parse(
|
||||
send("/api/tuning?reason=guided&base=" + revision, "spent.drip_interval_ticks = 30\n")
|
||||
.body));
|
||||
const auto guided_revision = std::string(must(guided.member("revision")->string()));
|
||||
auto expected = changed;
|
||||
expected.replace(expected.find("spent.drip_interval_ticks = 40"), 30,
|
||||
"spent.drip_interval_ticks = 30");
|
||||
CHECK(must(JsonValue::parse(read("/api/tuning/" + guided_revision).body))
|
||||
.member("text")
|
||||
->string() == expected);
|
||||
CHECK(send("/api/tuning?check=1&base=" + revision, "").status == 409);
|
||||
}
|
||||
|
||||
// Accounts (schema 64): control claims recorded alice's sessions; a ban refuses grants
|
||||
|
||||
Reference in New Issue
Block a user