This commit is contained in:
parent
6e3123091a
commit
aeddaa6972
69 changed files with 3178 additions and 424 deletions
|
|
@ -367,26 +367,74 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
|
|||
with self.assertRaisesRegex(ValueError, "isolated NAS preview"):
|
||||
self.agent_module.validate_target(wrong)
|
||||
|
||||
def test_mobile_shell_and_late_migrations_are_required_release_payloads(self) -> None:
|
||||
manifest = {
|
||||
"classifications": {
|
||||
"related": [
|
||||
{
|
||||
"disposition": "candidate-whole-file",
|
||||
"paths": [
|
||||
path
|
||||
for path in self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS
|
||||
if path != "apps/web/src/components/shell/shell.css"
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
with self.assertRaisesRegex(
|
||||
self.agent_module.StageFailure,
|
||||
def test_runtime_critical_payloads_fail_closed_when_missing_from_manifest(
|
||||
self,
|
||||
) -> None:
|
||||
for missing_path in (
|
||||
"apps/web/src/components/shell/shell.css",
|
||||
"infra/db/init/23_client_affect_trace.sql",
|
||||
"infra/db/init/24_client_inner_reaction.sql",
|
||||
"infra/db/init/25_admin_health_rollup_retention.sql",
|
||||
):
|
||||
self.agent_module.validate_required_release_payload(manifest)
|
||||
with self.subTest(missing_path=missing_path):
|
||||
manifest = {
|
||||
"classifications": {
|
||||
"related": [
|
||||
{
|
||||
"disposition": "candidate-whole-file",
|
||||
"paths": [
|
||||
path
|
||||
for path in self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS
|
||||
if path != missing_path
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
with self.assertRaisesRegex(
|
||||
self.agent_module.StageFailure,
|
||||
missing_path,
|
||||
):
|
||||
self.agent_module.validate_required_release_payload(manifest)
|
||||
|
||||
def test_client_affect_migrations_are_transactional_release_payloads(
|
||||
self,
|
||||
) -> None:
|
||||
expected_migrations = (
|
||||
"23_client_affect_trace.sql",
|
||||
"24_client_inner_reaction.sql",
|
||||
)
|
||||
for migration_name in expected_migrations:
|
||||
with self.subTest(migration_name=migration_name):
|
||||
self.assertIn(
|
||||
migration_name,
|
||||
self.agent_module.RELEASE_DB_MIGRATIONS,
|
||||
)
|
||||
self.assertNotIn(
|
||||
migration_name,
|
||||
self.agent_module.RELEASE_DB_ONLINE_MIGRATIONS,
|
||||
)
|
||||
self.assertIn(
|
||||
f"infra/db/init/{migration_name}",
|
||||
self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS,
|
||||
)
|
||||
|
||||
def test_admin_health_rollup_retention_migration_is_transactional_release_payload(
|
||||
self,
|
||||
) -> None:
|
||||
migration_name = "25_admin_health_rollup_retention.sql"
|
||||
migration_path = SCRIPT_PATH.parent.parent / "infra" / "db" / "init" / migration_name
|
||||
migration = migration_path.read_text(encoding="utf-8")
|
||||
|
||||
self.assertIn("CREATE POLICY p_admin_health_daily_rollup_delete", migration)
|
||||
self.assertIn("FOR DELETE", migration)
|
||||
self.assertIn("app.current_role_name() = 'admin'", migration)
|
||||
self.assertIn(migration_name, self.agent_module.RELEASE_DB_MIGRATIONS)
|
||||
self.assertNotIn(migration_name, self.agent_module.RELEASE_DB_ONLINE_MIGRATIONS)
|
||||
self.assertIn(
|
||||
f"infra/db/init/{migration_name}",
|
||||
self.agent_module.REQUIRED_RELEASE_PAYLOAD_PATHS,
|
||||
)
|
||||
|
||||
def test_admin_usage_index_migration_is_idempotent_and_release_required(self) -> None:
|
||||
migration_path = (
|
||||
|
|
@ -892,6 +940,9 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
|
|||
"20_public_bootstrap_ticket_events.sql",
|
||||
"21_single_active_session.sql",
|
||||
"22_case_profile_multi_case.sql",
|
||||
"23_client_affect_trace.sql",
|
||||
"24_client_inner_reaction.sql",
|
||||
"25_admin_health_rollup_retention.sql",
|
||||
),
|
||||
self.agent_module.RELEASE_DB_MIGRATIONS,
|
||||
)
|
||||
|
|
@ -1099,6 +1150,24 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
|
|||
if "22_case_profile_multi_case.sql" in line
|
||||
and "psql -v ON_ERROR_STOP=1" in line
|
||||
)
|
||||
affect_trace_migration_command = next(
|
||||
line
|
||||
for line in promote_command.splitlines()
|
||||
if "23_client_affect_trace.sql" in line
|
||||
and "psql -v ON_ERROR_STOP=1" in line
|
||||
)
|
||||
inner_reaction_migration_command = next(
|
||||
line
|
||||
for line in promote_command.splitlines()
|
||||
if "24_client_inner_reaction.sql" in line
|
||||
and "psql -v ON_ERROR_STOP=1" in line
|
||||
)
|
||||
rollup_retention_migration_command = next(
|
||||
line
|
||||
for line in promote_command.splitlines()
|
||||
if "25_admin_health_rollup_retention.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.assertNotIn(
|
||||
|
|
@ -1107,6 +1176,17 @@ class OutcomeReleaseAgentTests(unittest.TestCase):
|
|||
self.assertNotIn(
|
||||
"--single-transaction", case_profile_online_migration_command
|
||||
)
|
||||
self.assertIn("--single-transaction", affect_trace_migration_command)
|
||||
self.assertIn("--single-transaction", inner_reaction_migration_command)
|
||||
self.assertIn("--single-transaction", rollup_retention_migration_command)
|
||||
self.assertLess(
|
||||
promote_command.index("23_client_affect_trace.sql"),
|
||||
promote_command.index("24_client_inner_reaction.sql"),
|
||||
)
|
||||
self.assertLess(
|
||||
promote_command.index("24_client_inner_reaction.sql"),
|
||||
promote_command.index("up -d --no-deps --force-recreate api web proxy"),
|
||||
)
|
||||
self.assertEqual(f"{root}/release/infra/.env", state["env_file"])
|
||||
|
||||
def test_adopted_legacy_state_infers_compose_adjacent_env_file(self) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue