Skip to content

refset: a target under a symlinked directory names its directory once - #377

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:fix-beside-symlinked-parent
Oct 16, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:fix-beside-symlinked-parent

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

What and why

cargo test -p bloomery-refset fails on macOS at arch::draft::tests::a_plain_target_with_no_draft_beside_is_the_family_path. The temporary directory lives under /var, which is a symlink to /private/var, so beside_paths compares the target's parent as spelled with the parent of the canonical target, finds them unequal, and lists the same directory twice. The load draft=off line would then name one sidecar path twice for any model opened through a symlinked directory, on any OS (for example ~/models linked to a data disk).

beside_paths now compares the canonical form of both parents, so a second path appears only when the target really resolves into another directory. A bare file name has the empty parent, so the parent is resolved as dir/., which names the working directory. The existing test spells the beside path as the target's directory. Two new tests cover a shard opened through a symlinked directory (Unix) and a bare file name.

Release notes: Fixed: a model opened through a symlinked directory no longer lists its draft sidecar path twice on the load draft=off line.

Code shape

  • No second copy. The change is inside beside_paths, the one owner both the pick and the off line walk.
  • Model code holds only architecture facts.
  • Dead code is gone.
  • No silent failure. An unresolvable parent keeps the previous behaviour (the resolved directory is listed).
  • Comments state what is true now.
  • No relaxed gate.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line), or "none": none.

What I ran

On macOS (Apple M4 Pro), cargo test -p bloomery-refset arch::draft:

  • with the new tests and the old comparison: 2 failed (the existing plain-target test and the new symlinked-directory test).
  • with the parent resolved without dir/.: the bare-file-name test failed.
  • with this change: 15 passed.

What I ran into

None of this blocks the PR. Nothing came up beyond the failure above.

Hardware (if the change is for a machine)

Not for a machine.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added the host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset label Oct 16, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: Canonical parent comparison removes duplicate sidecar paths while preserving lookup beside a target resolved into another directory.

Checked

Duplicates: 2 new test functions checked by Grep; they cover distinct directory-link and empty-parent cases.
Complexity: the change adds parent resolution inside the existing lookup owner.
Silent failure: 2 canonicalization .ok() sites followed through selection and diagnostics. Failure to resolve the target preserves the original-directory and family candidates; failure to resolve its parent retains the resolved-directory candidate.
Tests: static mutation analysis at crates/refset/src/arch/draft.rs:242: restoring the raw-parent comparison fails the directory-link assertion; removing join(".") fails the bare-name assertion. Adding a duplicate candidate fails the changed plain-target assertion.
Gates: no thresholds or pins moved; no tests or cases removed.
Escape catalog: no C1–C4 patterns matched.
Adversarial checks: distinct-directory file links retain their fallback; same-directory links and bare names retain the original spelling. The change runs at load time.

Notes

Validation was static; Rust tests were not run.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit c14c461 into midagedev:main Oct 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant