gunk-dev/the-valley

review-notes.sh

source795c933f9c5emain's published tip history
20.7 KiB
1# shellcheck shell=bash
2# Paths and fixtures come from the derivation environment.
3# shellcheck disable=SC2154
4export HOME="$TMPDIR" XDG_STATE_HOME="$TMPDIR/state" TERM=xterm
5export GIT_CONFIG_NOSYSTEM=1
6unset VISUAL || true
7git config --global user.name valley-check
8git config --global user.email valley-check@localhost
9git config --global init.defaultBranch main
10
11# A project with an origin and one branch to review: two
12# files, changed twice and once, far enough apart that the
13# diff has two hunks in the first file and one in the second.
14git init --quiet --bare "$TMPDIR/origin.git"
15git init --quiet "$TMPDIR/work"
16cd "$TMPDIR/work" || exit 1
17git remote add origin "$TMPDIR/origin.git"
18seq 1 20 | sed 's/^/alpha /' > alpha.md
19seq 1 10 | sed 's/^/beta /' > beta.md
20git add -A
21git commit --quiet -m seed
22git push --quiet -u origin main
23git checkout --quiet -b scratch
24sed -i -e '3s/.*/alpha 3 changed/' -e '15s/.*/alpha 15 changed/' alpha.md
25sed -i -e '5s/.*/beta 5 changed/' beta.md
26git commit --quiet -am "touch both files"
27git push --quiet origin scratch
28git checkout --quiet main
29git fetch --quiet origin
30
31# A pager filter that restructures the diff, as delta's
32# rendering does: if v were handed what less displays, every
33# anchor below would be wrong.
34git config --global pager.diff "sed -e 's/^/| /'"
35export EDITOR="$reviewer"
36mkdir -p "$XDG_STATE_HOME"
37
38# wait_for <log> <pattern>: wait until <log> shows <pattern>, and fail
39# after a minute. A review reads every key from the one terminal, so a
40# verdict typed before the prompt that takes it would go to whatever held
41# the terminal then, such as less. Each log waited on here is written by
42# one review only, so no earlier review's output can match.
43wait_for() {
44 local i=0
45 until grep -q -- "$2" "$1" 2> /dev/null; do
46 if [ "$i" -ge 600 ]; then
47 printf 'review-notes: %s never showed %s\n' "$1" "$2" >&2
48 return 1
49 fi
50 sleep 0.1
51 i=$((i + 1))
52 done
53}
54
55# answer_after <log> <prompt> <command> <answers>: wait until the review
56# writing to <log> has asked <prompt>, run <command>, then answer. A page
57# is shown before its prompt, so the command runs after the page is shown
58# and before the answer.
59answer_after() {
60 wait_for "$1" "$2"
61 eval "$3"
62 printf '%b' "$4"
63}
64
65# v alone opens the editor, and the pager shows the notes,
66# rendered, once it returns; q then leaves the pager, and s is
67# the verdict. The verdict waits for its prompt, and the keys
68# stay open until the notes are printed. A wait that fails
69# still sends q, so the check fails rather than hang in less.
70# shellcheck disable=SC2094 # the answers wait on the review's own output
71{
72 printf v
73 if ! wait_for "$XDG_STATE_HOME/editor.log" 'editor got: ' \
74 || ! wait_for session.log '| a note above every file'; then
75 printf q
76 exit 1
77 fi
78 printf q
79 answer_after session.log '\]kip: ' : 's\n'
80 wait_for session.log '5 note(s) on scratch'
81} | script -qec "valley review scratch" /dev/null > session.log 2>&1
82sed -e 's/\x1b\[[0-9;?]*[a-zA-Z]//g' -e 's/\r//g' session.log > plain.log
83
84# The anchors, exactly: above every file, on a file header
85# above the first hunk, mid-hunk, in a second hunk whose
86# numbering starts elsewhere, and in a second file.
87diff -u - "$XDG_STATE_HOME/valley/notes/scratch.md" <<EOF
88## scratch at $(git rev-parse --short origin/scratch)
89
90(unanchored): a note above every file
91alpha.md: alpha reads like two files
92alpha.md:3: why is 3 changed at all?
93alpha.md:13: and this hunk is fine
94beta.md:5: beta wants the same treatment
95
96EOF
97
98# The editor was given the buffer valley wrote, not the
99# rendering less displayed, and given a line to open at.
100grep -qE 'editor got: \+[0-9]+ .*/review\.diff$' \
101 "$XDG_STATE_HOME/editor.log"
102# The filter did run: what the pager showed was its output.
103# less showed no warning before editing the file it paged.
104grep -q '^| @@ ' plain.log
105if grep -q 'WARNING' plain.log; then exit 1; fi
106
107# q alone leaves the pager, and the editor never runs.
108rm "$XDG_STATE_HOME/editor.log"
109# shellcheck disable=SC2094 # the answers wait on the review's own output
110{
111 printf q
112 answer_after quit.log '\]kip: ' : 's\n'
113 wait_for quit.log 'skipped scratch; nothing done'
114} | script -qec "valley review scratch" /dev/null > quit.log 2>&1
115[ ! -e "$XDG_STATE_HOME/editor.log" ]
116if grep -q 'note(s) on scratch' quit.log; then exit 1; fi
117# The line the reviewer edited instead of inserting is gone,
118# and said so.
119grep -q 'changed or deleted diff line(s) ignored' plain.log
120if grep -q 'alpha SEVENTEEN' "$XDG_STATE_HOME/valley/notes/scratch.md"; then exit 1; fi
121
122# The verdict is unchanged, and the notes come after it.
123grep -q 'skipped scratch; nothing done' plain.log
124verdict="$(grep -n 'skipped scratch' plain.log | cut -d: -f1)"
125notes="$(grep -n '5 note(s) on scratch' plain.log | cut -d: -f1)"
126[ "$verdict" -lt "$notes" ]
127
128# Piped, review is what it always was: the diff on stdout,
129# the verdict from stdin, and no notes to take.
130printf 's\n' | valley review scratch > piped.log
131grep -q '^diff --git a/alpha.md b/alpha.md$' piped.log
132grep -q 'skipped scratch; nothing done' piped.log
133if grep -q 'note(s) on scratch' piped.log; then exit 1; fi
134
135# The pending list of branches titles each by the subject of its first
136# own commit, on the line under its name, and cuts a long one short with …
137# to fit 80 columns when stdout is no terminal. Nothing it prints there is
138# an escape code.
139valley pending --branches > pending.log
140grep -A1 '^scratch ' pending.log | grep -q '^ touch both files$'
141git checkout --quiet -b longsubject origin/main
142git commit --quiet --allow-empty -m "$(printf 'x%.0s' $(seq 1 80))"
143git push --quiet origin longsubject
144git checkout --quiet main
145valley pending --branches > pending.log
146grep -A1 '^longsubject ' pending.log | grep -qE '^ x{77}…$'
147if grep -q $'\x1b' pending.log; then exit 1; fi
148
149# On a terminal, pending fits the terminal's width and sets each name in
150# bold. With NO_COLOR set, it prints no escape code.
151script -qec "stty cols 100; valley pending --branches" /dev/null < /dev/null > tty.log 2>&1
152grep -q $'^\x1b\\[1mlongsubject\x1b\\[0m ' tty.log
153grep -qE $'^ x{80}\r?$' tty.log
154NO_COLOR=1 script -qec "stty cols 100; valley pending --branches" /dev/null < /dev/null > tty.log 2>&1
155grep -q '^longsubject ' tty.log
156if grep -q $'\x1b' tty.log; then exit 1; fi
157
158# ----------------------------------------------------------------------
159# A stack: a branch, then two changes with records, each on the one
160# below, in a project whose floor requires nothing, so approving files a
161# request with no evidence. Its origin logs every push it receives, which
162# is how "publishes nothing" is read.
163stack="$TMPDIR/stack.git"
164pushlog="$TMPDIR/pushlog"
165git init --quiet --bare "$stack"
166cat > "$stack/hooks/pre-receive" << EOF
167#!/bin/sh
168echo '--- push' >> $pushlog
169cat >> $pushlog
170EOF
171chmod +x "$stack/hooks/pre-receive"
172git init --quiet "$TMPDIR/stackwork"
173cd "$TMPDIR/stackwork" || exit 1
174git remote add origin "$stack"
175git config valley.principal operator
176mkdir -p policy/instance
177cat > policy/instance/floor.cue << 'EOF'
178package verification
179
180floor: {
181 classes: everything: {
182 paths: "**": true
183 requires: {}
184 }
185 unclassified: {}
186}
187EOF
188git add -A
189git commit --quiet -m seed
190git push --quiet -u origin main
191from=main
192for layer in one two three; do
193 git checkout --quiet -b "$layer" "$from"
194 echo "layer $layer" > "$layer.md"
195 git add -A
196 git commit --quiet -m "layer $layer"
197 git push --quiet origin "$layer"
198 from="$layer"
199done
200two="$(git rev-parse two)" three="$(git rev-parse three)"
201q=qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq p=pppppppppppppppppppppppppppppppp
202valley ready --change "$q" two > /dev/null
203valley ready --change "$p" three > /dev/null
204git checkout --quiet main
205requests="refs/the-valley/integration-requests/main"
206
207# s at the first layer, on a terminal, with a note written in its diff:
208# the note is kept under the first layer's branch and printed at the end,
209# and nothing is published.
210cat > "$TMPDIR/stack-editor" << 'EOF'
211#!/bin/sh
212f="$1"
213case "$1" in +*) f="$2" ;; esac
214sed -i '/^+layer one$/a one wants a second line' "$f"
215EOF
216chmod +x "$TMPDIR/stack-editor"
217: > "$pushlog"
218# shellcheck disable=SC2094 # the answers wait on the review's own output
219{
220 printf vq
221 answer_after stack-tty.log 'one, 1 of 3: \[n\]ext layer, .*\[s\]top? ' : 's\n'
222 wait_for stack-tty.log '1 note(s) on one'
223} | EDITOR="$TMPDIR/stack-editor" script -qec "valley review pppp" /dev/null > stack-tty.log 2>&1
224sed -e 's/\x1b\[[0-9;?]*[a-zA-Z]//g' -e 's/\r//g' stack-tty.log > stack-plain.log
225grep -q 'pppp is a stack of 3 changes; reviewing from the bottom, each against the one below it:$' stack-plain.log
226grep -qxF 'read each layer and go on with [n]; approving pppp at the top lands all 3. [a] on a lower layer lands it and the layers under it, and ends the review.' stack-plain.log
227grep -q '| change 1 of 3: one on main$' stack-plain.log
228grep -qF 'one, 1 of 3: [n]ext layer, [a]pprove one alone, [v]iew full diff, [s]top? ' stack-plain.log
229grep -q 'stopped reviewing pppp at change 1 of 3, one; nothing done' stack-plain.log
230if grep -q 'change 2 of 3' stack-plain.log; then exit 1; fi
231grep -qx 'one.md:1: one wants a second line' "$XDG_STATE_HOME/valley/notes/one.md"
232grep -q '1 note(s) on one, appended to .*/valley/notes/one.md:' stack-plain.log
233grep -q '^ one.md:1: one wants a second line$' stack-plain.log
234[ ! -e "$XDG_STATE_HOME/valley/notes/two.md" ]
235[ ! -s "$pushlog" ]
236
237# n, n, a: the layers are paged bottom up, each diff holds only its own
238# layer's file, and the top's request is filed at the top's head. Each
239# prompt names its layer and place, and what approving there lands.
240: > "$pushlog"
241printf 'n\nn\na\n' | valley review pppp > stack.out 2> stack.err
242grep -q '^ 1\. one (branch): layer one$' stack.out
243grep -q '^ 2\. qqqq (ready): layer two$' stack.out
244grep -q '^ 3\. pppp (ready): layer three$' stack.out
245grep -qxF 'read each layer and go on with [n]; approving pppp at the top lands all 3. [a] on a lower layer lands it and the layers under it, and ends the review.' stack.out
246grep -qF 'one, 1 of 3: [n]ext layer, [a]pprove one alone, [v]iew full diff, [s]top? ' stack.out
247grep -qF 'qqqq, 2 of 3: [n]ext layer, [a]pprove one and qqqq, [v]iew full diff, [s]top? ' stack.out
248grep -qF '[a]pprove all 3 [v]iew diff [r]eject pppp [s]top: ' stack.out
249# Piped, each page's first line follows the prompt before it.
250[ "$(grep -o 'change [0-9] of 3: [a-z]* on [a-z]*$' stack.out)" = "$(printf '%s\n' \
251 'change 1 of 3: one on main' 'change 2 of 3: qqqq on one' 'change 3 of 3: pppp on qqqq')" ]
252for n in 1 2 3; do
253 awk -v n="$n" '/change [0-9] of 3: /{ on = index($0, "change " n " of 3: ") > 0 } on' stack.out > "page$n"
254done
255[ "$(grep '^diff --git' page1)" = 'diff --git a/one.md b/one.md' ]
256[ "$(grep '^diff --git' page2)" = 'diff --git a/two.md b/two.md' ]
257[ "$(grep '^diff --git' page3)" = 'diff --git a/three.md b/three.md' ]
258[ "$(git -C "$stack" rev-parse "$requests/c-$p")" = "$three" ]
259if git -C "$stack" rev-parse --verify --quiet "$requests/c-$q" > /dev/null; then exit 1; fi
260git -C "$stack" update-ref -d "$requests/c-$p"
261
262# a at the second layer files the second layer's request at its head, and
263# nothing for the top, whose review never starts: neither its page nor its
264# prompt is shown.
265: > "$pushlog"
266printf 'n\na\n' | valley review pppp > stack-two.out 2> stack-two.err
267grep -qF 'qqqq, 2 of 3: [n]ext layer, [a]pprove one and qqqq, [v]iew full diff, [s]top? ' stack-two.out
268[ "$(git -C "$stack" rev-parse "$requests/c-$q")" = "$two" ]
269if git -C "$stack" rev-parse --verify --quiet "$requests/c-$p" > /dev/null; then exit 1; fi
270grep -q "c-$q" "$pushlog"
271if grep -q "c-$p" "$pushlog"; then exit 1; fi
272if grep -q 'change 3 of 3' stack-two.out; then exit 1; fi
273if grep -q '3 of 3: ' stack-two.out; then exit 1; fi
274
275# A draft in the middle is named in the warning before anything is paged.
276# It is readied again after, since review offers no [a]pprove at or above
277# a draft, and the stacks below approve above it.
278valley unready qqqq > /dev/null 2>&1
279printf 's\n' | valley review pppp > stack-draft.out 2>&1
280grep -q '^warning: qqqq, change 2 of 3, is a draft\. The integrator refuses to land it or anything above it (refused-not-ready)\.$' stack-draft.out
281valley ready --change "$q" two > /dev/null
282
283# A change with no stack under it pages and prompts as it always has.
284printf 's\n' | valley review one > stack-one.out 2>&1
285grep -q '^branch one, log against origin/main:$' stack-one.out
286grep -q '^\[a\]pprove \[v\]iew diff \[r\]eject \[s\]kip: skipped one; nothing done$' stack-one.out
287if grep -q 'stack of\|change 1 of' stack-one.out; then exit 1; fi
288
289seed="$(git rev-parse main)" onehead="$(git rev-parse one)"
290
291# [a]pprove at the bottom, on a plain branch under the top, files that
292# branch's head under its own request name, and nothing for the top.
293: > "$pushlog"
294printf 'a\n' | valley review pppp > stack-a-one.out 2>&1
295[ "$(git -C "$stack" rev-parse "$requests/one")" = "$onehead" ]
296grep -q "$requests/one" "$pushlog"
297if grep -q "c-$p" "$pushlog"; then exit 1; fi
298
299# Once a page is shown, the head approved is the head shown. When the
300# branch moves on origin, and is fetched, after the page is shown and
301# before the answer, approving refuses, names both heads, and publishes
302# nothing: for a plain branch under the top, for a plain branch at the top
303# of a stack, and for a plain branch alone. The request each would file is
304# absent first, so a filing would push.
305git -C "$stack" update-ref -d "$requests/one"
306: > "$pushlog"
307# shellcheck disable=SC2094 # the answers wait on the review's own output
308answer_after moved-one.out 'one, 1 of 3: \[n\]ext' "git -C '$stack' update-ref refs/heads/one $seed; git fetch -q origin" 'a\ns\n' \
309 | valley review pppp > moved-one.out 2>&1
310grep -q "not approved · origin/one moved from ${onehead:0:7}[0-9a-f]*, the head shown, to ${seed:0:7}" moved-one.out
311[ ! -s "$pushlog" ]
312if git -C "$stack" rev-parse --verify --quiet "$requests/one" > /dev/null; then exit 1; fi
313git -C "$stack" update-ref refs/heads/one "$onehead"
314git fetch -q origin
315
316git checkout --quiet -b four three
317echo "layer four" > four.md
318git add four.md
319git commit --quiet -m "layer four"
320git push --quiet origin four
321fourhead="$(git rev-parse four)"
322git checkout --quiet -b solo main
323echo "solo" > solo.md
324git add solo.md
325git commit --quiet -m "solo"
326git push --quiet origin solo
327solohead="$(git rev-parse solo)"
328git checkout --quiet main
329
330: > "$pushlog"
331# shellcheck disable=SC2094 # the answers wait on the review's own output
332{
333 printf 'n\nn\nn\n'
334 answer_after moved-four.out '\[a\]pprove all 4 \[v\]iew diff \[r\]eject four \[s\]top:' "git -C '$stack' update-ref refs/heads/four $seed; git fetch -q origin" 'a\ns\n'
335} | valley review four > moved-four.out 2>&1
336grep -q '^four is a stack of 4 changes' moved-four.out
337# From the third layer up, a lower layer's prompt counts what approving
338# there lands. The top's prompt names the top, and says approving it
339# lands all 4.
340grep -qF 'pppp, 3 of 4: [n]ext layer, [a]pprove the 3 up to pppp, [v]iew full diff, [s]top? ' moved-four.out
341grep -qF '[a]pprove all 4 [v]iew diff [r]eject four [s]top: ' moved-four.out
342grep -q "not approved · origin/four moved from ${fourhead:0:7}[0-9a-f]*, the head shown, to ${seed:0:7}" moved-four.out
343grep -q 'stopped reviewing four at change 4 of 4; nothing done' moved-four.out
344[ ! -s "$pushlog" ]
345if git -C "$stack" rev-parse --verify --quiet "$requests/four" > /dev/null; then exit 1; fi
346
347: > "$pushlog"
348# shellcheck disable=SC2094 # the answers wait on the review's own output
349answer_after moved-solo.out '^\[a\]pprove \[v\]iew diff' "git -C '$stack' update-ref refs/heads/solo $seed; git fetch -q origin" 'a\ns\n' \
350 | valley review solo > moved-solo.out 2>&1
351grep -q '^branch solo, log against origin/main:$' moved-solo.out
352grep -q "not approved · origin/solo moved from ${solohead:0:7}[0-9a-f]*, the head shown, to ${seed:0:7}" moved-solo.out
353[ ! -s "$pushlog" ]
354if git -C "$stack" rev-parse --verify --quiet "$requests/solo" > /dev/null; then exit 1; fi
355
356# ----------------------------------------------------------------------
357# A stack whose bottom does not fast-forward from main. The top gains a
358# second version, and main moves on under the stack.
359git checkout --quiet three
360echo "layer three, again" >> three.md
361git commit --quiet -am "layer three again"
362git push --quiet origin three
363threeagain="$(git rev-parse three)"
364valley ready --change "$p" three > /dev/null
365git checkout --quiet main
366echo "main moves on" > moved.md
367git add moved.md
368git commit --quiet -m "main moves on"
369git push --quiet origin main
370
371# Approving the top is refused before any check runs, at its active head
372# and at an earlier version's head, and the refusal names the rebase that
373# fixes it. Nothing is published.
374: > "$pushlog"
375for head in "$threeagain" "$three"; do
376 if valley approve --head "$head" pppp > stale-approve.out 2>&1; then exit 1; fi
377 grep -qF 'not approved · stack is behind main (includes qqqq)' stale-approve.out
378 grep -qx ' run: valley rebase pppp' stale-approve.out
379 if grep -q 'requires no check' stale-approve.out; then exit 1; fi
380done
381[ ! -s "$pushlog" ]
382# The bottom layer has no change under it, so it is approved as it is.
383valley approve one > stale-bottom.out 2>&1
384grep -qx '✓ one approved · no checks required · landing on main' stale-bottom.out
385[ "$(git -C "$stack" rev-parse "$requests/one")" = "$onehead" ]
386git -C "$stack" update-ref -d "$requests/one"
387
388# review asks, before any layer is paged, whether to rebase the stack.
389# [s]top ends it there, and nothing is done.
390: > "$pushlog"
391printf 's\n' | valley review pppp > stale-stop.out 2>&1
392grep -qxF 'pppp · stack of 3 · behind main' stale-stop.out
393grep -qF '[b]ase onto main [v]iew diff [s]kip: stopped reviewing pppp before its first layer; nothing done' stale-stop.out
394if grep -q 'change 1 of 3' stale-stop.out; then exit 1; fi
395[ ! -s "$pushlog" ]
396
397# [b]ase rebases the whole stack. The review then lists the stack again
398# and pages the rebased layers, and [a]pprove at the top files the
399# request at the top's rebased head.
400printf 'b\nn\nn\na\n' | valley review pppp > stale-review.out 2>&1
401grep -qF '[b]ase onto main [v]iew diff [s]kip: ' stale-review.out
402grep -qF 'the stack under pppp, bottom first:' stale-review.out
403git fetch --quiet origin
404newone="$(git rev-parse origin/one)" newthree="$(git rev-parse origin/three)"
405[ "$newone" != "$onehead" ]
406git merge-base --is-ancestor origin/main "$newone"
407awk '/change 1 of 3: /{ on = 1 } /change 2 of 3: /{ on = 0 } on' stale-review.out > stale-page1
408grep -q "^$(git rev-parse --short "$newone") layer one$" stale-page1
409if grep -q "$(git rev-parse --short "$onehead")" stale-page1; then exit 1; fi
410grep -qF '[a]pprove all 3 [v]iew diff [r]eject pppp [s]top: ' stale-review.out
411[ "$(git -C "$stack" rev-parse "$requests/c-$p")" = "$newthree" ]
412# qqqq's v1 was approved earlier, and the rebase gave it v2 with the same
413# file delta, so its layer is printed as a clean restack of v1, and not
414# paged. pppp has no approved version, so its layer is paged in full.
415grep -qx "qqqq v2 at [0-9a-f]*: clean restack of approved v1 at $(git rev-parse --short "$two")\." stale-review.out
416awk '/change 2 of 3: /{ on = 1 } /change 3 of 3: /{ on = 0 } on' stale-review.out > stale-page2
417if grep -q '^diff --git' stale-page2; then exit 1; fi
418awk '/change 3 of 3: /{ on = 1 } on' stale-review.out > stale-page3
419[ "$(grep '^diff --git' stale-page3)" = 'diff --git a/three.md b/three.md' ]
420
421# ----------------------------------------------------------------------
422# A note taken on a changed comparison. v1 of a change is approved, and
423# v2 edits line 9 of its file, so review pages v2 as changed since v1.
424# range-diff's hunks carry no line numbers, so the page ends with v2's
425# own diff of the file, and the note written beside the edited line there
426# keeps its file and line.
427git checkout --quiet -b edited main
428seq 1 12 | sed 's/^/line /' > lines.md
429git add lines.md
430git commit --quiet -m "add the lines"
431git push --quiet origin edited
432m=mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
433valley ready --change "$m" edited > /dev/null
434git -C "$stack" update-ref "$requests/c-$m" "$(git rev-parse edited)"
435sed -i 's/^line 9$/line 9 edited/' lines.md
436git commit --quiet -am "edit line 9"
437git push --quiet origin edited
438valley ready --change "$m" edited > /dev/null
439git checkout --quiet main
440cat > "$TMPDIR/changed-editor" << 'EOF'
441#!/bin/sh
442f="$1"
443case "$1" in +*) f="$2" ;; esac
444sed -i '/^+line 9 edited$/a why edit line 9?' "$f"
445EOF
446chmod +x "$TMPDIR/changed-editor"
447# shellcheck disable=SC2094 # the answers wait on the review's own output
448{
449 printf vq
450 answer_after changed-tty.log '\]kip: ' : 's\n'
451 wait_for changed-tty.log '1 note(s) on edited'
452} | EDITOR="$TMPDIR/changed-editor" script -qec "valley review mmmm" /dev/null > changed-tty.log 2>&1
453sed -e 's/\x1b\[[0-9;?]*[a-zA-Z]//g' -e 's/\r//g' changed-tty.log > changed-plain.log
454grep -q "| mmmm v2 at [0-9a-f]*: changed since approved v1 at " changed-plain.log
455grep -qx 'lines.md:9: why edit line 9?' "$XDG_STATE_HOME/valley/notes/edited.md"
456grep -q '^ lines.md:9: why edit line 9?$' changed-plain.log
457
458touch "$out"