feat: make the site database authoritative for documents and catalog
Verify database-backed documents / verify (pull_request) Failing after 6m6s
Verify database-backed documents / verify (pull_request) Failing after 6m6s
This commit is contained in:
+14
-2
@@ -15,7 +15,7 @@ APP = "endorphin-tabularium-docs"
|
||||
INPUTS = ["Dockerfile", "Dockerfile.ci", ".dockerignore", ".npmrc", "package.json",
|
||||
"pnpm-lock.yaml", "pnpm-workspace.yaml", "apps/docs", "content", "tools/figures",
|
||||
"scripts/check-container.sh", "scripts/ci.py", "scripts/summarize-ai-income.py",
|
||||
"scripts/audit-ai-research.py"]
|
||||
"scripts/audit-ai-research.py", "scripts/export-legacy-documents.py"]
|
||||
|
||||
|
||||
def run(*args: str, capture: bool = False) -> str:
|
||||
@@ -36,9 +36,17 @@ def fingerprint() -> str:
|
||||
|
||||
|
||||
def smoke_image(image: str, name: str) -> None:
|
||||
run("docker", "run", "-d", "--name", name, "--mount", "type=volume,dst=/auth", "-p", "127.0.0.1::3000", image)
|
||||
run("docker", "run", "-d", "--name", name, "--mount", "type=volume,dst=/auth", "-e", "DOCUMENT_SMOKE_TEST=1", "-p", "127.0.0.1::3000", image)
|
||||
try:
|
||||
run("docker", "exec", name, "node", "apps/docs/auth-cli.cjs", "init")
|
||||
subprocess.run(["docker", "exec", "-i", name, "node", "apps/docs/docs-cli.cjs", "import"],
|
||||
input=(ROOT / ".artifacts/documents-migration.json").read_bytes(), check=True)
|
||||
run("docker", "exec", name, "node", "apps/docs/docs-cli.cjs", "export", "/auth/migrated-documents.json")
|
||||
migrated = json.loads(run("docker", "exec", name, "cat", "/auth/migrated-documents.json", capture=True))
|
||||
expected = json.loads((ROOT / ".artifacts/documents-migration.json").read_text())
|
||||
if migrated != expected:
|
||||
raise RuntimeError("Migration changed document content or catalog metadata")
|
||||
run("docker", "exec", name, "node", "apps/docs/docs-cli.cjs", "backup", "/auth/smoke-backup.sqlite")
|
||||
for _ in range(60):
|
||||
state = json.loads(run("docker", "inspect", name, capture=True))[0]["State"]
|
||||
if state.get("Health", {}).get("Status") == "healthy":
|
||||
@@ -64,6 +72,10 @@ def smoke_image(image: str, name: str) -> None:
|
||||
|
||||
def main() -> None:
|
||||
os.chdir(ROOT)
|
||||
migration = ROOT / ".artifacts/documents-migration.json"
|
||||
migration.parent.mkdir(exist_ok=True)
|
||||
migration.unlink(missing_ok=True)
|
||||
run(sys.executable, "scripts/export-legacy-documents.py", "--output", str(migration))
|
||||
run(sys.executable, "scripts/summarize-ai-income.py", "--check")
|
||||
run(sys.executable, "scripts/audit-ai-research.py", "--check")
|
||||
run(sys.executable, "-m", "unittest", "discover", "-s", "scripts", "-p", "test_*.py")
|
||||
|
||||
Reference in New Issue
Block a user