Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d26d10d3f |
+21
-25
@@ -88,30 +88,6 @@ class OperatorApprovalPolicy:
|
||||
self.authorise(approval, "execute", now)
|
||||
|
||||
|
||||
def read_protected_authority(path, *, group, max_bytes):
|
||||
# Ancestors are trusted; open the parent and file without following links.
|
||||
directory = os.open(path.parent, os.O_RDONLY | os.O_DIRECTORY
|
||||
| os.O_NOFOLLOW | os.O_CLOEXEC)
|
||||
try:
|
||||
info = os.fstat(directory)
|
||||
require(info.st_uid == 0 and info.st_gid == group
|
||||
and stat.S_IMODE(info.st_mode) == 0o750,
|
||||
"Unsafe operator authority directory")
|
||||
descriptor = os.open(path.name, os.O_RDONLY | os.O_NOFOLLOW
|
||||
| os.O_NONBLOCK | os.O_CLOEXEC, dir_fd=directory)
|
||||
with os.fdopen(descriptor, "rb") as stream:
|
||||
info = os.fstat(stream.fileno())
|
||||
require(stat.S_ISREG(info.st_mode) and info.st_uid == 0
|
||||
and info.st_gid == group and info.st_nlink == 1
|
||||
and stat.S_IMODE(info.st_mode) == 0o440,
|
||||
"Unsafe operator authority file")
|
||||
data = stream.read(max_bytes + 1)
|
||||
finally:
|
||||
os.close(directory)
|
||||
require(0 < len(data) <= max_bytes, "Invalid operator authority size")
|
||||
return data
|
||||
|
||||
|
||||
class FileOperatorAuthority:
|
||||
"""Load a fresh, atomic authority snapshot from a trusted local provisioner."""
|
||||
|
||||
@@ -124,7 +100,27 @@ class FileOperatorAuthority:
|
||||
and type(group) is int and group > 0, "Invalid operator authority binding")
|
||||
|
||||
def __call__(self):
|
||||
data = read_protected_authority(self.path, group=self.group, max_bytes=self.MAX_BYTES)
|
||||
# The parent and its ancestors are trusted, and the final entry cannot
|
||||
# be replaced by the reader or resolved through a symbolic link.
|
||||
directory = os.open(self.path.parent, os.O_RDONLY | os.O_DIRECTORY
|
||||
| os.O_NOFOLLOW | os.O_CLOEXEC)
|
||||
try:
|
||||
info = os.fstat(directory)
|
||||
require(info.st_uid == 0 and info.st_gid == self.group
|
||||
and stat.S_IMODE(info.st_mode) == 0o750,
|
||||
"Unsafe operator authority directory")
|
||||
descriptor = os.open(self.path.name, os.O_RDONLY | os.O_NOFOLLOW
|
||||
| os.O_NONBLOCK | os.O_CLOEXEC, dir_fd=directory)
|
||||
with os.fdopen(descriptor, "rb") as stream:
|
||||
info = os.fstat(stream.fileno())
|
||||
require(stat.S_ISREG(info.st_mode) and info.st_uid == 0
|
||||
and info.st_gid == self.group and info.st_nlink == 1
|
||||
and stat.S_IMODE(info.st_mode) == 0o440,
|
||||
"Unsafe operator authority file")
|
||||
data = stream.read(self.MAX_BYTES + 1)
|
||||
finally:
|
||||
os.close(directory)
|
||||
require(0 < len(data) <= self.MAX_BYTES, "Invalid operator authority size")
|
||||
snapshot = json.loads(data)
|
||||
require(isinstance(snapshot, dict) and set(snapshot) == {"grants", "sealing_key"}
|
||||
and isinstance(snapshot["grants"], list), "Invalid operator authority snapshot")
|
||||
|
||||
+7
-39
@@ -6,9 +6,7 @@ inventory of releases and transaction protections.
|
||||
No filesystem modification is performed.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import stat
|
||||
|
||||
from core.compatibility import canonical_hash
|
||||
|
||||
@@ -193,19 +191,6 @@ def plan_retention(policy):
|
||||
return plan
|
||||
|
||||
|
||||
def verify_rollback_marker(releases, archived):
|
||||
transaction = archived["transaction"]
|
||||
marker = releases.release_path(transaction["candidate"]) / "BAD_RELEASE"
|
||||
expected = (transaction["transaction_id"] + "\n" + archived["checksum"] + "\n").encode()
|
||||
descriptor = os.open(marker, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | os.O_CLOEXEC)
|
||||
with os.fdopen(descriptor, "rb") as stream:
|
||||
info = os.fstat(stream.fileno())
|
||||
require(stat.S_ISREG(info.st_mode) and info.st_uid == os.getuid()
|
||||
and stat.S_IMODE(info.st_mode) == 0o600 and info.st_nlink == 1,
|
||||
"Unsafe rollback quarantine marker")
|
||||
require(stream.read(len(expected) + 1) == expected, "Rollback quarantine marker mismatch")
|
||||
|
||||
|
||||
def plan_site_retention(runtime_root, *, keep, site=None):
|
||||
"""Read canonical runtime state under its deployment and journal locks."""
|
||||
from pathlib import Path
|
||||
@@ -216,7 +201,6 @@ def plan_site_retention(runtime_root, *, keep, site=None):
|
||||
from core.locking import DeploymentLock
|
||||
from core.operation_guard import OperationGuard
|
||||
from core.releases import ReleaseManager
|
||||
from core.rollback_archive import RollbackArchiveReader
|
||||
from core.transactions import TransactionJournal
|
||||
|
||||
root = Path(runtime_root)
|
||||
@@ -232,8 +216,6 @@ def plan_site_retention(runtime_root, *, keep, site=None):
|
||||
inventory = releases.inventory()
|
||||
current = releases.current()
|
||||
protected = set()
|
||||
failed = set()
|
||||
retired = False
|
||||
archive_directory = root / "archive"
|
||||
if archive_directory.exists() or archive_directory.is_symlink():
|
||||
require(isinstance(site, str) and re.fullmatch(r"[a-z0-9][a-z0-9-]{0,62}", site),
|
||||
@@ -244,39 +226,25 @@ def plan_site_retention(runtime_root, *, keep, site=None):
|
||||
releases=releases, provenance=None, backup_evidence=BackupEvidence(journal.directory),
|
||||
backup_verify=None, health_probe=None,
|
||||
)
|
||||
rollbacks = RollbackArchiveReader(
|
||||
site=site, journal=journal, directory=archive_directory,
|
||||
backup_evidence=BackupEvidence(journal.directory),
|
||||
)
|
||||
matching = []
|
||||
for path in archive_directory.iterdir():
|
||||
match = re.fullmatch(r"([a-f0-9]{32})\.(archive|rollback-archive)\.json", path.name)
|
||||
require(match is not None, "Unexpected retention archive entry")
|
||||
identifier, kind = match.groups()
|
||||
if kind == "rollback-archive":
|
||||
record = rollbacks.load(identifier)
|
||||
verify_rollback_marker(releases, record)
|
||||
archived = record["transaction"]
|
||||
failed.add(archived["candidate"])
|
||||
active = archived["previous"]
|
||||
else:
|
||||
archived = archives.load(identifier)["transaction"]
|
||||
active = archived["candidate"]
|
||||
require(re.fullmatch(r"[a-f0-9]{32}\.archive\.json", path.name),
|
||||
"Unexpected retention archive entry")
|
||||
archived = archives.load(path.name[:32])["transaction"]
|
||||
protected.update((archived["previous"], archived["candidate"]))
|
||||
if active == current:
|
||||
if archived["candidate"] == current:
|
||||
matching.append(archived)
|
||||
if transaction is None:
|
||||
require(len(matching) == 1, "Active release has no unambiguous verified archive")
|
||||
transaction = matching[0]
|
||||
retired = True
|
||||
require(transaction is not None, "No verified retention transaction")
|
||||
require(site is None or transaction["site"] == site, "Retention transaction belongs to another site")
|
||||
references = [transaction["previous"], transaction["candidate"]]
|
||||
protected.update(references)
|
||||
require(current in references, "Live active release differs from the transaction")
|
||||
unresolved = (
|
||||
(not retired and (transaction["phase"] != "VERIFIED"
|
||||
or current != transaction["candidate"]))
|
||||
transaction["phase"] != "VERIFIED"
|
||||
or current != transaction["candidate"]
|
||||
or guard["status"] != "CLEAR"
|
||||
)
|
||||
plan = plan_retention({
|
||||
@@ -284,7 +252,7 @@ def plan_site_retention(runtime_root, *, keep, site=None):
|
||||
"current": current,
|
||||
"keep": keep,
|
||||
"protected": sorted(protected),
|
||||
"failed": sorted(failed),
|
||||
"failed": [],
|
||||
"unresolved": inventory if unresolved else [],
|
||||
})
|
||||
del plan["fingerprint"]
|
||||
|
||||
+22
-20
@@ -20,15 +20,26 @@ from core.compatibility import (
|
||||
from core.locking import DeploymentLock
|
||||
|
||||
|
||||
class RollbackArchiveReader:
|
||||
def __init__(self, *, site, journal, directory, backup_evidence):
|
||||
self.site = site
|
||||
self.journal = journal
|
||||
self.backup_evidence = backup_evidence
|
||||
self.source = ApprovalStore(journal.directory)
|
||||
class RollbackArchive:
|
||||
|
||||
def __init__(self, *, planner, directory, health_probe):
|
||||
require(
|
||||
callable(health_probe),
|
||||
"Health verification is required",
|
||||
)
|
||||
|
||||
self.planner = planner
|
||||
self.journal = planner.journal
|
||||
self.releases = planner.releases
|
||||
self.health_probe = health_probe
|
||||
|
||||
self.source = ApprovalStore(self.journal.directory)
|
||||
self.destination = ApprovalStore(directory)
|
||||
require(self.source.directory != self.destination.directory,
|
||||
"Archive directory must be separate")
|
||||
|
||||
require(
|
||||
self.source.directory != self.destination.directory,
|
||||
"Archive directory must be separate",
|
||||
)
|
||||
|
||||
def path(self, identifier):
|
||||
return self.destination.path(
|
||||
@@ -119,7 +130,7 @@ class RollbackArchiveReader:
|
||||
"Rollback result mismatch",
|
||||
)
|
||||
|
||||
evidence = self.backup_evidence.load(
|
||||
evidence = self.planner.backup_evidence.load(
|
||||
identifier
|
||||
)
|
||||
|
||||
@@ -142,7 +153,7 @@ class RollbackArchiveReader:
|
||||
require(
|
||||
isinstance(record, dict)
|
||||
and record.get("status") == "ARCHIVED"
|
||||
and record.get("site") == self.site
|
||||
and record.get("site") == self.planner.site
|
||||
and record.get("database_restored") is False
|
||||
and record.get("checksum") == digest(record),
|
||||
"Invalid rollback archive",
|
||||
@@ -154,7 +165,7 @@ class RollbackArchiveReader:
|
||||
|
||||
require(
|
||||
transaction["transaction_id"] == identifier
|
||||
and transaction["site"] == self.site,
|
||||
and transaction["site"] == self.planner.site,
|
||||
"Archived transaction identity mismatch",
|
||||
)
|
||||
|
||||
@@ -179,15 +190,6 @@ class RollbackArchiveReader:
|
||||
"Rollback archive validation failed"
|
||||
) from None
|
||||
|
||||
class RollbackArchive(RollbackArchiveReader):
|
||||
def __init__(self, *, planner, directory, health_probe):
|
||||
require(callable(health_probe), "Health verification is required")
|
||||
super().__init__(site=planner.site, journal=planner.journal,
|
||||
directory=directory, backup_evidence=planner.backup_evidence)
|
||||
self.planner = planner
|
||||
self.releases = planner.releases
|
||||
self.health_probe = health_probe
|
||||
|
||||
def _plan(self):
|
||||
self.destination.validate_directory()
|
||||
|
||||
|
||||
@@ -2,34 +2,26 @@
|
||||
|
||||
import copy
|
||||
import hmac
|
||||
from pathlib import Path
|
||||
|
||||
from core.operator_approval import read_protected_authority
|
||||
|
||||
from core.rehearsal import (
|
||||
RECORD_FIELDS, RehearsalError, approval_context, create_rehearsal, matches, require,
|
||||
RECORD_FIELDS, approval_context, create_rehearsal, matches, require,
|
||||
validate_base_context,
|
||||
)
|
||||
|
||||
|
||||
class TrustedRehearsal:
|
||||
def __init__(self, runner_id, runner, *, key_loader, clock):
|
||||
def __init__(self, runner_id, runner, *, key, clock):
|
||||
require(matches(runner_id, r"[a-zA-Z0-9_.-]{1,128}"), "Invalid rehearsal runner identity")
|
||||
require(callable(runner) and callable(clock), "Trusted rehearsal runner and clock required")
|
||||
require(callable(key_loader), "Trusted rehearsal key loader required")
|
||||
require(isinstance(key, bytes) and len(key) >= 32, "Invalid rehearsal trust key")
|
||||
self.runner_id = runner_id
|
||||
self._runner = runner
|
||||
self._key_loader = key_loader
|
||||
self._key = key
|
||||
self._clock = clock
|
||||
|
||||
def _seal(self, fingerprint):
|
||||
payload = f"absdev:trusted-rehearsal:v1:{self.runner_id}:{fingerprint}".encode("ascii")
|
||||
try:
|
||||
key = self._key_loader()
|
||||
except Exception:
|
||||
raise RehearsalError("Unable to verify current rehearsal authority") from None
|
||||
require(isinstance(key, bytes) and len(key) >= 32, "Invalid rehearsal trust key")
|
||||
return hmac.digest(key, payload, "sha256").hex()
|
||||
return hmac.digest(self._key, payload, "sha256").hex()
|
||||
|
||||
def run(self, context):
|
||||
context = copy.deepcopy(context)
|
||||
@@ -50,16 +42,3 @@ class TrustedRehearsal:
|
||||
require(hmac.compare_digest(evidence["runner_seal"], self._seal(record["fingerprint"])),
|
||||
"Untrusted rehearsal runner attestation")
|
||||
return approved
|
||||
|
||||
|
||||
class FileRehearsalKey:
|
||||
"""Read a protected current key snapshot for each attestation operation."""
|
||||
|
||||
def __init__(self, path, *, group):
|
||||
self.path = Path(path)
|
||||
self.group = group
|
||||
require(self.path.is_absolute() and self.path.parent.resolve() == self.path.parent
|
||||
and type(group) is int and group > 0, "Invalid rehearsal key binding")
|
||||
|
||||
def __call__(self):
|
||||
return read_protected_authority(self.path, group=self.group, max_bytes=4096)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Trusted rehearsal evidence
|
||||
|
||||
Configure `TrustedRehearsal(runner_id, runner, key_loader=..., clock=...)` in trusted
|
||||
Configure `TrustedRehearsal(runner_id, runner, key=..., clock=...)` in trusted
|
||||
runtime code and supply it to `SiteOperations(trusted_rehearsal=...)`.
|
||||
Use a separately managed random key of at least 32 bytes and a stable runner
|
||||
identifier. Only trusted runtime processes may have access to this key.
|
||||
@@ -23,11 +23,3 @@ authorise a migration.
|
||||
|
||||
The configured runner and protected key provisioning are deployment inputs.
|
||||
Production execution remains disabled.
|
||||
|
||||
The loader must re-read the current key on each call. Use
|
||||
`FileRehearsalKey(path, group=...)` for a root-owned binary key file (0440)
|
||||
in a root-owned directory (0750) with the configured reader group. Keep the
|
||||
ancestors under trusted administrative control. Replace the file atomically.
|
||||
The runtime rejects missing, unreadable, or unsafe key snapshots and newly
|
||||
checks the key at both approval issuance and consumption. A rotation
|
||||
invalidates outstanding attestations under the retired key at the next check.
|
||||
|
||||
@@ -11,11 +11,10 @@ The existing `--policy` command evaluates caller-supplied data as a simulation.
|
||||
Both outputs are read-only. They grant no archival or deletion authority.
|
||||
|
||||
For an existing runtime with retired deployment journals, place verified
|
||||
ordinary transaction and rollback archives in the canonical `archive/` directory and
|
||||
ordinary transaction archives in the canonical `archive/` directory and
|
||||
supply `--site` with the configured site identifier. Each archive must pass
|
||||
the framework's transaction and backup evidence validation. When the live
|
||||
journal is absent, exactly one archived verified transaction must match the
|
||||
active release. Rollback archives also require their original rollback and
|
||||
backup evidence and the failed release's matching quarantine marker. All
|
||||
releases referenced by validated archives are protected. Unknown, ambiguous
|
||||
or corrupt archive entries deny planning pending review.
|
||||
active release. All releases referenced by validated archives are protected.
|
||||
Unknown archive entries, rollback archive formats, and ambiguous or corrupt
|
||||
records deny planning pending review.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Integrated ABSDEV-CI qualification at 84a7a5b23796b15cab830034aae256b9414e9693.
|
||||
All 909 framework tests and 22 live PostgreSQL and recovery fixture checks passed.
|
||||
The recovery fixture used real PostgreSQL interruption and on-disk release switching,
|
||||
with synthetic service and health callbacks. The forward activation and archival
|
||||
each required their own confirmation. The ordinary journal remained byte-identical.
|
||||
Production execution, readiness and permanent deletion remained disabled.
|
||||
@@ -0,0 +1,19 @@
|
||||
44b544c9c43c35b084dbaf8ad65b368a2b32e05c2cf781fc3fbbc1afa3422057 ./checks.jsonl
|
||||
94408e6242b4a5eff91a673c65f88c3dfac0fc9959bf435bbff6739116f7faa9 ./forward-activation.json
|
||||
e5869afcf31ff3c1f4792e6b8c8593e0283260ae4b1ab136aed938f166cfd82d ./manual-reconciliation.json
|
||||
6416cf3cb4ea0e945dbca1c89c1e45d78d3cc999f5161994bfbc5e2c758047f2 ./observed.json
|
||||
0bc7aa6f50486d8b1a054213ce63c280fbc8f221113e7f9f09d0b7cfeafb1107 ./ordinary-after.json
|
||||
0bc7aa6f50486d8b1a054213ce63c280fbc8f221113e7f9f09d0b7cfeafb1107 ./ordinary-before.json
|
||||
a6cf2cfbcbbab675b044321df36f80f83de40c3c8242f0b3dc2ea6e6f9aced8a ./reconciliation-result.json
|
||||
0e5f3b1532329ed9730b8da488e10f76884ec14d305de9973b2b14e0845f3686 ./summary.json
|
||||
94897e03792498140e061b2dac59b6274ce301ecc80a0fe6b7fa895bb9ee4c93 README.md
|
||||
4e1e18362ec5d995139d84c92495ff20ab93c410d95af09aa9b5c5bad45e5f7f closure.sh
|
||||
f426e892950040f3514093a3263cf73e16aca95488c552d1c921ecc8329080c0 migration-test.py
|
||||
72724b88e2afa930b8244f8546092c233040c987ce5f2dad2298c306cc91601f db_tools.py
|
||||
934a04b5d6ec9aa62cb991fb2f57256c439bac4b2ac110cabd524ad456e59491 framework/capabilities.json
|
||||
3747e20ed6fc26ea1165308ee774233cf09a418eab799209ea06eb94ae0f5d59 framework/framework-ci.txt
|
||||
56c2f6135efd08c8ae2f207545e8079c05df362d4bbef7226286b3e5439c535d framework/mismatch.txt
|
||||
9a7ae4c05f2640cce03a9df76b547c270084401822a8f357125d8e2ff0f4d840 framework/runner-image.txt
|
||||
20cbc1539965bbf519926da678e0cdc5489d05da2960dfdde007d83d8638d0da framework/runner-pinning.txt
|
||||
f28fed24f9740bf08a74a6652628f1ec6dc7c71fd66e8577c8bbf60e97579e5f framework/scope.txt
|
||||
b442066a4584b5b2698c99ac42a5e59a47b9c118d00c31fc1dab5998066d1338 framework/toolchain.txt
|
||||
+2
-6
@@ -1,14 +1,13 @@
|
||||
{"check": "production gates before", "detail": {"commands": ["validate", "capabilities", "inventory", "retention-plan", "provision-plan", "site-policy", "registry-validate", "preflight"], "database_restore_enabled": false, "deployment_execution_enabled": false, "format_version": 1, "migration_execution_enabled": false, "permanent_deletion_enabled": false, "production_ready": false, "provisioning_execution_enabled": false}, "engine": "framework", "result": "PASS"}
|
||||
{"check": "container isolation", "detail": {"host_mounts": 0, "image_id": "sha256:e742a2668255221388004f3a42b6150a2103f5054ab3a4a93ae9e4f01e551c35", "network": "none", "privileged": false, "published_ports": 0}, "engine": "postgres", "result": "PASS"}
|
||||
{"check": "real transactionally consistent PostgreSQL backup verified", "detail": "187bceb9ebbee40ba73f274335ecbb39574d38de44f66862d0a4004730734e98", "engine": "postgres", "result": "PASS"}
|
||||
{"check": "real transactionally consistent PostgreSQL backup verified", "detail": "fbc8b0749f2f2adbce9e94555bc24e73e1e50ca7fdbae2a92d10feaf295b9ec3", "engine": "postgres", "result": "PASS"}
|
||||
{"check": "restored backup to a separate disposable database and rehearsed both migration steps", "engine": "postgres", "result": "PASS"}
|
||||
{"check": "Nginx served original release and both real worker containers ran before containment", "engine": "runtime", "result": "PASS"}
|
||||
{"check": "live migration excluded a competing site operation", "engine": "framework", "result": "PASS"}
|
||||
{"check": "abruptly stopped coordinator and interrupted an in-flight PostgreSQL transaction", "engine": "postgres", "result": "PASS"}
|
||||
{"check": "interrupted transaction rolled back, committed prefix survives, migration history unchanged", "engine": "postgres", "result": "PASS"}
|
||||
{"check": "restart inspection and activation refuse incomplete migration evidence", "engine": "framework", "result": "PASS"}
|
||||
{"check": "interrupted migration approval could not be replayed", "engine": "framework", "result": "PASS"}
|
||||
{"check": "standard paths left original release and ordinary journal byte-for-byte intact", "detail": {"journal_sha256": "053319e1971dd0e1f0b971a974b94b9a69bad413ce5e3426e810a1868fe5f4da", "release": "2"}, "engine": "framework", "result": "PASS"}
|
||||
{"check": "standard paths left original release and ordinary journal byte-for-byte intact", "detail": {"journal_sha256": "0bc7aa6f50486d8b1a054213ce63c280fbc8f221113e7f9f09d0b7cfeafb1107", "release": "2"}, "engine": "framework", "result": "PASS"}
|
||||
{"check": "reopened ordinary journal denies direct transition during unfinished migration", "engine": "framework", "result": "PASS"}
|
||||
{"check": "bound journal also rejects direct creation while migration is unfinished", "engine": "framework", "result": "PASS"}
|
||||
{"check": "durable migration intent binds original release, revision and provenance", "detail": {"fingerprint": "215281691a508f42a57945a017f78f871317e08e079d1faacac69b3dadb1416e", "release": "2", "revision": "01dda29c1d2313f5b359df427051f09e555957e9"}, "engine": "framework", "result": "PASS"}
|
||||
@@ -17,10 +16,7 @@
|
||||
{"check": "manual SQL did not authorise replay, activation or containment release", "engine": "framework", "result": "PASS"}
|
||||
{"check": "ungranted operator and incorrect plan fingerprint denied with no result", "engine": "framework", "result": "PASS"}
|
||||
{"check": "authorised review persisted once; separate forward confirmation still required", "engine": "framework", "result": "PASS"}
|
||||
{"check": "public Nginx stayed at 503 and both workers stopped across release switch", "engine": "runtime", "result": "PASS"}
|
||||
{"check": "protected Nginx listener served candidate while public HTTP and workers stayed contained", "engine": "runtime", "result": "PASS"}
|
||||
{"check": "separate forward confirmation activated the fixture without rerunning migration", "engine": "framework", "result": "PASS"}
|
||||
{"check": "verified archival cleared the migration guard without rewriting ordinary journal", "engine": "framework", "result": "PASS"}
|
||||
{"check": "disposable Nginx and workers removed", "engine": "runtime", "result": "PASS"}
|
||||
{"check": "disposable PostgreSQL container and anonymous data volume removed", "engine": "framework", "result": "PASS"}
|
||||
{"check": "production gates after", "detail": {"commands": ["validate", "capabilities", "inventory", "retention-plan", "provision-plan", "site-policy", "registry-validate", "preflight"], "database_restore_enabled": false, "deployment_execution_enabled": false, "format_version": 1, "migration_execution_enabled": false, "permanent_deletion_enabled": false, "production_ready": false, "provisioning_execution_enabled": false}, "engine": "framework", "result": "PASS"}
|
||||
+2
-3
@@ -2,12 +2,11 @@ set -euo pipefail
|
||||
umask 077
|
||||
test "$(hostname -s | tr A-Z a-z)" = absdev-ci
|
||||
test "$(id -u)" -ne 0
|
||||
stage=$(mktemp -d /var/tmp/absdev-nginx-reconcile.XXXXXX)
|
||||
stage=$(mktemp -d /var/tmp/absdev-live-reconcile.XXXXXX)
|
||||
trap 'rm -rf -- "$stage"' EXIT
|
||||
cd "$stage"
|
||||
tar -xm -f -
|
||||
git clone -q framework.bundle framework
|
||||
git -C framework checkout -q --detach 054c546c8fc24684779dbcc890c72c0bf3d344df
|
||||
git clone -q --branch combined-qualification framework.bundle framework
|
||||
mkdir tmp
|
||||
export TMPDIR="$stage/tmp"
|
||||
python3 -B migration-test.py >&2
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"active_release": "3",
|
||||
"approval_id": "597fb572f6994e0687e1e71b7538e47a",
|
||||
"checksum": "5073931361d0903eb93237971f5e097b616e917a2778a358ddd8f1e965faa249",
|
||||
"completed_at": "2026-11-30T10:01:54.383439+00:00",
|
||||
"database_restored": false,
|
||||
"format_version": 1,
|
||||
"health_verified": true,
|
||||
"intent_checksum": "61e96ce130885d03ff58eaaa8dd628340e148a33f9f9e82a0273e5e5fa7ce206",
|
||||
"migration_reexecuted": false,
|
||||
"plan_fingerprint": "d8c2e6c1e2b42af767a74c6d7c2e6ecb117e92ba7130cfb971f454c9976a5886",
|
||||
"site": "absdev-migration-lab",
|
||||
"status": "VERIFIED"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"commands": [
|
||||
"validate",
|
||||
"capabilities",
|
||||
"inventory",
|
||||
"retention-plan",
|
||||
"provision-plan",
|
||||
"site-policy",
|
||||
"registry-validate",
|
||||
"preflight"
|
||||
],
|
||||
"database_restore_enabled": false,
|
||||
"deployment_execution_enabled": false,
|
||||
"format_version": 1,
|
||||
"migration_execution_enabled": false,
|
||||
"permanent_deletion_enabled": false,
|
||||
"production_ready": false,
|
||||
"provisioning_execution_enabled": false
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
=== ABSDEV FRAMEWORK CI ===
|
||||
Python 3.14.4
|
||||
|
||||
=== PYTHON SYNTAX VALIDATION ===
|
||||
PASS: 90 Python sources compiled
|
||||
|
||||
=== COMPLETE UNIT REGRESSION SUITE ===
|
||||
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
|
||||
----------------------------------------------------------------------
|
||||
Ran 909 tests in 20.182s
|
||||
|
||||
OK
|
||||
|
||||
=== VERIFY PRODUCTION CAPABILITY RESTRICTIONS ===
|
||||
PASS: production_ready=false
|
||||
PASS: deployment_execution_enabled=false
|
||||
PASS: migration_execution_enabled=false
|
||||
PASS: provisioning_execution_enabled=false
|
||||
PASS: database_restore_enabled=false
|
||||
PASS: permanent_deletion_enabled=false
|
||||
PASS: Unsupported command rejected: deploy
|
||||
PASS: Unsupported command rejected: migrate
|
||||
PASS: Unsupported command rejected: rollback
|
||||
PASS: Unsupported command rejected: restore
|
||||
PASS: Unsupported command rejected: provision
|
||||
PASS: Unsupported command rejected: delete
|
||||
|
||||
=== EXAMPLE CONFIGURATION ===
|
||||
PASS: Configuration valid
|
||||
Site: example-absdev-net
|
||||
Domain: example.absdev.net
|
||||
Database: mysql
|
||||
Schema: 1
|
||||
No deployment performed
|
||||
{
|
||||
"configuration_fingerprint": "8067fa8477a7d50cbcc42b585961bcd4dbce5407fc7e4bffcfb3e07af529e483",
|
||||
"execution_permitted": false,
|
||||
"fingerprint": "d271a3a3ed2cbda032f905558fe9ada653c380c74306fc714ebc594483a63042",
|
||||
"format_version": 1,
|
||||
"runtime_verified": false,
|
||||
"site": "example-absdev-net",
|
||||
"static_policy_verified": true,
|
||||
"status": "VALID"
|
||||
}
|
||||
{
|
||||
"configuration_fingerprint": "8067fa8477a7d50cbcc42b585961bcd4dbce5407fc7e4bffcfb3e07af529e483",
|
||||
"database": {
|
||||
"container": "platform-mysql",
|
||||
"driver": "mysql",
|
||||
"name": "example_db",
|
||||
"username": "example_app"
|
||||
},
|
||||
"database_creation_permitted": false,
|
||||
"directories": [
|
||||
"/opt/laravel-sites/example-absdev-net",
|
||||
"/opt/laravel-sites/example-absdev-net/app",
|
||||
"/opt/laravel-sites/example-absdev-net/app/releases",
|
||||
"/opt/laravel-sites/example-absdev-net/app/shared",
|
||||
"/opt/laravel-sites/example-absdev-net/deployment",
|
||||
"/opt/laravel-sites/example-absdev-net/backups",
|
||||
"/opt/laravel-sites/example-absdev-net/deployment/state",
|
||||
"/opt/laravel-sites/example-absdev-net/deployment/approvals",
|
||||
"/opt/laravel-sites/example-absdev-net/deployment/archives"
|
||||
],
|
||||
"docker": {
|
||||
"networks": [
|
||||
"laravel_backend",
|
||||
"laravel_proxy"
|
||||
],
|
||||
"project": "site-example-absdev-net",
|
||||
"services": [
|
||||
"php",
|
||||
"web",
|
||||
"queue",
|
||||
"scheduler"
|
||||
]
|
||||
},
|
||||
"domain": "example.absdev.net",
|
||||
"execution_permitted": false,
|
||||
"filesystem_permissions_verified": false,
|
||||
"fingerprint": "d8432e17dc1b91ce4712ab656c14c0b5a0957c54700b027b22444dc3a4c19feb",
|
||||
"format_version": 1,
|
||||
"origin_port": 8199,
|
||||
"repository": {
|
||||
"branch": "main",
|
||||
"url": "[email protected]:example/application.git"
|
||||
},
|
||||
"resource_conflicts_checked": false,
|
||||
"retention": {
|
||||
"automatic_deletion": false,
|
||||
"keep_releases": 5
|
||||
},
|
||||
"root": "/opt/laravel-sites/example-absdev-net",
|
||||
"secrets_required": true,
|
||||
"site": "example-absdev-net",
|
||||
"site_policy_fingerprint": "d271a3a3ed2cbda032f905558fe9ada653c380c74306fc714ebc594483a63042",
|
||||
"static_policy_verified": true,
|
||||
"status": "PLAN_ONLY"
|
||||
}
|
||||
|
||||
=== REFERENCE INTEGRITY ===
|
||||
SKIP: Private reference excluded from checkout
|
||||
|
||||
========================================
|
||||
PASS: FRAMEWORK CI
|
||||
UNIT TESTS AND STATIC VALIDATION ONLY
|
||||
DATABASE INTEGRATION NOT EXECUTED
|
||||
========================================
|
||||
@@ -0,0 +1,3 @@
|
||||
/usr/bin/python3: FAILED
|
||||
sha256sum/usr/bin/git: OK
|
||||
: WARNING: 1 computed checksum did NOT match
|
||||
@@ -0,0 +1 @@
|
||||
sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7
|
||||
@@ -0,0 +1,3 @@
|
||||
- "absdev-ci:docker://docker.gitea.com/runner-images@sha256:203ba5eff144b485821fc41c47f29ed24333304660e953e8983b9b852e013ca0"
|
||||
force_pull: false
|
||||
force_rebuild: false
|
||||
@@ -0,0 +1,2 @@
|
||||
host=absdev-ci
|
||||
revision=84a7a5b23796b15cab830034aae256b9414e9693
|
||||
@@ -0,0 +1,2 @@
|
||||
/usr/bin/python3: OK
|
||||
/usr/bin/git: OK
|
||||
+4
-4
@@ -6,7 +6,7 @@
|
||||
"2026_01_01_000000_create_fixture",
|
||||
"2026_11_28_000001_recovery_probe"
|
||||
],
|
||||
"journal_sha256": "053319e1971dd0e1f0b971a974b94b9a69bad413ce5e3426e810a1868fe5f4da",
|
||||
"journal_sha256": "0bc7aa6f50486d8b1a054213ce63c280fbc8f221113e7f9f09d0b7cfeafb1107",
|
||||
"prefix_oid": "16429",
|
||||
"suffix_exists": true
|
||||
},
|
||||
@@ -17,13 +17,13 @@
|
||||
"history": [
|
||||
"2026_01_01_000000_create_fixture"
|
||||
],
|
||||
"journal_sha256": "053319e1971dd0e1f0b971a974b94b9a69bad413ce5e3426e810a1868fe5f4da",
|
||||
"journal_sha256": "0bc7aa6f50486d8b1a054213ce63c280fbc8f221113e7f9f09d0b7cfeafb1107",
|
||||
"prefix_oid": "16429",
|
||||
"suffix_exists": false
|
||||
},
|
||||
"intent_checksum": "9d75f8ff22c02ffa9f72a3c91404fdb70b89ebccd50e051f2159f2d12a8fd21e",
|
||||
"intent_checksum": "e2576145ef72872aea1317f1ce579847fb2491a1598c195376b4f46758d010fc",
|
||||
"operation": "complete only interrupted suffix in disposable fixture"
|
||||
},
|
||||
"plan_fingerprint": "d33ef6fdc0e8bb8035cdd207da86344264ea5d01c9d0613d3ba5c71661c66fb1",
|
||||
"plan_fingerprint": "923cac36d0168c9f646969141f78364f338d2a26a99f8f19d2bc46a0f037857e",
|
||||
"scope": "Fixture repair followed by framework-recorded reconciliation"
|
||||
}
|
||||
+20
-137
@@ -29,12 +29,11 @@ from core.migration import MigrationCoordinator, MigrationError
|
||||
from core.migration_recovery import MigrationRecovery, MigrationRecoveryError
|
||||
from core.migration_archive import MigrationArchive
|
||||
from core.trusted_rehearsal import TrustedRehearsal
|
||||
from core.services import ContainedServiceLifecycle
|
||||
from core.operator_approval import OperatorApprovalPolicy, OperatorGrant
|
||||
from core.releases import ReleaseManager
|
||||
from core.transactions import TransactionError, TransactionJournal
|
||||
|
||||
REVISION="054c546c8fc24684779dbcc890c72c0bf3d344df"
|
||||
REVISION="84a7a5b23796b15cab830034aae256b9414e9693"
|
||||
fixture.EXPECTED=REVISION
|
||||
fixture.REPO=REPO
|
||||
MIGRATION="2026_11_28_000001_recovery_probe"
|
||||
@@ -50,102 +49,6 @@ def write(name,data):
|
||||
(ROOT/name).write_text(json.dumps(data,indent=2,sort_keys=True)+"\n")
|
||||
|
||||
|
||||
RUNTIME = None
|
||||
NGINX_IMAGE = "nginx@sha256:552e7481ca93ffccd046aa658dbbed22caefbc09c66fa7cd247cbb90b8a5c609"
|
||||
PYTHON_IMAGE = "python@sha256:22eafb370920ad8b429e0aec3fff433e0669968519f5d60469d83729c138b28b"
|
||||
|
||||
def live_services(config, app):
|
||||
global RUNTIME
|
||||
site = SITE + "-" + fixture.RUN
|
||||
project = "site-" + site
|
||||
runtime = ROOT / "docker-runtime"
|
||||
runtime.mkdir()
|
||||
gate = runtime / "gate"
|
||||
gate.mkdir(mode=0o755)
|
||||
gate.chmod(0o755)
|
||||
spec = runtime / "nginx.conf"
|
||||
spec.write_text("""pid /tmp/nginx.pid;
|
||||
events {}
|
||||
http {
|
||||
access_log off;
|
||||
server {
|
||||
listen 8080;
|
||||
root /srv/app/current/public;
|
||||
location / {
|
||||
if (-f /gate/closed) { return 503 "maintenance"; }
|
||||
try_files /index.php =404;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 127.0.0.1:8081;
|
||||
root /srv/app/current/public;
|
||||
location / { try_files /index.php =404; }
|
||||
}
|
||||
}
|
||||
""")
|
||||
spec.chmod(0o644)
|
||||
# The mount hides private ancestors; static fixture pages remain readable.
|
||||
for directory in (app, app/"releases", *(app/"releases").iterdir()):
|
||||
for child in (directory, directory/"public"):
|
||||
if child.is_dir():
|
||||
child.chmod(0o755)
|
||||
page=directory/"public/index.php"
|
||||
if page.exists():
|
||||
page.chmod(0o644)
|
||||
worker={"image":PYTHON_IMAGE,"pull_policy":"never","read_only":True,
|
||||
"entrypoint":["python","-c","import time; time.sleep(600)"],"networks":["private"],
|
||||
"cap_drop":["ALL"],"security_opt":["no-new-privileges:true"],"user":"10001:10001"}
|
||||
services={name:dict(worker) for name in ("php","queue","scheduler")}
|
||||
services["web"]={"image":NGINX_IMAGE,"pull_policy":"never",
|
||||
"entrypoint":["nginx","-g","daemon off;"],"networks":["private"],
|
||||
"volumes":[f"{spec}:/etc/nginx/nginx.conf:ro",f"{app}:/srv/app:ro",f"{gate}:/gate:ro"],
|
||||
"security_opt":["no-new-privileges:true"],"cap_drop":["NET_RAW"]}
|
||||
services["healthcheck"]={k:v for k,v in worker.items() if k!="networks"}
|
||||
services["healthcheck"]["network_mode"]="service:web"
|
||||
services["healthcheck"]["depends_on"]=["web"]
|
||||
(runtime/"compose.yaml").write_text(json.dumps({"services":services,"networks":{"private":{"internal":True}}}))
|
||||
config=json.loads(json.dumps(config))
|
||||
config["site"].update(root=str(runtime),identifier=site)
|
||||
config["docker"].update(project=project,backend_network="private")
|
||||
wrapper=("sudo","-n","env","DOCKER_CONFIG=/var/tmp/absdev-supported-containment.L6qYEi/docker-config","docker")
|
||||
prefix=("docker","compose","--project-name",project,"--project-directory",str(runtime),
|
||||
"--file",str(runtime/"compose.yaml"))
|
||||
def invoke(*tail,timeout=60):
|
||||
return cmd((*wrapper,*prefix[1:],*tail), timeout=timeout)
|
||||
def verify(argv,*,timeout):
|
||||
require(argv[:len(prefix)]==prefix,"Unexpected Compose project")
|
||||
return invoke(*argv[len(prefix):],timeout=timeout)
|
||||
def runner(argv,*,timeout):
|
||||
result=verify(argv,timeout=timeout)
|
||||
require(result.returncode==0,result.stderr[-800:])
|
||||
return result.returncode
|
||||
def topology(argv,*,timeout):
|
||||
result=verify(argv,timeout=timeout)
|
||||
require(result.returncode==0,"Compose topology unavailable")
|
||||
return result.stdout
|
||||
def status(service):
|
||||
container=invoke("ps","-aq",service).stdout.strip()
|
||||
return bool(container) and good((*DOCKER,"inspect","--format","{{.State.Running}}",container))=="true"
|
||||
def http(port):
|
||||
probe=("import http.client,json,sys; c=http.client.HTTPConnection('127.0.0.1',int(sys.argv[1]),timeout=3); "
|
||||
"c.request('GET','/'); r=c.getresponse(); print(json.dumps([r.status,r.read().decode().strip()]))")
|
||||
for _ in range(12):
|
||||
result=invoke("exec","-T","healthcheck","python","-c",probe,str(port))
|
||||
if result.returncode==0:
|
||||
return tuple(json.loads(result.stdout))
|
||||
time.sleep(.25)
|
||||
raise RuntimeError("Live Nginx probe failed")
|
||||
RUNTIME=lambda: good((*wrapper,*prefix[1:],"down","--timeout","2","--volumes"))
|
||||
require(invoke("up","-d","--pull","never").returncode==0,"Live runtime startup failed")
|
||||
require(http(8080)==(200,"release=2") and all(status(n) for n in ("queue","scheduler")),
|
||||
"Live runtime did not serve the original release with active workers")
|
||||
record("runtime","Nginx served original release and both real worker containers ran before containment","PASS")
|
||||
lifecycle=ContainedServiceLifecycle(config,runner,gate_directory=gate,
|
||||
ingress_sealed=lambda:http(8080)==(503,"maintenance"),
|
||||
worker_running=status,stop_timeout=2,topology_runner=topology)
|
||||
return lifecycle,http,status
|
||||
|
||||
|
||||
def exercise(name):
|
||||
fixture.ready("postgres",name,"postgres")
|
||||
admin=fixture.connect("postgres",name,"admin","postgres")
|
||||
@@ -242,8 +145,7 @@ INSERT INTO work.items VALUES (1,'original');
|
||||
"target_identity":rehearsal_id,"applied_migrations":[MIGRATION],
|
||||
"checks":{key:True for key in ("isolation_verified","backup_restored","migration_succeeded",
|
||||
"migration_history_verified","application_verified","cleanup_verified")}}
|
||||
rehearsal_key=secrets.token_bytes(32)
|
||||
trusted=TrustedRehearsal("absdev-ci-reconciliation",trusted_runner,key_loader=lambda:rehearsal_key,clock=now)
|
||||
trusted=TrustedRehearsal("absdev-ci-reconciliation",trusted_runner,key=secrets.token_bytes(32),clock=now)
|
||||
ops=SiteOperations(ROOT,operator_policy=lambda:policy,trusted_rehearsal=trusted)
|
||||
ordinary=ops.journal.create(site=SITE,previous="1",candidate="2",
|
||||
revision=versions["2"]["revision"],provenance=versions["2"]["fingerprint"],
|
||||
@@ -268,13 +170,15 @@ INSERT INTO work.items VALUES (1,'original');
|
||||
identifier=approval["approval_id"]
|
||||
ops.approvals.save(approval,ctx,rehearsal=rehearsal,confirmation=approval["confirmation"],now=now())
|
||||
write("rehearsal.json",rehearsal)
|
||||
services, web_http, worker_status = live_services(config, app)
|
||||
gate=ROOT/"containment.closed"
|
||||
def contain():
|
||||
services.quiesce()
|
||||
return services.stopped()
|
||||
|
||||
with gate.open("w") as handle:
|
||||
handle.write("maintenance\n")
|
||||
handle.flush()
|
||||
os.fsync(handle.fileno())
|
||||
return True
|
||||
def contained():
|
||||
return services.stopped() and web_http(8080) == (503, "maintenance")
|
||||
return gate.is_file()
|
||||
backup_ok=lambda:backup.verify(artifact)["sha256"]==manifest["sha256"]
|
||||
appname="absdev_fixture_interruption"
|
||||
def interrupted_migration(pending):
|
||||
@@ -511,36 +415,23 @@ COMMIT;
|
||||
"Reconciliation did not produce a guarded forward plan")
|
||||
record("framework","authorised review persisted once; separate forward confirmation still required","PASS")
|
||||
write("reconciliation-result.json",recorded)
|
||||
# Continue using the real release manager and disposable database. The
|
||||
# service probes below model containment and readiness in this fixture.
|
||||
def activate(target):
|
||||
require(contained(),"Activation escaped Nginx and worker containment")
|
||||
require(contained(),"Fixture activation escaped containment")
|
||||
releases.activate(target)
|
||||
require(contained(),"Containment lost across release switch")
|
||||
record("runtime","public Nginx stayed at 503 and both workers stopped across release switch","PASS")
|
||||
return True
|
||||
|
||||
def refresh():
|
||||
services.refresh()
|
||||
return contained()
|
||||
|
||||
def readiness():
|
||||
ready=contained() and web_http(8081)==(200,"release=3")
|
||||
if ready:
|
||||
record("runtime","protected Nginx listener served candidate while public HTTP and workers stayed contained","PASS")
|
||||
return ready
|
||||
|
||||
def reopen():
|
||||
require(contained() and releases.current()=="3" and history()==[BASE,MIGRATION]
|
||||
and web_http(8081)==(200,"release=3"),"Reopening preceded candidate readiness")
|
||||
services.resume()
|
||||
return web_http(8080)==(200,"release=3") and all(worker_status(n) for n in ("queue","scheduler"))
|
||||
|
||||
health=lambda release:{"healthy":web_http(8080)==(200,"release="+release)
|
||||
and all(worker_status(n) for n in ("queue","scheduler")),"release":release}
|
||||
require(contained() and releases.current()=="3" and history()==[BASE,MIGRATION],
|
||||
"Fixture reopening happened before candidate and history verification")
|
||||
gate.unlink()
|
||||
return True
|
||||
health=lambda release:{"healthy":not contained() and releases.current()==release,"release":release}
|
||||
recovery.activate=activate
|
||||
recovery.refresh=refresh
|
||||
recovery.readiness_probe=readiness
|
||||
recovery.refresh=lambda:contained()
|
||||
recovery.readiness_probe=lambda:contained() and releases.current()=="3"
|
||||
recovery.release_containment=reopen
|
||||
recovery.writes_enabled_probe=lambda:health("3")["healthy"]
|
||||
recovery.writes_enabled_probe=lambda:not contained()
|
||||
recovery.health_probe=health
|
||||
activation=recovery.execute(identifier,confirmation=forward["confirmation"],
|
||||
fingerprint=forward["plan_fingerprint"])
|
||||
@@ -572,14 +463,6 @@ def main():
|
||||
try:
|
||||
exercise(fixture.start("postgres"))
|
||||
finally:
|
||||
if RUNTIME is not None:
|
||||
try:
|
||||
RUNTIME()
|
||||
record("runtime","disposable Nginx and workers removed","PASS")
|
||||
finally:
|
||||
for container in fixture.containers:
|
||||
good((*DOCKER,"rm","-f","-v",container))
|
||||
fixture.containers.clear()
|
||||
for container in fixture.containers:
|
||||
good((*DOCKER,"rm","-f","-v",container))
|
||||
require(not good((*DOCKER,"ps","-aq","--filter","label=absdev.qualification="+fixture.RUN)),
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
"2026_01_01_000000_create_fixture",
|
||||
"2026_11_28_000001_recovery_probe"
|
||||
],
|
||||
"ordinary_journal_before_and_after_sha256": "053319e1971dd0e1f0b971a974b94b9a69bad413ce5e3426e810a1868fe5f4da",
|
||||
"ordinary_journal_before_and_after_sha256": "0bc7aa6f50486d8b1a054213ce63c280fbc8f221113e7f9f09d0b7cfeafb1107",
|
||||
"rollback_attempted": false,
|
||||
"unfinished_step_rolled_back": true
|
||||
}
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"candidate": "2",
|
||||
"checksum": "bc789bc6e721e2e60cbfb556b8c6a1ae709615a9d23b39dee8945de91c292bae",
|
||||
"checksum": "673ec866d374ca91cb617a09d35b6b70e01411198a619802ae6bd627066061a8",
|
||||
"format_version": 1,
|
||||
"history": [
|
||||
{
|
||||
"phase": "PREPARED",
|
||||
"timestamp": "2026-11-30T12:06:16.984442+00:00"
|
||||
"timestamp": "2026-11-30T10:01:44.048476+00:00"
|
||||
}
|
||||
],
|
||||
"phase": "PREPARED",
|
||||
@@ -15,5 +15,5 @@
|
||||
"provenance": "215281691a508f42a57945a017f78f871317e08e079d1faacac69b3dadb1416e",
|
||||
"revision": "01dda29c1d2313f5b359df427051f09e555957e9",
|
||||
"site": "absdev-migration-lab",
|
||||
"transaction_id": "a63a0697e52e4f658e713d1a2befc598"
|
||||
"transaction_id": "c7555cde0e8b41e28a33f3969c6da809"
|
||||
}
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"candidate": "2",
|
||||
"checksum": "bc789bc6e721e2e60cbfb556b8c6a1ae709615a9d23b39dee8945de91c292bae",
|
||||
"checksum": "673ec866d374ca91cb617a09d35b6b70e01411198a619802ae6bd627066061a8",
|
||||
"format_version": 1,
|
||||
"history": [
|
||||
{
|
||||
"phase": "PREPARED",
|
||||
"timestamp": "2026-11-30T12:06:16.984442+00:00"
|
||||
"timestamp": "2026-11-30T10:01:44.048476+00:00"
|
||||
}
|
||||
],
|
||||
"phase": "PREPARED",
|
||||
@@ -15,5 +15,5 @@
|
||||
"provenance": "215281691a508f42a57945a017f78f871317e08e079d1faacac69b3dadb1416e",
|
||||
"revision": "01dda29c1d2313f5b359df427051f09e555957e9",
|
||||
"site": "absdev-migration-lab",
|
||||
"transaction_id": "a63a0697e52e4f658e713d1a2befc598"
|
||||
"transaction_id": "c7555cde0e8b41e28a33f3969c6da809"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"application_activated": false,
|
||||
"applied_migrations": [
|
||||
"2026_11_28_000001_recovery_probe"
|
||||
],
|
||||
"approval_id": "597fb572f6994e0687e1e71b7538e47a",
|
||||
"automatic_database_rollback": false,
|
||||
"checksum": "d15679a77584401c517e2a80e971008879cad13a45bd680898089735b689bc79",
|
||||
"completed_at": "2026-11-30T10:01:51.456619+00:00",
|
||||
"consumption_checksum": "f40a1bd3e1b0cdf1e962e407aee19007550b1bba9834b7f6b147e2caaf369715",
|
||||
"containment_required": true,
|
||||
"database_identity": "45e527ab72fc70724c3f0db2b6d62d8fda606c8dc73f0fa71d7f742ba9cb60de",
|
||||
"format_version": 1,
|
||||
"history_after": [
|
||||
"2026_01_01_000000_create_fixture",
|
||||
"2026_11_28_000001_recovery_probe"
|
||||
],
|
||||
"intent_checksum": "e2576145ef72872aea1317f1ce579847fb2491a1598c195376b4f46758d010fc",
|
||||
"reconciliation": {
|
||||
"evidence_sha256": "628e35c5e185320a38460db87a766f28b213c5632b1ac35d67f03ee47decb9f2",
|
||||
"operator": "ci-fixture-operator",
|
||||
"plan_fingerprint": "4a926b2621874502cf82d04c34883b1a1d6dbde3055d324678e282aa1483d78c"
|
||||
},
|
||||
"release": "3",
|
||||
"revision": "4395434f6a2e6831af4b7a68c991fd69afdda6d3",
|
||||
"site": "absdev-migration-lab",
|
||||
"status": "MIGRATED"
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"host": "ABSDEV-CI",
|
||||
"open_gates": [],
|
||||
"passed": 26,
|
||||
"passed": 22,
|
||||
"production_execution_enabled": false,
|
||||
"production_ready": false,
|
||||
"revision": "054c546c8fc24684779dbcc890c72c0bf3d344df"
|
||||
"revision": "84a7a5b23796b15cab830034aae256b9414e9693"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
# Live interrupted migration and containment
|
||||
|
||||
Tested ABSDEV-CI revision 054c546c8fc24684779dbcc890c72c0bf3d344df. The
|
||||
interruption, PostgreSQL repair, on-disk release switch, Nginx HTTP probes,
|
||||
worker container stop/start and archival were live. Nginx served static
|
||||
release markers, and workers were disposable process fixtures. No real
|
||||
application workload or production service was involved.
|
||||
|
||||
Public Nginx served 503 and both Docker workers stayed stopped across the
|
||||
release switch and protected candidate readiness check. A separately confirmed
|
||||
forward activation reopened Nginx and workers before verified archival.
|
||||
Archival cleared the migration guard without altering the ordinary journal.
|
||||
No migration was replayed. Temporary resources were removed.
|
||||
@@ -1,12 +0,0 @@
|
||||
0278c1eab47e4d726dcbed5e8ad554a2a7c7db96b849995845532837f86f4a79 ./checks.jsonl
|
||||
f5f56e04e572dc499ae544b6fe687d1ca9c59fbd9b5dc4f9c8f3ead0996cdd3b ./forward-activation.json
|
||||
dc120ecdc04e635ae32fa3ef737ef430c2ef70cd1127a61064655eef6d5e7b92 ./manual-reconciliation.json
|
||||
efa14ef1211e35a3a51a8a3ee9529845f3617c5666a3998b4c31c14b45aacd29 ./observed.json
|
||||
053319e1971dd0e1f0b971a974b94b9a69bad413ce5e3426e810a1868fe5f4da ./ordinary-after.json
|
||||
053319e1971dd0e1f0b971a974b94b9a69bad413ce5e3426e810a1868fe5f4da ./ordinary-before.json
|
||||
d12e52bda1eb6b744b5969025996b14d74f5a33a0c685f66e5366ec56ed52fac ./reconciliation-result.json
|
||||
25c038619bb0baf7d03e4ad61d1af596e4a49218d03aca2e41f93a781eac9ce1 ./summary.json
|
||||
a750ff67606373fdf767894281bdebbd06310c381f7af36f969ed5542e5e6299 run.sh
|
||||
47156598a79873c4b1136860c0ce29b84058c9ba0789c5e7651fb1db8bd6dbe5 migration-test.py
|
||||
72724b88e2afa930b8244f8546092c233040c987ce5f2dad2298c306cc91601f db_tools.py
|
||||
648918d2cd932fe1849fd62929c613785ed4ee1e0f15011f069aecbda0e45ea2 SCOPE.md
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"active_release": "3",
|
||||
"approval_id": "f859ad8579db4eee970994687b40fd24",
|
||||
"checksum": "53e38f62ff76fe2eaab3b1040fba425f21d26942aceef1bc0a51f7e168e3a962",
|
||||
"completed_at": "2026-11-30T12:07:07.221466+00:00",
|
||||
"database_restored": false,
|
||||
"format_version": 1,
|
||||
"health_verified": true,
|
||||
"intent_checksum": "6f16ca01a906f66a37fa5cf21ec077e4a221e41a39d06c80371e3cdf1a0aa497",
|
||||
"migration_reexecuted": false,
|
||||
"plan_fingerprint": "2b7fbfc73a1b6864f1db620eae9ede3f9042cce42908b30341e75c9dbdd9971e",
|
||||
"site": "absdev-migration-lab",
|
||||
"status": "VERIFIED"
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"application_activated": false,
|
||||
"applied_migrations": [
|
||||
"2026_11_28_000001_recovery_probe"
|
||||
],
|
||||
"approval_id": "f859ad8579db4eee970994687b40fd24",
|
||||
"automatic_database_rollback": false,
|
||||
"checksum": "761ea2765d04dd130a31fc754c18bb102d75678843e6fcf7b9781aea652cd0b2",
|
||||
"completed_at": "2026-11-30T12:06:42.377685+00:00",
|
||||
"consumption_checksum": "dc32179f66ddc726309f54c32d2c362b2209856110bf7ce69eeb588273272191",
|
||||
"containment_required": true,
|
||||
"database_identity": "a7add5b954dc8e7f4b8c15ae9b37f41453eb9871074d29f2bacd77ec964791d4",
|
||||
"format_version": 1,
|
||||
"history_after": [
|
||||
"2026_01_01_000000_create_fixture",
|
||||
"2026_11_28_000001_recovery_probe"
|
||||
],
|
||||
"intent_checksum": "9d75f8ff22c02ffa9f72a3c91404fdb70b89ebccd50e051f2159f2d12a8fd21e",
|
||||
"reconciliation": {
|
||||
"evidence_sha256": "bf7260e33b693450d5d4a9f3aa4977ba92f546091986ab8c9a0d799916d7dc83",
|
||||
"operator": "ci-fixture-operator",
|
||||
"plan_fingerprint": "8adf45e2656080c1d5063eebb3bb4c47ca1076c7922b48f601d8905e449f7c61"
|
||||
},
|
||||
"release": "3",
|
||||
"revision": "4395434f6a2e6831af4b7a68c991fd69afdda6d3",
|
||||
"site": "absdev-migration-lab",
|
||||
"status": "MIGRATED"
|
||||
}
|
||||
@@ -63,10 +63,9 @@ class ApprovalStoreTests(unittest.TestCase):
|
||||
},
|
||||
}
|
||||
|
||||
self.rehearsal_key = os.urandom(32)
|
||||
self.trusted_rehearsal = TrustedRehearsal(
|
||||
"fixture-runner", lambda _context: self.execution,
|
||||
key_loader=lambda: self.rehearsal_key, clock=lambda: self.now,
|
||||
key=os.urandom(32), clock=lambda: self.now,
|
||||
)
|
||||
self.rehearsal = self.trusted_rehearsal.run(self.base)
|
||||
self.context = self.trusted_rehearsal.approval_context(
|
||||
@@ -573,13 +572,5 @@ class ApprovalStoreTests(unittest.TestCase):
|
||||
self.assertFalse(self.store.approval_path(self.approval["approval_id"]).exists())
|
||||
|
||||
|
||||
def test_running_store_rejects_retired_rehearsal_key(self):
|
||||
self.save()
|
||||
self.rehearsal_key = os.urandom(32)
|
||||
with self.assertRaises(ApprovalStoreError):
|
||||
self.consume()
|
||||
self.assertFalse(self.store.consumed_path(self.identifier).exists())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -46,49 +46,3 @@ class ArchivedRetentionTests(unittest.TestCase):
|
||||
(self.path.parent / "unknown.json").write_text("{}")
|
||||
with self.assertRaises(RetentionError):
|
||||
self.plan()
|
||||
|
||||
|
||||
class RollbackRetentionTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
import test_rollback_archive
|
||||
from core.approval_store import ApprovalStore
|
||||
|
||||
fixture = test_rollback_archive.RollbackArchiveTests()
|
||||
self.addCleanup(fixture.doCleanups)
|
||||
fixture.setUp()
|
||||
self.root = fixture.recovery.root.resolve()
|
||||
approvals = self.root / "approvals"
|
||||
approvals.mkdir(mode=0o700, exist_ok=True)
|
||||
fixture.journal.bind_migration_guard(ApprovalStore(approvals))
|
||||
canonical = self.root / "archive"
|
||||
fixture.directory.rename(canonical)
|
||||
fixture.archive.destination = ApprovalStore(canonical)
|
||||
self.record = fixture.execute()
|
||||
self.journal = fixture.journal
|
||||
self.marker = fixture.marker
|
||||
self.archive_path = fixture.archive.path(fixture.identifier)
|
||||
|
||||
def plan(self):
|
||||
return plan_site_retention(self.root, keep=2, site=self.record["site"])
|
||||
|
||||
def test_retired_rollback_preserves_failed_candidate(self):
|
||||
marker_before = self.marker.read_bytes()
|
||||
archive_before = self.archive_path.read_bytes()
|
||||
plan = self.plan()
|
||||
self.assertEqual(plan["status"], "READY")
|
||||
self.assertEqual(plan["current"], "1")
|
||||
self.assertEqual(plan["failed"], ["2"])
|
||||
self.assertEqual(plan["retained"], ["1", "2", "3"])
|
||||
self.assertIn("failed_release", plan["reasons"]["2"])
|
||||
self.assertFalse(plan["execution_permitted"])
|
||||
self.assertIsNone(self.journal.load())
|
||||
self.assertEqual(marker_before, self.marker.read_bytes())
|
||||
self.assertEqual(archive_before, self.archive_path.read_bytes())
|
||||
|
||||
def test_tampered_or_missing_quarantine_marker_denies_planning(self):
|
||||
self.marker.write_text("wrong")
|
||||
with self.assertRaises(RetentionError):
|
||||
self.plan()
|
||||
self.marker.unlink()
|
||||
with self.assertRaises(RetentionError):
|
||||
self.plan()
|
||||
|
||||
Reference in New Issue
Block a user