Skip to content

test(memory): compare instructions against the slash-form root - #355

Merged
runkids merged 2 commits into
runkids:mainfrom
star-nebula:fix/memory-instructions-path-form
Oct 3, 2026
Merged

runkids merged 2 commits into
runkids:mainfrom
star-nebula:fix/memory-instructions-path-form

Conversation

@star-nebula

Copy link
Copy Markdown
Contributor

Type

  • Bug fix (test-only, no product code changes)

Linked Issue

Part of #344

internal/memory arrived with #349, after #344 was filed, so it is not in that issue's table yet. Its
Windows failure is the same class as #348: an assertion written against one platform's path form.

What

One assertion in internal/memory/store_test.go:85:

-	if !strings.Contains(Instructions(root, ""), root) {
+	if !strings.Contains(Instructions(root, ""), filepath.ToSlash(root)) {

Why

Instructions renders the folder through filepath.ToSlash (internal/memory/guidance.go:36), so the
text it returns contains C:/Users/... on Windows. The test then compares that text against root,
which is t.TempDir() in OS-native form (C:\Users\...). The two forms only coincide where the OS
separator already is /, which is why this passes on Linux and macOS and fails on every Windows run.

The package already asserts it this way elsewhere — guidance_test.go:16 checks for
"`"+filepath.ToSlash(outside)+"`" — so this brings store_test.go in line with its own sibling
test rather than inventing a convention.

Measured

go test -v -count=1 ./internal/... on a windows-latest runner at 6e176ddb from my fork:
run 37108486253,
FAIL skillshare/internal/memory 0.641s, and TestInitPreservesExistingIndex is the only failing
test in the package.

Reproduced on a real Windows host with a cross-compiled windows/amd64 test binary:

before the patch after the patch
TestInitPreservesExistingIndex 5 failures in 5 runs 10 passes in 10 runs
whole internal/memory package fails passes, 3 runs
same tests on Linux (WSL, ext4) passes passes

gofmt -l and go vet ./internal/memory are clean.

Why this matters for the Windows job

#351 merged a windows-test job that lists only the packages green on windows-latest.
internal/memory cannot be added to that list while this assertion fails, so this is the prerequisite
for covering the new memory feature on the platform it ships binaries for.

Checklist

  • I've read CONTRIBUTING.md
  • Tests included and passing — the changed assertion is verified failing before and passing after
    on a real Windows host, with Linux unchanged
  • No unrelated changes in the diff (1 file, 1 assertion + 2 comment lines)
  • Scope is focused — one assertion in one test

Instructions renders the memory folder with filepath.ToSlash, so asserting the raw
root path can only hold where the OS separator already is a slash. On windows-latest the
test fails on every run while the rest of the package passes.

@runkids runkids left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed b02b585. No blocking findings. Instructions already renders the canonical directory with filepath.ToSlash, so this assertion matches the implementation on Windows while preserving the path check. Verified TestInitPreservesExistingIndex in an isolated devcontainer copy; passed. The Windows CI check also passed.

@runkids
runkids merged commit 6a35284 into runkids:main Oct 3, 2026
8 checks passed
@star-nebula
star-nebula deleted the fix/memory-instructions-path-form branch October 15, 2026 07:25
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.

2 participants