feat(init): suggest JS/TS test-file excludes (#165) - #171
Merged
Conversation
Unexcluded co-located test files (*.spec.ts / *.test.ts / __tests__) were the upstream root cause of graph-export edge pollution (lh-enterprise: 77% of edges from test files, all mocks unresolved). Fixed at the config seam — single source of truth for scan-all and graph-export; a --exclude-tests flag was rejected as it would let the two see different trees. - infer_exclude_patterns: +7 test patterns, suggested only when such files exist (conditional style, same as vendor/target) - config explain exclude: lists the patterns — graph-export's high-unresolved warning already told users to run it
dreamlx
added a commit
that referenced
this pull request
Aug 15, 2026
P1 (docs, #169 residual): active user-facing surfaces still advertising the removed post-commit workflow — codeindex init's final output, README_zh.md (bullet/workflow/skill-table; EN was clean), examples/ai-integration-guide.md (whole Post-commit section + doc-only scenario), team-workflow-guide ('Three hooks'). All removed/updated; version-history mentions intentionally kept. P2 (#171): _has_js_test_files walked .venv and duplicated the skip-set — now shares _WALK_SKIP_DIRS with detect_languages (venv/.tox/.eggs pruned), uncapped-walk rationale documented. P2 (#172): leftover-hook read_text now catches OSError — status is informational, must not crash on an unreadable file.
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.
Closes #165
Audit 结论
取向:config 层修,拒绝
--exclude-testsflag。scan-all和graph-export消费同一份 exclude,lh-enterprise 实证 config 修法同时治好两个面(29053 → 6702 边);flag 会让 README_AI 和 graph 看到不同的文件树,desync。与 #167 确立的 generator 不持策略一致。审计点 1(README_AI 导航损失):co-located spec 文件名自述、mock 符号污染 symbol 索引,导航价值≈0,排除无损。Python
tests/目录不在本 issue 范围,未动。发现的 UX 断点:graph-export 警告说
run: codeindex config explain exclude,但该输出原来没有任何测试模式——警告指向的救命信息不存在。已修。Changes
infer_exclude_patterns:项目存在*.spec.ts/*.test.ts/__tests__时建议 7 条 exclude(单次 walk 早退检测;conditional 风格同vendor//target/——是 suggestion 不是 gate)config_help.py:explain exclude补 recommendations + example 覆盖测试模式tests/test_init_wizard_exclude.py(3 tests:有 spec 文件→建议、纯 Python→不建议、explain 含模式)Verification
codeindex config explain exclude实际输出已人工核对