Conversation
Keep backlink rels ordered by their source occurrence so repeated links from one note render in Markdown order. Closes #186.
Address review finding: backlink source order should be named at the backlink boundary instead of riding Rel field order and IxSet iteration.
Address review finding: replace the raw link occurrence tuple with a named representation and reuse the shared Pandoc inline-ref parser.
Address code-police readability rule by documenting the new exported relation ordering helpers and link occurrence type.
Hickey/Lowy Analysis
Hickey rationaleThe first implementation preserved source order by putting The extraction path also carried a raw Lowy rationaleBacklink ordering is user-visible behavior, so the boundary that assembles backlinks should own the ordering decision. The original patch made this behavior ride on low-level |
|
| Step | Status | Duration | Verification |
|---|---|---|---|
| sync | ✓ | 1s | git fetch ok; forge=github; noGit=false |
| research | ✓ | 5m 39s | Issue #186 maps to Emanote.Model.Link.Rel.noteRels and Emanote.Model.Graph.modelLookupBacklinks; rel extraction/storage lacks source occurrence order, causing repeated backlink contexts to render out of Markdown order. |
| branch | ✓ | 0s | Created feature branch fix/backlink-context-order from origin/master. |
| implement | ✓ | 4m 3s | Implemented ordered rel extraction with per-note occurrence indices, added regression for repeated [[Foo]] backlink contexts, removed unused pandoc-link-context dependency, and updated CHANGELOG. |
| check | ✓ | 19s | nix develop -c cabal build all passed (bare cabal not on PATH, same configured command run inside project dev shell). |
| docs | ✓ | 1s | CHANGELOG.md updated under Unreleased bug fixes; README.md and docs/ need no changes for this internal backlink-order fix. |
| fmt | ✓ | 18s | just fmt passed after fourmolu formatted the changed Haskell files. |
| commit | ✓ | 8s | Committed 2e77aff and pushed origin/fix/backlink-context-order. |
| hickey+lowy | ✓ | 9m 55s | Hickey and Lowy reviews completed. Fixed Lowy/Hickey ordering-contract finding in 61fb989 and Hickey link-occurrence representation finding in ed0412d; no deferred findings. |
| police | ✓ | 1m 24s | code-police clean after fixing readability doc comments in 8309c54; rules, fact-check, and elegance passes found no remaining issues. |
| test | ✓ | 8s | Focused Haskell tests passed: Emanote.Model.Graph modelLookupBacklinks and Emanote.Model.Link.Rel noteRels regressions for issue #186. |
| create-pr | ✓ | 50s | Draft PR #688 created and Hickey/Lowy analysis comment posted; no deferred findings. |
| ci | ✓ | 4m 4s | vira ci passed for HEAD 8309c54; signoffs vira/aarch64-darwin and vira/x86_64-linux succeeded. |
| evidence | ✓ | 1m 48s | Posted ## Evidence comment with screenshot asset: #688 (comment) |
| done | ✓ | 0s | All /do steps passed; final status report prepared. |
| Total | 31m 40s |
Slowest step: hickey+lowy (9m 55s)
Optimization suggestions
hickey+lowydominated the run at 9m 55s. For tiny, low-risk edits,$do --minimalwould skip those reviews; for model/rendering behavior like this one, keeping the default was worthwhile because it produced the explicit ordering contract commits.researchtook 5m 39s. A prompt that names suspected modules such asEmanote.Model.Link.RelandEmanote.Model.Graph, or includes a minimal note pair, would trim the initial mapping time.citook 4m 4s and passed on the first run. For future follow-up-only validation, resuming from the CI step after the branch is already pushed avoids repeating earlier workflow work.
Workflow completed at 2026-04-30T12:08:29Z.

Repeated backlinks now render in the order they appear in Markdown. A note that links to the same target several times now carries source occurrence order through relation extraction and backlink grouping, so the rendered context list matches the original note. Closes #186.
The fix makes the ordering contract explicit instead of relying on
IxSetiteration or derived record ordering:RelOrdernoteRelsandmodelLookupBacklinkswith focused regressionsValidation
Try it locally
Generated by
/doon Codex (modelgpt-5).