feat(epic4): подтверждать durable Task после атомарного PG-commit (Story 4.2)
CI / UI Checks (pull_request) Successful in 8s
CI / Rust Checks (pull_request) Successful in 19m34s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
CI / UI Checks (pull_request) Successful in 8s
CI / Rust Checks (pull_request) Successful in 19m34s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
Application entry выдаёт Task ID только после атомарного PostgreSQL commit Task+intent+capacity; replay/conflict, owner scope, bounded envelope, terminal CAS и fail-closed readiness проверены на реальном PG. Также включён принятый план перехода на rmcp (только документ, миграция не запускается).
This commit is contained in:
1 parent
cc612516a2
commit
2219a7217d
37 files changed
+4028
-136
No files matched your search
@@ -39,7 +39,24 @@ const ENTRY_COLUMNS: &[(&str, &str, bool)] = &[
|
||||
("granted_at", "timestamp with time zone", true),
|
||||
];
|
||||
|
||||
const CONSTRAINT_COUNT: &[(&str, usize)] = &[(CONTROLLERS, 4), (ENTRIES, 11)];
|
||||
/// V25 adds the nullable Task dispatch-intent link to the same reserved row. At version 24 the
|
||||
/// column must not exist yet, so the guard validates the shape of the version it describes.
|
||||
fn entry_columns(current_version: i64) -> Vec<(&'static str, &'static str, bool)> {
|
||||
let mut columns = ENTRY_COLUMNS.to_vec();
|
||||
if current_version >= 25 {
|
||||
columns.push(("task_id", "uuid", true));
|
||||
}
|
||||
columns
|
||||
}
|
||||
|
||||
fn constraint_count(table: &str, current_version: i64) -> Option<usize> {
|
||||
match table {
|
||||
CONTROLLERS => Some(4),
|
||||
ENTRIES if current_version >= 25 => Some(12),
|
||||
ENTRIES => Some(11),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
const UNIQUE_INDEXES: &[&str] = &["execution_admission_entries_owner_uidx"];
|
||||
|
||||
@@ -72,16 +89,22 @@ pub(super) async fn validate_v24_absent(
|
||||
/// Схема V24 присутствует в ожидаемой форме (для current_version >= 24).
|
||||
pub(super) async fn validate_v24_execution_admission(
|
||||
connection: &mut PgConnection,
|
||||
current_version: i64,
|
||||
) -> Result<(), MigrationError> {
|
||||
for relation in OWNED_RELATIONS {
|
||||
if !relation_exists(connection, relation).await? {
|
||||
return Err(v24_error("v24.relations"));
|
||||
}
|
||||
}
|
||||
for (table, columns) in [(CONTROLLERS, CONTROLLER_COLUMNS), (ENTRIES, ENTRY_COLUMNS)] {
|
||||
validate_columns(connection, table, columns).await?;
|
||||
let tables = [
|
||||
(CONTROLLERS, CONTROLLER_COLUMNS.to_vec()),
|
||||
(ENTRIES, entry_columns(current_version)),
|
||||
];
|
||||
for (table, columns) in tables {
|
||||
validate_columns(connection, table, &columns).await?;
|
||||
}
|
||||
for (table, expected) in CONSTRAINT_COUNT {
|
||||
for table in [CONTROLLERS, ENTRIES] {
|
||||
let expected = constraint_count(table, current_version).unwrap_or_default();
|
||||
let count: i64 = query(
|
||||
"select count(*)::bigint as count
|
||||
from pg_catalog.pg_constraint c
|
||||
@@ -95,7 +118,7 @@ pub(super) async fn validate_v24_execution_admission(
|
||||
.map_err(|_| MigrationError::storage("preflight.schema"))?
|
||||
.try_get("count")
|
||||
.map_err(|_| MigrationError::storage("preflight.schema"))?;
|
||||
if count != i64::try_from(*expected).unwrap_or_default() {
|
||||
if count != i64::try_from(expected).unwrap_or_default() {
|
||||
return Err(v24_error("v24.constraints"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user