Skip to content

feat(init): suggest JS/TS test-file excludes (#165) - #171

Merged
dreamlx merged 1 commit into
masterfrom
fix/165-js-test-excludes
Aug 15, 2026
Merged

feat(init): suggest JS/TS test-file excludes (#165)#171
dreamlx merged 1 commit into
masterfrom
fix/165-js-test-excludes

Conversation

@dreamlx

@dreamlx dreamlx commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Closes #165

Audit 结论

取向:config 层修,拒绝 --exclude-tests flag。 scan-allgraph-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.pyexplain exclude 补 recommendations + example 覆盖测试模式
  • 新增 tests/test_init_wizard_exclude.py(3 tests:有 spec 文件→建议、纯 Python→不建议、explain 含模式)

Verification

  • 新测试 3 passed;全套 1782 passed, 13 skipped
  • codeindex config explain exclude 实际输出已人工核对

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
dreamlx merged commit d082e13 into master Aug 15, 2026
8 checks passed
@dreamlx
dreamlx deleted the fix/165-js-test-excludes branch August 15, 2026 14:39
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.
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.

audit: init wizard / 默认 config 对 JS/TS 项目缺测试文件 exclude —— graph-export 边污染的上游根因

1 participant