What happened?
A failed graph.json backup copy can still print backed up semantic graph and return the backup directory. In a local reproduction, a read-only same-day backup kept the old graph while a sidecar copied successfully. There was no warning that the returned backup was stale.
I'd expect an incomplete backup to return None and warn which file failed. The existing best-effort overwrite behavior can stay unchanged.
Steps to reproduce
Run as a regular user on macOS or Linux; root may bypass the read-only permission:
python - <<'PY'
from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from pathlib import Path
from tempfile import TemporaryDirectory
from graphify.export import backup_if_protected
with TemporaryDirectory() as temporary:
out = Path(temporary)
graph = out / "graph.json"
graph.write_text('{"nodes":[{"id":"old"}],"links":[]}')
(out / ".graphify_semantic_marker").write_text("{}")
with redirect_stdout(StringIO()):
backup = backup_if_protected(out)
protected = backup / "graph.json"
protected.chmod(0o444)
try:
graph.write_text('{"nodes":[{"id":"new"}],"links":[]}')
stdout, stderr = StringIO(), StringIO()
with redirect_stdout(stdout), redirect_stderr(stderr):
result = backup_if_protected(out)
print("result_is_none:", result is None)
print("backup_matches_current_graph:", protected.read_bytes() == graph.read_bytes())
print("stdout:", stdout.getvalue().strip())
print("stderr:", stderr.getvalue().strip().replace(temporary, "<temporary-output>"))
finally:
protected.chmod(0o644)
PY
Error output or graph output
Observed on the tested base:
result_is_none: False
backup_matches_current_graph: False
stdout: [graphify] backed up semantic graph (1 files) -> 2026-09-22/
stderr:
Graphify version
0.9.66, v8 at a5957aa6ef51c9be8d054de9783d25046c187f3f.
Environment
macOS 26.6.2, Python 3.12.11, editable install.
Additional context
This is about copy-failure reporting and retrying incomplete same-day backups, not changing backup eligibility or retention.
What happened?
A failed
graph.jsonbackup copy can still printbacked up semantic graphand return the backup directory. In a local reproduction, a read-only same-day backup kept the old graph while a sidecar copied successfully. There was no warning that the returned backup was stale.I'd expect an incomplete backup to return
Noneand warn which file failed. The existing best-effort overwrite behavior can stay unchanged.Steps to reproduce
Run as a regular user on macOS or Linux; root may bypass the read-only permission:
Error output or graph output
Observed on the tested base:
Graphify version
0.9.66,
v8ata5957aa6ef51c9be8d054de9783d25046c187f3f.Environment
macOS 26.6.2, Python 3.12.11, editable install.
Additional context
This is about copy-failure reporting and retrying incomplete same-day backups, not changing backup eligibility or retention.