fix(rectification): allow runtime flag reads
Staging Backend Quality Gate / validate (pull_request) Successful in 17m5s
Staging Backend Quality Gate / publish (pull_request) Has been skipped

This commit is contained in:
Jesse_Chen
2026-08-11 23:49:44 +08:00
parent 139baeb94c
commit d19d398221
3 changed files with 41 additions and 0 deletions
@@ -0,0 +1,15 @@
begin;
do $$
begin
if exists (select 1 from pg_roles where rolname = 'admin_runtime') then
grant select on table public.feature_flags to admin_runtime;
drop policy if exists feature_flags_admin_read on public.feature_flags;
create policy feature_flags_admin_read on public.feature_flags
for select to admin_runtime using (true);
end if;
end;
$$;
commit;
@@ -798,6 +798,7 @@ test("v9 agent api migration applies, seeds the runtime flag and guards consent"
});
assert.equal(migration.status, 0, migration.stderr);
assert.match(migration.stdout, /applied 20260813010000_agentic_rectification_v9_agent_api\.sql/);
assert.match(migration.stdout, /applied 20260811030000_feature_flags_admin_runtime_read_policy\.sql/);
// The runtime selector flag is published and enabled.
assert.equal(
@@ -805,6 +806,16 @@ test("v9 agent api migration applies, seeds the runtime flag and guards consent"
from public.feature_flags where flag_key = 'rectification_runtime_version'`),
"true:100:published",
);
assert.equal(
fixture.psqlAs(
"admin_runtime",
"admin-runtime-test-password",
`select enabled || ':' || rollout_percentage || ':' || status
from public.feature_flags
where flag_key = 'rectification_runtime_version'`,
),
"true:100:published",
);
// Run phases table exists with RLS.
assert.equal(