사람 승인 게이트를 명시화

This commit is contained in:
Yun Chan 2026-08-29 23:59:29 +09:00
parent 707dba4f8f
commit 3a7b6f7760
5 changed files with 133 additions and 3 deletions

View file

@ -388,6 +388,37 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
):
self.agent_module.validate_required_release_payload(manifest)
def test_admin_usage_index_migration_is_idempotent_and_release_required(self) -> None:
migration_path = (
SCRIPT_PATH.parent.parent
/ "infra"
/ "db"
/ "init"
/ "18_admin_usage_ledger_index.sql"
)
migration = migration_path.read_text(encoding="utf-8")
self.assertNotIn("BEGIN;", migration)
self.assertIn(
"CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_turns_admin_usage_created_at",
migration,
)
self.assertIn("ON app.turns (created_at DESC)", migration)
self.assertIn("WHERE speaker = 'client';", migration)
self.assertNotIn("COMMIT;", migration)
self.assertIn(
"18_admin_usage_ledger_index.sql",
self.agent_module.RELEASE_DB_MIGRATIONS,
)
self.assertIn(
"18_admin_usage_ledger_index.sql",
self.agent_module.RELEASE_DB_ONLINE_MIGRATIONS,
)
self.assertIn(
"infra/db/init/18_admin_usage_ledger_index.sql",
self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS,
)
def test_two_patch_runs_must_be_byte_identical_before_any_deploy(self) -> None:
agent, runner, deployment, _, _ = self.make_agent(
active_sha=None,
@ -740,6 +771,7 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
"15_self_directed_practice_runtime.sql",
"16_calibration_transfer_actual_execution.sql",
"17_improvement_workbook_contracts.sql",
"18_admin_usage_ledger_index.sql",
"19_auth_identity_alias.sql",
),
self.agent_module.RELEASE_DB_MIGRATIONS,
@ -924,6 +956,20 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
self.assertIn("required env file missing", prepare_command)
self.assertIn(f"--env-file {root}/release/infra/.env", promote_command)
self.assertNotIn(f"--env-file {root}/infra/.env", promote_command)
transactional_migration_command = next(
line
for line in promote_command.splitlines()
if "17_improvement_workbook_contracts.sql" in line
and "psql -v ON_ERROR_STOP=1" in line
)
online_migration_command = next(
line
for line in promote_command.splitlines()
if "18_admin_usage_ledger_index.sql" in line
and "psql -v ON_ERROR_STOP=1" in line
)
self.assertIn("--single-transaction", transactional_migration_command)
self.assertNotIn("--single-transaction", online_migration_command)
self.assertEqual(f"{root}/release/infra/.env", state["env_file"])
def test_adopted_legacy_state_infers_compose_adjacent_env_file(self) -> None: