Skip to content

fix: filter trimmed module references#18

Merged
thegdsks merged 2 commits intoglincker:masterfrom
atharvasingh7007:fix/filter-trimmed-module-references
Apr 14, 2026
Merged

fix: filter trimmed module references#18
thegdsks merged 2 commits intoglincker:masterfrom
atharvasingh7007:fix/filter-trimmed-module-references

Conversation

@atharvasingh7007
Copy link
Copy Markdown
Contributor

@atharvasingh7007 atharvasingh7007 commented Apr 13, 2026

Summary

  • filter depends_on and depended_by to the retained module set when max_modules trims the graph
  • drop dependency edges that point at trimmed modules
  • compute most_depended and isolated from the retained modules so the generated index stays internally consistent
  • add an engine regression test for a capped three-module graph

Root cause

assembleIndex() capped the modules map, but it still copied dependency metadata from the full graph. That could leave stacklit.json with dangling module references in modules.*.depends_on, modules.*.depended_by, dependencies.edges, and dependencies.most_depended.

Impact

With max_modules set below the full module count, Stacklit could emit an index where dependency edges point to modules that are no longer present in modules. That can mislead AI consumers and produce Mermaid edges to undefined nodes.

Validation

  • gofmt -w internal/engine/engine.go internal/engine/engine_test.go
  • go test ./...
  • go build -o stacklit.exe ./cmd/stacklit
  • ./stacklit.exe init

@thegdsks thegdsks merged commit e0b036f into glincker:master Apr 14, 2026
1 check passed
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