feat: add repository rename orchestration CLI
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a049a4-ee9f-78e1-9d66-2cb0f9bea3e3
This commit is contained in:
parent
6312db8700
commit
6b82215ae7
11 changed files with 1373 additions and 4 deletions
|
|
@ -154,6 +154,55 @@ async def test_dry_run_has_no_persistent_changes(client, test_engine, rename_set
|
|||
assert after == before
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_client_operation_id_is_idempotent_and_globally_discoverable(
|
||||
client, rename_setup
|
||||
):
|
||||
repo, _forge = rename_setup
|
||||
preflight = await _preflight(client, repo["id"])
|
||||
operation_id = str(uuid.uuid4())
|
||||
confirmation = f"rename:{repo['id']}:flex-auth:access-engine"
|
||||
payload = {
|
||||
"operation_id": operation_id,
|
||||
"new_slug": "access-engine",
|
||||
"preflight_token": preflight["preflight_token"],
|
||||
"confirmation": confirmation,
|
||||
"actor": "helixforge-test",
|
||||
}
|
||||
|
||||
created = await client.post(
|
||||
f"/repos/{repo['id']}/rename/operations", json=payload
|
||||
)
|
||||
replay = await client.post(
|
||||
f"/repos/{repo['id']}/rename/operations",
|
||||
json={**payload, "preflight_token": "expired-after-creation"},
|
||||
)
|
||||
assert created.status_code == replay.status_code == 201
|
||||
assert created.json()["id"] == replay.json()["id"] == operation_id
|
||||
assert created.json()["no_op"] is False
|
||||
assert replay.json()["no_op"] is True
|
||||
|
||||
discovered = await client.get(
|
||||
f"/repository-renames/operations/{operation_id}"
|
||||
)
|
||||
assert discovered.status_code == 200
|
||||
assert discovered.json()["repo_id"] == repo["id"]
|
||||
assert discovered.json()["phase"] == "preflighted"
|
||||
|
||||
collision = await client.post(
|
||||
f"/repos/{repo['id']}/rename/operations",
|
||||
json={**payload, "new_slug": "another-name"},
|
||||
)
|
||||
assert collision.status_code == 412
|
||||
assert collision.json()["detail"]["code"] == "repository_rename_precondition_failed"
|
||||
|
||||
actor_collision = await client.post(
|
||||
f"/repos/{repo['id']}/rename/operations",
|
||||
json={**payload, "actor": "different-actor"},
|
||||
)
|
||||
assert actor_collision.status_code == 412
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_interrupt_resume_every_phase_and_preserve_uuid(client, rename_setup):
|
||||
repo, forge = rename_setup
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue