fix(orders): narrow the return-reason escape so a plain arrow survives
`sed 's/--*>/-->/g; s/-->/ /g'` rewrote `->` (ONE dash) into `-->` and then blanked it, so a reason written the way this repo writes prose - "premise -> dead" - silently lost its arrow. The intent was only to stop a literal `-->` from closing the trailer's HTML comment early. Replaced with a single expression matching two-or-more dashes, `s/---*>/ /g`. Same over-broad-escaping class as the `$`-pattern bug in pre-state-line-guard.mjs, and invisible for the same reason: the fixture reason had no arrow. Two checks added - a plain arrow must survive, a literal `-->` must still be neutralised - so the escape now has both a known-positive and a known-negative. orders 97 -> 99. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0134iB7ipXGgEpv9imYoVmr2
This commit is contained in:
parent
c519ab4994
commit
6b26b8e94b
4 changed files with 25 additions and 6 deletions
|
|
@ -225,7 +225,10 @@ oid7="$(printf '%s\n' "$("$SEND" --to ret-repo --from dispatcher --subject "stal
|
|||
"$CLAIM" --repo ret-repo "$oid7" >/dev/null 2>&1
|
||||
"$ODONE" --repo ret-repo "$oid7" --return >/dev/null 2>&1; [ $? -eq 2 ]
|
||||
check "--return without --reason is refused" $?
|
||||
"$ODONE" --repo ret-repo "$oid7" --return --reason "forutsetningen er dod" >/dev/null 2>&1; [ $? -eq 0 ]
|
||||
# The reason carries a plain arrow on purpose: this repo writes prose that way
|
||||
# ("premise -> dead"), and an escape aimed at '-->' that also eats '->' would
|
||||
# silently mangle the one field whose whole value is being readable.
|
||||
"$ODONE" --repo ret-repo "$oid7" --return --reason "forutsetningen er dod -> ikke kjorbar" >/dev/null 2>&1; [ $? -eq 0 ]
|
||||
check "--return with a reason exits 0" $?
|
||||
[ -f "$CLAUDE_COORD_DIR/ret-repo/orders/$oid7.md" ]; check "returned order is pending again" $?
|
||||
[ ! -e "$CLAUDE_COORD_DIR/ret-repo/orders/claimed/$oid7.md" ]; check "returned order left orders/claimed" $?
|
||||
|
|
@ -234,6 +237,15 @@ check "returned order records the return" $?
|
|||
r7="$("$READ" --repo ret-repo)"
|
||||
printf '%s' "$r7" | grep -q "forutsetningen er dod"
|
||||
check "the return reason reaches the next session's injection" $?
|
||||
printf '%s' "$r7" | grep -q "dod -> ikke kjorbar"
|
||||
check "a plain arrow in the reason survives the comment escaping" $?
|
||||
# The escaping still has to do its actual job.
|
||||
oid7b="$(printf '%s\n' "$("$SEND" --to ret2-repo --from dispatcher --subject "s" --message "m" 2>&1)" | sed -n 's/^order-id=//p')"
|
||||
"$CLAIM" --repo ret2-repo "$oid7b" >/dev/null 2>&1
|
||||
"$ODONE" --repo ret2-repo "$oid7b" --return --reason "closes here --> and then prose" >/dev/null 2>&1
|
||||
[ "$(grep -c '^<!-- order-returned:' "$CLAUDE_COORD_DIR/ret2-repo/orders/$oid7b.md" 2>/dev/null)" -eq 1 ] &&
|
||||
[ "$(tail -1 "$CLAUDE_COORD_DIR/ret2-repo/orders/$oid7b.md" | grep -c 'and then prose -->')" -eq 1 ]
|
||||
check "a literal --> in the reason cannot close the trailer early" $?
|
||||
"$CLAIM" --repo ret-repo "$oid7" >/dev/null 2>&1; [ $? -eq 0 ]
|
||||
check "a returned order can be claimed again" $?
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue