Skip to content

cairn get: lead redirected output with a NOTE line - #133

Merged
quad341 merged 5 commits into
mainfrom
deploy/crn-6b1g8-gate
Aug 20, 2026
Merged

quad341 merged 5 commits into
mainfrom
deploy/crn-6b1g8-gate

Conversation

@quad341

@quad341 quad341 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

What

cairn get on a corrected/redirected entry now leads its plain-text output
with a NOTE: line naming both the originally-requested id and the id
actually serving the content, before the id: title line:

NOTE: orig redirected to fix
fix: Corrected fact
...

Previously the redirect was only surfaced via a separate redirected_from:
line printed after the id:title line — easy to miss when scanning output.

An uncorrected entry is unaffected: no NOTE: line, straight to id: title
as before. The --json output (redirectedFrom field) is unchanged.

Why

When a lookup silently substitutes a different entry's content, that should
be the first thing a reader sees, not a trailing annotation.

Testing

  • go test ./... -race -count=1: full suite green.
  • Manual smoke test: redirected and non-redirected lookups both produce the
    expected line order.

cairn-reviewer-scratch added 5 commits August 20, 2026 07:55
golangci-lint flags return nil, nil as ambiguous; the codebase already
has a precedented idiom for this exact "no match" contract (recurrenceMatch
in cmd/remember.go), so apply the same nolint:nilnil annotation rather than
inventing a sentinel error.

crn-evw98.3
Review round 1 (crn-0mdsv) flagged spec criterion 5 as unmet: getCmd's
plain-text output printed the corrector's "id: title" line first, then
a separate "redirected_from: <id>" line second -- never leading, never
combining both ids on one line, no NOTE phrasing.

Reorder/reword the two Printf calls so the NOTE line (when a redirect
occurred) prints before the id:title line and names both the
originally-requested id and the serving id in one line:
  NOTE: <original-id> redirected to <corrector-id>

Update the two plain-text redirect tests to pin the new contract:
TestGetRedirectsToCorrectionWhenOriginalIsRequested now asserts the
leading line is exactly the NOTE line (order-sensitive, previously
only an order-insensitive substring check that would not have caught
this gap); TestGetDoesNotRedirectWhenNoCorrectionExists now asserts
the absence of "NOTE:" rather than the no-longer-emitted
"redirected_from" string.

--json output (EntryResult.RedirectedFrom) is unchanged -- already
correct per round 1's review.
cairn get plain-text redirect NOTE-line reorder (crn-evw98.3 feature,
review round 2 fix). See release-gates/crn-6b1g8-gate.md for full
criteria evidence.
@quad341
quad341 merged commit 14eb15c into main Aug 20, 2026
2 checks passed
@quad341
quad341 deleted the deploy/crn-6b1g8-gate branch August 20, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant