fix(update): adopting a checkout git cannot identify writes the birth certificate again

write_source_stamp now returns None for a tree git cannot identify, instead
of raising. Blessed-checkout adoption still caught RuntimeError for its
minimal-stamp fallback, so it wrote nothing, reported the root as adopted,
and a read-only tree no longer reported itself unwritable. Branch on the
None the function returns now.
This commit is contained in:
ethernet
2026-09-23 17:51:29 -04:00
parent 13ebc163a1
commit 5d101c734c

View File

@@ -206,18 +206,18 @@ def step_adopt_blessed_checkout(project_root: Path | None = None) -> dict:
if not is_blessed:
return {"ok": True, "skipped": "not-a-blessed-root"}
try:
from hermes_cli.source_stamp import write_source_stamp
from hermes_cli.source_stamp import write_source_stamp
try:
# Full checkout identity when git can answer; the birth-certificate
# minimum below only when it cannot (or the tree is read-only).
write_source_stamp(root)
identified = write_source_stamp(root)
except OSError as exc:
# A read-only tree (nix-like layouts without their own stamp)
# must not crash the boot — it just stays unadopted.
logger.debug("blessed-checkout adoption skipped (unwritable): %s", exc)
return {"ok": True, "skipped": f"unwritable: {exc}"}
except RuntimeError:
if identified is None:
# No derivable git identity: write the minimal birth certificate.
stamp = {
"schemaVersion": 2,