fix(fc3h): split semicolon-stacked statements (E702) and bridge v-dialog v-model to avoid prop write
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,8 @@ _BACKUP_SETTINGS_FIELDS = (
|
|||||||
|
|
||||||
|
|
||||||
def _bad(error: str, *, status: int = 400, **extra):
|
def _bad(error: str, *, status: int = 400, **extra):
|
||||||
body = {"error": error}; body.update(extra)
|
body = {"error": error}
|
||||||
|
body.update(extra)
|
||||||
return jsonify(body), status
|
return jsonify(body), status
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ def backup_db_task(self, *, tag: str | None = None,
|
|||||||
kind="db", status="running", tag=tag,
|
kind="db", status="running", tag=tag,
|
||||||
triggered_by=triggered_by, started_at=now, manifest={},
|
triggered_by=triggered_by, started_at=now, manifest={},
|
||||||
)
|
)
|
||||||
session.add(row); session.commit(); session.refresh(row)
|
session.add(row)
|
||||||
|
session.commit()
|
||||||
|
session.refresh(row)
|
||||||
run_id = row.id
|
run_id = row.id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -101,7 +103,9 @@ def backup_images_task(self, *, tag: str | None = None,
|
|||||||
kind="images", status="running", tag=tag,
|
kind="images", status="running", tag=tag,
|
||||||
triggered_by=triggered_by, started_at=now, manifest={},
|
triggered_by=triggered_by, started_at=now, manifest={},
|
||||||
)
|
)
|
||||||
session.add(row); session.commit(); session.refresh(row)
|
session.add(row)
|
||||||
|
session.commit()
|
||||||
|
session.refresh(row)
|
||||||
run_id = row.id
|
run_id = row.id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -156,7 +160,9 @@ def restore_db_task(self, *, source_backup_run_id: int) -> dict:
|
|||||||
restored_from_id=src.id,
|
restored_from_id=src.id,
|
||||||
manifest={"source_sql_path": src.sql_path},
|
manifest={"source_sql_path": src.sql_path},
|
||||||
)
|
)
|
||||||
session.add(marker); session.commit(); session.refresh(marker)
|
session.add(marker)
|
||||||
|
session.commit()
|
||||||
|
session.refresh(marker)
|
||||||
marker_id = marker.id
|
marker_id = marker.id
|
||||||
sql_path = src.sql_path
|
sql_path = src.sql_path
|
||||||
|
|
||||||
@@ -200,7 +206,9 @@ def restore_images_task(self, *, source_backup_run_id: int) -> dict:
|
|||||||
restored_from_id=src.id,
|
restored_from_id=src.id,
|
||||||
manifest={"source_tar_path": src.tar_path},
|
manifest={"source_tar_path": src.tar_path},
|
||||||
)
|
)
|
||||||
session.add(marker); session.commit(); session.refresh(marker)
|
session.add(marker)
|
||||||
|
session.commit()
|
||||||
|
session.refresh(marker)
|
||||||
marker_id = marker.id
|
marker_id = marker.id
|
||||||
tar_path = src.tar_path
|
tar_path = src.tar_path
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-dialog v-model="modelValue" max-width="520" persistent>
|
<v-dialog
|
||||||
|
:model-value="modelValue"
|
||||||
|
max-width="520" persistent
|
||||||
|
@update:model-value="$emit('update:modelValue', $event)"
|
||||||
|
>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>
|
<v-card-title>
|
||||||
{{ action === 'restore' ? 'Restore' : 'Delete' }}
|
{{ action === 'restore' ? 'Restore' : 'Delete' }}
|
||||||
|
|||||||
@@ -263,7 +263,8 @@ async def test_delete_wrong_confirm_400(client, _seed_runs):
|
|||||||
async def test_delete_correct_confirm_204(client, _seed_runs, db_sync):
|
async def test_delete_correct_confirm_204(client, _seed_runs, db_sync):
|
||||||
list_resp = await client.get("/api/system/backup/runs?limit=1")
|
list_resp = await client.get("/api/system/backup/runs?limit=1")
|
||||||
row = (await list_resp.get_json())["runs"][0]
|
row = (await list_resp.get_json())["runs"][0]
|
||||||
rid = row["id"]; kind = row["kind"]
|
rid = row["id"]
|
||||||
|
kind = row["kind"]
|
||||||
|
|
||||||
resp = await client.delete(
|
resp = await client.delete(
|
||||||
f"/api/system/backup/runs/{rid}",
|
f"/api/system/backup/runs/{rid}",
|
||||||
|
|||||||
@@ -145,9 +145,12 @@ def test_restore_images_untar_to_parent(tmp_path, fake_subprocess):
|
|||||||
|
|
||||||
|
|
||||||
def test_unlink_removes_present_files_and_reports(tmp_path):
|
def test_unlink_removes_present_files_and_reports(tmp_path):
|
||||||
sql = tmp_path / "x.sql"; sql.write_bytes(b"x")
|
sql = tmp_path / "x.sql"
|
||||||
tar = tmp_path / "x.tar.zst"; tar.write_bytes(b"x")
|
sql.write_bytes(b"x")
|
||||||
manifest = tmp_path / "x.json"; manifest.write_text("{}")
|
tar = tmp_path / "x.tar.zst"
|
||||||
|
tar.write_bytes(b"x")
|
||||||
|
manifest = tmp_path / "x.json"
|
||||||
|
manifest.write_text("{}")
|
||||||
result = backup_service.unlink_artifact_files(
|
result = backup_service.unlink_artifact_files(
|
||||||
sql_path=str(sql), tar_path=str(tar), manifest_path=str(manifest),
|
sql_path=str(sql), tar_path=str(tar), manifest_path=str(manifest),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ def fake_subprocess_and_images_root(monkeypatch, tmp_path):
|
|||||||
)
|
)
|
||||||
|
|
||||||
class _FakeProc:
|
class _FakeProc:
|
||||||
returncode = 0; stdout = b""; stderr = b""
|
returncode = 0
|
||||||
|
stdout = b""
|
||||||
|
stderr = b""
|
||||||
|
|
||||||
def _fake_run(cmd, **kwargs):
|
def _fake_run(cmd, **kwargs):
|
||||||
if cmd[0] == "pg_dump":
|
if cmd[0] == "pg_dump":
|
||||||
@@ -54,7 +56,8 @@ def _seed_backup(db_sync, *, kind, status, started_at, tag=None,
|
|||||||
tar_path="/tmp/fake.tar.zst" if kind == "images" else None,
|
tar_path="/tmp/fake.tar.zst" if kind == "images" else None,
|
||||||
manifest={},
|
manifest={},
|
||||||
)
|
)
|
||||||
db_sync.add(row); db_sync.flush()
|
db_sync.add(row)
|
||||||
|
db_sync.flush()
|
||||||
return row.id
|
return row.id
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user