fix(6855): the fence keeps its files where no compaction sweeps them, and builds id lists under mawk
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 1m52s
CI & Build / integration (push) Successful in 2m21s
CI & Build / Build & push image (push) Successful in 22s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 1m52s
CI & Build / integration (push) Successful in 2m21s
CI & Build / Build & push image (push) Successful in 22s
The project a session entered now lives in grimoire-fence, which the compaction clear never visits, and session end removes it. Arrays of ids in a tool's input were sent as [,"3","4"] under mawk, which creates an array element as soon as it is assigned to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -190,3 +190,25 @@ def test_an_unanswered_check_lets_the_act_through_and_says_so_once(tmp_path):
|
||||
ctx = json.loads(first)["hookSpecificOutput"]["additionalContext"]
|
||||
assert ctx.startswith("> Grimoire did not answer the project fence check")
|
||||
assert _run(tmp_path, 1, _edit(other / "b.py", home), home) == ""
|
||||
|
||||
|
||||
def test_the_entered_project_outlives_a_compaction_and_ends_with_the_session(tmp_path):
|
||||
# A compaction loses the context, not the session: the project it entered
|
||||
# stays its project. Session end clears it.
|
||||
loose = tmp_path / "loose"
|
||||
loose.mkdir()
|
||||
_run(tmp_path, 1, {"hook_event_name": "PostToolUse", "cwd": str(loose),
|
||||
"tool_name": "mcp__plugin_grimoire_grimoire__enter_project",
|
||||
"tool_input": {"project_id": 7}}, loose)
|
||||
entered = tmp_path / "tmp" / "grimoire-fence" / "s-fence.entered"
|
||||
assert entered.read_text() == "7"
|
||||
|
||||
env = {"PATH": os.environ["PATH"], "TMPDIR": str(tmp_path / "tmp"), "HOME": str(tmp_path)}
|
||||
hooks = HOOK.parent
|
||||
for hook, event in (("grimoire_session_context.sh", {"source": "compact"}),
|
||||
("grimoire_session_end.sh", {"reason": "other"})):
|
||||
subprocess.run(["bash", str(hooks / hook)], input=json.dumps({"session_id": "s-fence", **event}),
|
||||
capture_output=True, text=True, env=env, timeout=60, check=True)
|
||||
if hook == "grimoire_session_context.sh":
|
||||
assert entered.exists(), "a compaction cleared the project the session entered"
|
||||
assert not entered.exists()
|
||||
|
||||
Reference in New Issue
Block a user