docs: complete repository rename operator handoff
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a049a4-ee9f-78e1-9d66-2cb0f9bea3e3
This commit is contained in:
parent
0ec5b9a98d
commit
f7402bd711
11 changed files with 735 additions and 10 deletions
88
tests/test_repository_rename_docs.py
Normal file
88
tests/test_repository_rename_docs.py
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from jsonschema import Draft202012Validator, FormatChecker
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
RUNBOOK = ROOT / "docs" / "repository-rename-operations.md"
|
||||
HANDOFF_SCHEMA = (
|
||||
ROOT / "docs" / "schemas" / "repository-rename-handoff-v1.schema.json"
|
||||
)
|
||||
HANDOFF_EXAMPLE = (
|
||||
ROOT / "docs" / "examples" / "repository-rename-handoff-v1.json"
|
||||
)
|
||||
DASHBOARD_DOC = ROOT / "dashboard" / "src" / "docs" / "repository-renames.md"
|
||||
|
||||
|
||||
def test_repository_rename_handoff_example_validates_and_contains_no_secret_value():
|
||||
schema = json.loads(HANDOFF_SCHEMA.read_text(encoding="utf-8"))
|
||||
example = json.loads(HANDOFF_EXAMPLE.read_text(encoding="utf-8"))
|
||||
Draft202012Validator.check_schema(schema)
|
||||
Draft202012Validator(schema, format_checker=FormatChecker()).validate(example)
|
||||
|
||||
assert example["handoff_id"] == example["owning_work_record"]["task_id"]
|
||||
assert example["source_repository"] == example["owning_work_record"]["repository"]
|
||||
assert example["affected"]["paths"] or example["affected"]["graph_ids"]
|
||||
assert example["verification"]
|
||||
assert example["sensitive_data_prohibited"] is True
|
||||
serialized = json.dumps(example).lower()
|
||||
for forbidden in (
|
||||
"bearer ",
|
||||
"basic ",
|
||||
"password=",
|
||||
"token=",
|
||||
"authorization=",
|
||||
"begin private key",
|
||||
"://user:",
|
||||
):
|
||||
assert forbidden not in serialized
|
||||
|
||||
|
||||
def test_operator_runbook_names_phases_commands_owners_and_last_cleanup():
|
||||
text = RUNBOOK.read_text(encoding="utf-8")
|
||||
for owner in ("State Hub", "Forgejo", "HelixForge/operator", "Target repository"):
|
||||
assert f"| {owner} |" in text
|
||||
for phase in (
|
||||
"preflighted",
|
||||
"forge-renamed",
|
||||
"statehub-rebound",
|
||||
"source-synced",
|
||||
"consumers-verified",
|
||||
"completed",
|
||||
"rollback-preflight",
|
||||
"rolled-back",
|
||||
):
|
||||
assert f"`{phase}`" in text
|
||||
for command in (
|
||||
"statehub repo rename preflight",
|
||||
"statehub repo rename start",
|
||||
"statehub repo rename apply",
|
||||
"statehub repo rename status",
|
||||
"statehub repo rename verify",
|
||||
"statehub repo rename rollback",
|
||||
):
|
||||
assert command in text
|
||||
assert "### Repository-only rename checklist" in text
|
||||
assert "### Product/runtime rename checklist" in text
|
||||
assert "## Dashboard interpretation" in text
|
||||
assert "## Recovery playbook" in text
|
||||
assert "## Rollback limits" in text
|
||||
assert "## Repository-boundary handoff format" in text
|
||||
assert "## Cleanup is deliberately last" in text
|
||||
assert "The old local checkout is the final removable asset" in text
|
||||
assert "The protected old slug alias is not cleanup material" in text
|
||||
assert "never parked only" in text
|
||||
assert "<private-mode-0600-preflight.json>" in text
|
||||
|
||||
|
||||
def test_dashboard_reference_explains_alias_and_status_boundaries():
|
||||
text = DASHBOARD_DOC.read_text(encoding="utf-8")
|
||||
assert "/repos/<old-slug>" in text
|
||||
assert "same repository UUID" in text
|
||||
assert "statehub repo rename status <operation-id> --json" in text
|
||||
assert "relationship checksums" in text
|
||||
assert "dashboard is a read surface" in text.lower()
|
||||
assert "old checkout is removed last" in text
|
||||
|
|
@ -154,6 +154,12 @@ def test_flex_auth_snapshot_is_deterministic_and_complete(tmp_path):
|
|||
assert "flexauth-legacy" in first
|
||||
assert "| Credential-route catalog | `ops-warden` |" in first
|
||||
assert "only that repository closes" in first
|
||||
assert "state-hub.repository-rename-handoff.v1" in first
|
||||
assert "state-hub/docs/schemas/repository-rename-handoff-v1.schema.json" in first
|
||||
assert "fresh_clone: true" in first
|
||||
assert "Forge numeric `forge_repository_id`" in first
|
||||
assert "exact `head_commit`" in first
|
||||
assert "every external handoff is `verified`" in first
|
||||
|
||||
|
||||
def test_generated_snapshot_passes_parser_and_quality_debt(tmp_path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue