feat(identifiers): prepare verified cutover batches
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a023c0-a0a3-7c03-b395-5a0d2757214d
This commit is contained in:
parent
bdf3af19e2
commit
5e14d09bdf
10 changed files with 3097 additions and 0 deletions
|
|
@ -312,6 +312,20 @@ def main(argv: list[str] | None = None) -> int:
|
|||
)
|
||||
p_id_verify.add_argument("--plan", required=True)
|
||||
p_id_verify.add_argument("--repo", default=None, help="Verify one repository atomic unit")
|
||||
p_id_batch = identifier_sub.add_parser(
|
||||
"migration-batch-plan",
|
||||
help="Pin a clean synchronized repository batch for explicit approval",
|
||||
)
|
||||
p_id_batch.add_argument("--plan", required=True)
|
||||
p_id_batch.add_argument("--repo", action="append", required=True, dest="repos")
|
||||
p_id_batch.add_argument("--output", default=None)
|
||||
p_id_batch.add_argument("--force", action="store_true")
|
||||
p_id_batch_verify = identifier_sub.add_parser(
|
||||
"migration-batch-verify",
|
||||
help="Verify a saved batch seal and repeat source/Git preflight",
|
||||
)
|
||||
p_id_batch_verify.add_argument("--plan", required=True)
|
||||
p_id_batch_verify.add_argument("--batch", required=True)
|
||||
p_id_files = identifier_sub.add_parser(
|
||||
"migration-files",
|
||||
help="Validate or execute one repository's sealed UUID file rewrite",
|
||||
|
|
@ -686,7 +700,9 @@ def main(argv: list[str] | None = None) -> int:
|
|||
load_fleet_namespace,
|
||||
migrate_repository_identifier_files,
|
||||
plan_identifier_migration,
|
||||
plan_identifier_migration_batch,
|
||||
scan_live_identifier_collisions,
|
||||
verify_identifier_migration_batch,
|
||||
verify_identifier_migration_plan,
|
||||
)
|
||||
|
||||
|
|
@ -730,6 +746,37 @@ def main(argv: list[str] | None = None) -> int:
|
|||
except (OSError, TypeError, ValueError, json.JSONDecodeError) as exc:
|
||||
print(json.dumps({"ok": False, "error": str(exc)}, indent=2))
|
||||
return 1
|
||||
elif args.identifier_command == "migration-batch-plan":
|
||||
try:
|
||||
plan = json.loads(Path(args.plan).read_text(encoding="utf-8"))
|
||||
if not isinstance(plan, dict):
|
||||
raise TypeError("migration plan must be a JSON object")
|
||||
result = plan_identifier_migration_batch(plan, repo_slugs=args.repos)
|
||||
except (OSError, TypeError, ValueError, json.JSONDecodeError) as exc:
|
||||
print(json.dumps({"ok": False, "error": str(exc)}, indent=2))
|
||||
return 1
|
||||
if args.output:
|
||||
output = Path(args.output)
|
||||
if output.exists() and not args.force:
|
||||
print(
|
||||
json.dumps(
|
||||
{"ok": False, "error": f"output exists: {output}; use --force to replace"},
|
||||
indent=2,
|
||||
)
|
||||
)
|
||||
return 1
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
|
||||
elif args.identifier_command == "migration-batch-verify":
|
||||
try:
|
||||
plan = json.loads(Path(args.plan).read_text(encoding="utf-8"))
|
||||
batch = json.loads(Path(args.batch).read_text(encoding="utf-8"))
|
||||
if not isinstance(plan, dict) or not isinstance(batch, dict):
|
||||
raise TypeError("migration plan and batch must be JSON objects")
|
||||
result = verify_identifier_migration_batch(batch, plan=plan)
|
||||
except (OSError, TypeError, ValueError, json.JSONDecodeError) as exc:
|
||||
print(json.dumps({"ok": False, "error": str(exc)}, indent=2))
|
||||
return 1
|
||||
else:
|
||||
try:
|
||||
result = plan_identifier_migration(Path(args.root), namespace)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue