Repository navigation
Conversation
walk() produced OS-native paths (backslashes on Windows) that never matched the '/'-based definition tables (FILE_ID_DIRS, the rules/ prefix, evidence/index.csv), so on Windows every nested E-/R- definition went unregistered and valid knowledge bases failed check-kb. Normalize to POSIX in walk() via an exported toPosix helper; add an entry guard so the module is importable, and a unit test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
brenodias
force-pushed
the
fix/check-kb-windows-paths
branch
from
October 20, 2026 14:27
6483bc1 to
43987a3
Compare
This was referenced Oct 20, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
check-kb.mjsflags every nested-defined ID as "referenced but not defined" — everyE-###entity, everyR-###rule — and warns thatevidence/index.csvis misnamed. A knowledge base that is actually valid cannot passcheck-kb, sopack-kbthen refuses it without--force.Cause
walk()builds paths withrelative(), which returns OS-native separators (backslashes on Windows). The definition logic compares those paths against/-based tables:FILE_ID_DIRSkeys such asdata-model/entities(viadirname(file) !== dir),rules/prefix (file.startsWith('rules/')),EVIDENCE_INDEX=evidence/index.csv(file === EVIDENCE_INDEX).On Windows none of these match, so no heading/filename definitions register. On POSIX it works, which is why CI never caught it.
Fix
Normalize separators to POSIX once, in
walk(), via a small exportedtoPosixhelper — everything downstream already uses/. Added an entry guard (same pattern asbuild-report.mjs) so the module can be imported, plus a unit test fortoPosix.Testing
node --test tests/kb-scripts.test.mjs→ 27/27 pass (new test included). Verified against a real Windows knowledge base:check-kbgoes from dozens of spurious "referenced but not defined" errors toOK.🤖 Generated with Claude Code