fix: resolve four fishy-logic review findings (search, graph, sync) #27

Merged
fiatcode merged 4 commits from fix/review-fishy-logic into main 2026-06-18 16:56:02 +07:00
Owner

Resolves the four "fishy logic" findings from the codebase review (Section 2). Four independent, TDD-first fixes — one commit each.

Changes

  1. fix(search): distinguish empty results from never-searched and stop re-running — adds a searched flag so a zero-result search shows no matches (not press enter to search) and Enter no longer re-runs a query that already returned nothing. Never-searched state unchanged.
  2. fix(graph): resolve case-fold name collisions deterministically and warnBuildIndex keeps the first page in os.ReadDir (filename-sorted) order for each folded key and warns on stderr, instead of letting the last-walked page silently win.
  3. fix(sync): label a failed git status as the 'status' stage — a failed git status --porcelain preflight now reports stage status instead of the mislabeled add.
  4. fix(sync): refuse to sync while a rebase or merge is in progress — new preflight refuses with stage rebase-in-progress when rebase-merge/rebase-apply/MERGE_HEAD is present, so a second sync can't add+commit conflict-marker files.

Notes

  • One deviation from the plan, in Task 2: the plan's prescribed loop added pages to ByName before the fold-collision check, which (since Resolve checks ByName before ByNameFold) would have shadowed the deterministic winner and failed the plan's own test. Losers are now skipped from both maps.
  • Remaining items are Minor/cosmetic (see execution report).

Verification

  • TDD per task (RED → minimal impl → GREEN), per-task spec+quality review, opus whole-branch review: Ready to merge, no Critical/Important.
  • go vet ./... clean; go test ./... green across all 7 packages.
Resolves the four "fishy logic" findings from the codebase review (Section 2). Four independent, TDD-first fixes — one commit each. ## Changes 1. **fix(search): distinguish empty results from never-searched and stop re-running** — adds a `searched` flag so a zero-result search shows `no matches` (not `press enter to search`) and Enter no longer re-runs a query that already returned nothing. Never-searched state unchanged. 2. **fix(graph): resolve case-fold name collisions deterministically and warn** — `BuildIndex` keeps the first page in `os.ReadDir` (filename-sorted) order for each folded key and warns on stderr, instead of letting the last-walked page silently win. 3. **fix(sync): label a failed git status as the 'status' stage** — a failed `git status --porcelain` preflight now reports stage `status` instead of the mislabeled `add`. 4. **fix(sync): refuse to sync while a rebase or merge is in progress** — new preflight refuses with stage `rebase-in-progress` when `rebase-merge`/`rebase-apply`/`MERGE_HEAD` is present, so a second sync can't add+commit conflict-marker files. ## Notes - One deviation from the plan, in Task 2: the plan's prescribed loop added pages to `ByName` before the fold-collision check, which (since `Resolve` checks `ByName` before `ByNameFold`) would have shadowed the deterministic winner and failed the plan's own test. Losers are now skipped from both maps. - Remaining items are Minor/cosmetic (see execution report). ## Verification - TDD per task (RED → minimal impl → GREEN), per-task spec+quality review, opus whole-branch review: Ready to merge, no Critical/Important. - `go vet ./...` clean; `go test ./...` green across all 7 packages.
When two pages fold to the same lowercase key (e.g. Alpha.md and
alpha.md on a case-sensitive FS), keep the first page in os.ReadDir
(sorted) order rather than silently letting the last-walked page win,
and emit a stderr warning so the user knows resolution was ambiguous.
fix(sync): refuse to sync while a rebase or merge is in progress
All checks were successful
CI / vet-and-test (pull_request) Successful in 58s
e4bec4c703
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
fiatcode/weft!27
No description provided.