feat(clients): sessions+registry+optimize+armor: close gaps, loud list truncation, shared Gemini adapter
sessions: operations get/list/cancel/delete/wait for engine, session, memory and serving profile; servingProfiles CRUD. registry: ListResult with truncated flag, v1alpha twins, gateway/policy operations, authz IAM, deny policy update, boundary patch/bindings. optimize: make_gemini_model over models::VertexModel (DirectModel removed), generateSyntheticData, online evaluator operations, trace/log writers. armor: SecurityAdmin for all SCC v2 methods (attack exposure excluded), documented agent threat categories, floor settings fixed to location global after live run. check_discovery.py of all four enforce coverage. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// Routes: POST /agent/registry/deny-policies/list, POST /agent/registry/boundaries/bindings
|
||||
#include "agent/registry/cases.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
|
||||
int main() {
|
||||
check_google_post_route("/agent/registry/deny-policies/list", "{\"project_number\":\"123456\"}",
|
||||
"{\"project_number\":\"my-project\"}", "non numeric project number");
|
||||
check_google_post_route("/agent/registry/boundaries/bindings",
|
||||
"{\"org_id\":\"42\",\"id\":\"pab-1\"}",
|
||||
"{\"org_id\":\"42\",\"id\":\"a/b\"}", "bad policy id");
|
||||
{
|
||||
GoogleRig rig;
|
||||
Fixture f(rig.client);
|
||||
check(f.client->post("/agent/registry/deny-policies/list", "{}", "application/json").status == 422,
|
||||
"limit: a missing project number is 422");
|
||||
check(f.client->post("/agent/registry/deny-policies/list",
|
||||
"{\"project_number\":\"" + std::string(21, '1') + "\"}", "application/json")
|
||||
.status == 422,
|
||||
"limit: 21 digits is 422");
|
||||
check(f.client->post("/agent/registry/boundaries/bindings", "{\"org_id\":\"x\",\"id\":\"pab-1\"}",
|
||||
"application/json").status == 422,
|
||||
"boundary bindings: bad org id is 422");
|
||||
check(rig.mock->send_count() == 0, "side effect: rejected before any upstream call");
|
||||
}
|
||||
return finish("agent/registry/iam");
|
||||
}
|
||||
@@ -14,6 +14,18 @@ int main() {
|
||||
check(f.client->post("/agent/registry/list", "{\"kind\":\"aiApplications\"}", "application/json").status == 422,
|
||||
"limit: a collection that is not listable here is 422");
|
||||
check(f.client->post("/agent/registry/list", "", "application/json").status == 422, "empty body is 422");
|
||||
check(f.client->post("/agent/registry/list", "{\"kind\":\"agents\",\"version\":\"v2\"}",
|
||||
"application/json").status == 422,
|
||||
"limit: an unknown API version is 422");
|
||||
}
|
||||
{
|
||||
// v1alpha is accepted as input and still needs a credential.
|
||||
GoogleRig rig(false);
|
||||
Fixture f(rig.client);
|
||||
auto res = f.client->post("/agent/registry/list", "{\"kind\":\"agents\",\"version\":\"v1alpha\"}",
|
||||
"application/json");
|
||||
check(res.status == 503 && contains(res.body, "google_not_configured"), "v1alpha without a credential is 503");
|
||||
check(rig.mock->send_count() == 0, "side effect: no upstream traffic");
|
||||
}
|
||||
return finish("agent/registry/list");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Routes: POST /agent/registry/operations/list, POST /agent/registry/operations/cancel,
|
||||
// DELETE /agent/registry/operations (explicit destructive route)
|
||||
#include "agent/registry/cases.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
using molo::example::fw::Method;
|
||||
|
||||
int main() {
|
||||
for (const char* scope : {"registry", "gateways", "policies"}) {
|
||||
std::string s = scope;
|
||||
check_google_post_route("/agent/registry/operations/list", "{\"scope\":\"" + s + "\"}",
|
||||
"{\"scope\":\"nowhere\"}", "unknown scope");
|
||||
check_google_post_route("/agent/registry/operations/cancel",
|
||||
"{\"scope\":\"" + s + "\",\"id\":\"op-1\"}",
|
||||
"{\"scope\":\"" + s + "\",\"id\":\"a/b\"}", "bad operation id");
|
||||
}
|
||||
{
|
||||
GoogleRig rig(false);
|
||||
Fixture f(rig.client);
|
||||
auto del = f.client->request(Method::Delete, "/agent/registry/operations?scope=gateways&id=op-1");
|
||||
check(del.status == 503 && contains(del.body, "google_not_configured"),
|
||||
"delete operation: 503 without a credential");
|
||||
check(rig.mock->send_count() == 0, "side effect: no upstream traffic");
|
||||
}
|
||||
{
|
||||
GoogleRig rig;
|
||||
Fixture f(rig.client);
|
||||
check(f.client->request(Method::Delete, "/agent/registry/operations?scope=x&id=op-1").status == 422,
|
||||
"delete: unknown scope is 422");
|
||||
check(f.client->request(Method::Delete, "/agent/registry/operations?scope=policies&id=a..b").status == 422,
|
||||
"delete: bad id is 422");
|
||||
check(f.client->request(Method::Delete, "/agent/registry/operations").status == 422,
|
||||
"delete: missing parameters are 422");
|
||||
check(f.client->get("/agent/registry/operations").status == 405, "get never deletes");
|
||||
check(f.client->post("/agent/registry/operations").status == 405, "post never deletes");
|
||||
check(rig.mock->send_count() == 0, "side effect: rejected before any upstream call");
|
||||
}
|
||||
return finish("agent/registry/operations");
|
||||
}
|
||||
@@ -13,6 +13,9 @@ int main() {
|
||||
check(res.status == 200, "status 200 without a credential");
|
||||
check(contains(res.headers.get("Content-Type"), "text/html"), "html");
|
||||
check(contains(res.body, "Agent registry") && contains(res.body, "agent_registry.js"), "page and script");
|
||||
check(contains(res.body, "id=\"r-truncated\""), "page has the loud truncation banner");
|
||||
check(contains(res.body, "id=\"r-version\"") && contains(res.body, "v1alpha"), "page offers v1alpha");
|
||||
check(contains(res.body, "ops-gateways"), "page offers the operations lists");
|
||||
check(f.client->post("/agent/registry").status == 405, "post is 405");
|
||||
check(f.client->get("/agent/registry/nope").status == 404, "unknown sub route is 404");
|
||||
check(rig.mock->send_count() == 0, "side effect: no upstream traffic");
|
||||
|
||||
@@ -15,6 +15,7 @@ int main() {
|
||||
check(contains(res.headers.get("Content-Type"), "application/json"), "json");
|
||||
check(contains(res.body, "\"configured\":false") && contains(res.body, "\"project_set\":true"), "state shown");
|
||||
check(contains(res.body, "\"max_ledger_entries\":5000"), "caps shown");
|
||||
check(contains(res.body, "\"max_items\":1000"), "the list item cap is stated");
|
||||
check(rig.mock->send_count() == 0, "side effect: no upstream traffic");
|
||||
}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user