Say could not read when the trust file is not an object whose projects maps paths to objects #66
@@ -7,6 +7,7 @@ Decisions live in `docs/decisions.md`:
|
|||||||
- loop-claude: one session per project, at a fixed id
|
- loop-claude: one session per project, at a fixed id
|
||||||
- loop-claude: the trust file is rewritten before an interrupt
|
- loop-claude: the trust file is rewritten before an interrupt
|
||||||
- loop-claude: a reload into an older file is unsupported
|
- loop-claude: a reload into an older file is unsupported
|
||||||
|
- loop-claude: a wrong-shape trust file gets one message, naming the shape
|
||||||
- bin/: host python, no container
|
- bin/: host python, no container
|
||||||
- comprehension floor: the 2026-09-25 four-seat score is the ratchet, and 0.1.0 waits on what caps it
|
- comprehension floor: the 2026-09-25 four-seat score is the ratchet, and 0.1.0 waits on what caps it
|
||||||
- larv-review: a re-entered loop takes a fresh round cap
|
- larv-review: a re-entered loop takes a fresh round cap
|
||||||
|
|||||||
+4
-1
@@ -415,7 +415,10 @@ def trust(paths):
|
|||||||
except (OSError, ValueError) as failure:
|
except (OSError, ValueError) as failure:
|
||||||
print(f"could not read {config}: {getattr(failure, 'strerror', failure)}", file=sys.stderr)
|
print(f"could not read {config}: {getattr(failure, 'strerror', failure)}", file=sys.stderr)
|
||||||
return
|
return
|
||||||
projects = data.setdefault("projects", {})
|
projects = data.setdefault("projects", {}) if isinstance(data, dict) else None
|
||||||
|
if not isinstance(projects, dict) or not all(isinstance(record, dict) for record in projects.values()):
|
||||||
|
print(f"could not read {config}: not an object whose \"projects\" maps paths to objects", file=sys.stderr)
|
||||||
|
return
|
||||||
granted = [path for path in paths if not projects.get(path, {}).get("hasTrustDialogAccepted")]
|
granted = [path for path in paths if not projects.get(path, {}).get("hasTrustDialogAccepted")]
|
||||||
if not granted:
|
if not granted:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -223,6 +223,12 @@ class Trust(unittest.TestCase):
|
|||||||
with contextlib.redirect_stderr(io.StringIO()) as err:
|
with contextlib.redirect_stderr(io.StringIO()) as err:
|
||||||
loop.trust(["/a"])
|
loop.trust(["/a"])
|
||||||
self.assertIn(f"could not read {config}: ", err.getvalue())
|
self.assertIn(f"could not read {config}: ", err.getvalue())
|
||||||
|
for shape in ([], {"projects": []}, {"projects": {"/a": 1}}):
|
||||||
|
config.write_text(json.dumps(shape))
|
||||||
|
with contextlib.redirect_stderr(io.StringIO()) as err:
|
||||||
|
loop.trust(["/a"])
|
||||||
|
self.assertEqual(err.getvalue(), f"could not read {config}: not an object whose \"projects\" maps paths to objects\n")
|
||||||
|
self.assertEqual(json.loads(config.read_text()), shape)
|
||||||
data = {"other": 1, "projects": {"/a": {"hasTrustDialogAccepted": True, "kept": 2}}}
|
data = {"other": 1, "projects": {"/a": {"hasTrustDialogAccepted": True, "kept": 2}}}
|
||||||
config.write_text(json.dumps(data))
|
config.write_text(json.dumps(data))
|
||||||
with contextlib.redirect_stderr(io.StringIO()) as err:
|
with contextlib.redirect_stderr(io.StringIO()) as err:
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
2026-09-21, lilleman; the lost-write risk accepted 2026-09-24 by larv-review. Serves goal 4. A write by another claude inside `trust`'s read-modify-write window is lost. Valid while no flag skips the dialog.
|
2026-09-21, lilleman; the lost-write risk accepted 2026-09-24 by larv-review. Serves goal 4. A write by another claude inside `trust`'s read-modify-write window is lost. Valid while no flag skips the dialog.
|
||||||
|
|
||||||
|
## loop-claude: a wrong-shape trust file gets one message, naming the shape
|
||||||
|
|
||||||
|
2026-09-26, larv-review, declining a product-owner nit. Serves goal 4 through the comprehension floor below. `trust` says `not an object whose "projects" maps paths to objects` for every wrong shape; naming the failing path would add a branch to `trust`, the unit three of four seats least want to modify, and the interrupt still lands in Claude Code's own dialog. Valid while `trust` caps the floor.
|
||||||
|
|
||||||
## bin/: host python, no container
|
## bin/: host python, no container
|
||||||
|
|
||||||
2026-09-24, larv-review. Serves goals 1 and 4. The tools drive the host's claude CLI and read the host's session files, which a container cannot see; the tests run the same way. Valid while claude runs on the host.
|
2026-09-24, larv-review. Serves goals 1 and 4. The tools drive the host's claude CLI and read the host's session files, which a container cannot see; the tests run the same way. Valid while claude runs on the host.
|
||||||
|
|||||||
@@ -4,5 +4,4 @@
|
|||||||
|
|
||||||
Ordered by how many seats of the 2026-09-25 scoring panel (`docs/decisions.md`) named the place; each is one chunk.
|
Ordered by how many seats of the 2026-09-25 scoring panel (`docs/decisions.md`) named the place; each is one chunk.
|
||||||
|
|
||||||
- Say `could not read` when `~/.claude.json` parses to anything but an object whose `projects` maps paths to objects, today a traceback before the interrupt.
|
|
||||||
- State in `docs/decisions.md` the oldest Python `bin/` must parse on, today unstated and 3.11 by the last review.
|
- State in `docs/decisions.md` the oldest Python `bin/` must parse on, today unstated and 3.11 by the last review.
|
||||||
|
|||||||
Reference in New Issue
Block a user