fix(pipeline): honor discovery exclusions in pkgmap/envscan repo walks#793
fix(pipeline): honor discovery exclusions in pkgmap/envscan repo walks#793Sowiedu wants to merge 1 commit into
Conversation
Signed-off-by: Patrick <11910229+Sowiedu@users.noreply.github.com>
cdf33d5 to
9eb5916
Compare
|
v12 pls audit |
|
Thanks for the focused fix. Triage: high-priority performance/stability PR for #792. Review will focus on whether pkgmap/envscan now share the same exclusion model as discovery, and whether the regression fixture proves a large ignored artifact tree is skipped rather than merely making this one repo faster. This should stay scoped to exclusion propagation and progress/degradation behavior. |
|
Thank you — of the several ignore-semantics PRs open right now, this is the one closest to the root cause: reusing discovery's materialized exclusion decisions instead of re-implementing matching per walker is exactly the right foundation, and the boundary-correct prefix match checks out. Three asks before merge:
Update: to keep momentum on the bug backlog, we're going to carry the changes above over the line ourselves shortly — a distilled follow-up on current main implementing the notes in this thread, with you credited as |
|
Thank you — of all the ignore-semantics work in flight, yours was the one closest to the root cause: reusing discovery's materialized exclusion decisions instead of re-implementing matching per walker was exactly right, and your boundary-correct prefix predicate carried over verbatim. We took it over the line with the missing regression tests (control-first so they can't pass vacuously), the incremental-path plumbing (your fix's one gap — the ctx used by incremental reindexes didn't carry the exclusions, tracked as #804), and a small narrative correction (envscan's walker has no production callers). Merged as 2e7c64b (PR #811) with you credited as co-author — closes #792 and #804. Thanks again for the excellent diagnosis in #792! |
…n walks The auxiliary filesystem walks (pkgmap manifest scan, tsconfig/jsconfig path-alias discovery, env-URL scan) ignored the directory subtrees that discovery had already excluded (gitignore + skip dirs). On a huge monorepo with a gitignored vendored tree this kept the pkgmap walk busy for ~15 minutes re-traversing directories the index never uses (DeusData#792). Distills PR DeusData#793 by Patrick (@Sowiedu): a shared root-anchored, '/'-boundary exclusion predicate (cbm_pipeline_relpath_is_excluded) in pipeline_internal.h, exclusion parameters threaded through cbm_pkgmap_scan_repo / cbm_pkgmap_build_from_repo, find_alias_files / cbm_load_path_aliases_excluded and cbm_scan_project_env_urls_excluded, NULL-exclusion wrappers preserving the old signatures, and the borrowed excluded_dirs/excluded_count pair on cbm_pipeline_ctx_t. Beyond DeusData#793: - Thread the excluded list into pipeline_incremental.c's extract ctx and its path-alias load as well, so incremental runs stop walking excluded trees too (DeusData#804). - Add regression tests: boundary semantics of the exclusion predicate, plus walk-level exclusion tests for pkgmap, path-alias, and envscan (each with an unexcluded control run so they cannot pass vacuously). All are red against the unfixed sources. - Correct the envscan narrative: cbm_scan_project_env_urls has no production callers today; the exclusion plumbing is kept for consistency and exercised by tests. Closes DeusData#792. Closes DeusData#804. Co-authored-by: Patrick <11910229+Sowiedu@users.noreply.github.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Fixes #792.
Problem
The auxiliary filesystem walks in
pkgmap(cbm_pkgmap_scan_repo, called frommerge_pkg_entries()at the parallel-extract join) andenvscanonly skip hardcoded directory names (cbm_should_skip_dir()/ a privateis_ignored_dir()list). They never consult the project's gitignore-derived exclusion list that discovery honors. On a repo with a large gitignored artifact tree this walk dominates the entire pipeline: with a 1.6M-file gitignored tile directory,index_repositorytakes 15–18 minutes (silent between two log lines, looks like a hang) instead of ~3 seconds.Fix
cbm_pipeline_relpath_is_excluded()(inpath_alias.c) that prefix-matches a repo-relative path against the pipeline ctx's excluded-dirs list.cbm_pkgmap_scan_repo()now takes the ctx'sexcluded_dirs/excluded_countand consults the helper before descending, in addition to the existingcbm_should_skip_dir()and Windows reparse-point checks.cbm_scan_project_env_urls_excluded(); the originalcbm_scan_project_env_urls()remains as a wrapper (NULL exclusions) so existing callers are unaffected.Hardcoded skip lists are kept as a fast path; the exclusion check only adds prefix comparisons on directory descent.
Verification
On the affected repo (~1,000 source files + 1,638,518-file gitignored
map-import/output/, Windows 11/NTFS):Synthetic check: repo with a gitignored
bigdir/of ~20k files — the walk no longer descends into it (verified via timing and open-handle inspection with Sysinternalshandle64). Graph output is unchanged on repos without large ignored dirs (node/edge counts identical before/after on the same tree).Diagnosis details, handle dumps, and the elimination path are in #792.