Order the assertions so each reds for its own reason, and tighten three captures
Sabotage-testing the review fixes found a third assertion that could only ever fire behind an earlier one. Re-adding the /repos/ link inline breaks the contiguous prose literal the sentence check pins, so the sentence check fired first and reported "the note does not say where commits live" -- true, useless, and pointing at the wrong file. The guard that explains the reachability cost now runs before it.
Three assertions in this branch turned out to be unreachable behind an earlier one, and none was visible by reading. The rule that falls out: in an assertion block the check that EXPLAINS THE CONSEQUENCE runs before the check that merely NOTICES THE CHANGE, because a broad "the text is not what I expected" swallows every specific check behind it and the swallowed one is always the one whose message would have helped.
Also: - grep -o | head -1 in a value capture can SIGPIPE its producer under pipefail once a feed exceeds a pipe buffer. sed -n 1p reads to EOF. - every origin capture asserts a SINGLE root commit. With more than one the value carries an embedded newline and grep -F then matches any line of the feed rather than the date. The implementation handles multiple roots; the assertion was the weaker half. - feed-origin is module state and the ingress can render twice in one process, so it is cleared per render rather than left for the next.
src/docket/render.sgl | 5 +++++
test/integration/test-render.sh | 23 ++++++++++++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)src/docket/render.sglmodified
;; state `project-feed?` exists to make impossible, reached by the ;; error path instead of the success path. `emit` writes immediately, ;; so the only place a refusal costs nothing is before the first one. ;; ;; Cleared first: this is module state, and the ingress renders more ;; than once per process. A render that writes no feeds must not leave ;; the previous record's date sitting here for the next one to find. (set! feed-origin "") (when project-feed? (let ((origin (record-origin record))) (when (string-empty? origin)test/integration/test-render.shmodified
exit 1; }# The reader is still told where the older commits ARE -- deleting the sentence# would leave the window hiding content with no pointer.grep -Fq '; each repository has its own feed of commits' "$dorm" || { echo 'FAIL: the note does not say where commits live' >&2; exit 1; }# "each repository" is deliberately NOT linked -- pointing it at /sigil/repos/# gives a one-repo project page a direct link to its repo list and makes# test-reachability's long-chain walk vacuous at exactly the shape it exists# defect it names. Measured on this fixture: the dormant project page contains# zero occurrences of href="/sigil/repos/" today, so this is not a claim about# anchor wording, it is a claim about the route existing at all.## FIRST, BEFORE THE SENTENCE CHECK BELOW, and that order is load-bearing.# Sabotage-tested with the link added inline: the sentence check fired instead,# because an anchor inside the prose breaks the contiguous literal it pins. So# the reachability consequence -- the thing a reader needs to be told -- was# reported as "the note does not say where commits live", which explains# nothing and invites fixing the wrong file. An assertion whose red is always# somebody else's red has never been proved by anything.if grep -Fq 'href="/sigil/repos/"' "$dorm"; then echo 'FAIL: the project page gained a direct /repos/ link; that voids the one-repo reachability walk' >&2 grep -o '.\{0,60\}href="/sigil/repos/"' "$dorm" >&2 exit 1; figrep -Fq '; each repository has its own feed of commits' "$dorm" || { echo 'FAIL: the note does not say where commits live' >&2; exit 1; }# ---- AN EMPTY PROJECT FEED IS WRITTEN, AND HONESTLY DATED -----------------#origin=$(git -C "$tmp/emptyrec" log --max-parents=0 --format=%aI)[[ -n $origin ]] || { echo 'FAIL: no record origin to compare against, so the date check is vacuous' >&2; exit 1; }# ONE root, or the grep below carries an embedded newline and -F then matches# any line of the feed rather than the date.[[ $(printf '%s' "$origin" | wc -l) -eq 0 ]] || { echo 'FAIL: emptyrec has more than one root commit; the date grep would match anything' >&2 exit 1; }grep -Fq "<updated>$origin</updated>" "$tmp/site-dormant/sigil/feed.xml" || { echo "FAIL: the empty feed is not dated from the record's creation ($origin)" >&2 grep -o '<updated>[^<]*</updated>' "$tmp/site-dormant/sigil/feed.xml" | head -1 >&2; exit 1; }# (site-feed/sigil/feed.xml's existence is already asserted further up, at the# Atom feeds block -- not repeated here, because an assertion that can only# fire after another has already fired has never been proved by anything.)feed_updated=$(grep -o '<updated>[^<]*</updated>' "$tmp/site-feed/sigil/feed.xml" | head -1)feed_updated=$(grep -o '<updated>[^<]*</updated>' "$tmp/site-feed/sigil/feed.xml" | sed -n 1p)feed_newest=$(grep -o '<updated>[^<]*</updated>' "$tmp/site-feed/sigil/feed.xml" | sed -n 2p)[[ -n $feed_newest ]] || { echo 'FAIL: the populated feed has no entries, so this comparison is vacuous' >&2; exit 1; }# equality above could hold while every feed on the site said the same thing.record_origin=$(git -C "$tmp/record" log --max-parents=0 --format=%aI)[[ -n $record_origin ]] || { echo 'FAIL: no record origin for the busy record' >&2; exit 1; }[[ $(printf '%s' "$record_origin" | wc -l) -eq 0 ]] || { echo 'FAIL: the busy record has more than one root commit' >&2; exit 1; }[[ $feed_updated != "<updated>$record_origin</updated>" ]] || { echo 'FAIL: a populated feed took the origin date instead of its newest entry' >&2; exit 1; }[[ -f "$tmp/site-blank/sigil/repos/blank/feed.xml" ]] || { echo 'FAIL: a repository with no commits got no feed' >&2; exit 1; }blank_origin=$(git -C "$tmp/emptyrec" log --max-parents=0 --format=%aI)[[ -n $blank_origin && $(printf '%s' "$blank_origin" | wc -l) -eq 0 ]] || { echo 'FAIL: no single root commit to date the commitless repo against' >&2; exit 1; }grep -Fq "<updated>$blank_origin</updated>" "$tmp/site-blank/sigil/repos/blank/feed.xml" || { echo "FAIL: a commitless repo's feed is not dated from the record's inception ($blank_origin)" >&2 grep -o '<updated>[^<]*</updated>' "$tmp/site-blank/sigil/repos/blank/feed.xml" >&2; exit 1; }