Skip to content

fix: isolate lenient rule bootstrap failures - #218

Merged
swedishborgie merged 3 commits into
kitproj:mainfrom
r4ravi2008:review/lenient-bootstrap-failure-isolation
Sep 23, 2026
Merged

swedishborgie merged 3 commits into
kitproj:mainfrom
r4ravi2008:review/lenient-bootstrap-failure-isolation

Conversation

@r4ravi2008

Copy link
Copy Markdown
Contributor

Summary

Rule bootstrap scripts used to run inside the directory walk. A non-zero exit aborted filepath.Walk, so later rule files in that directory were never discovered. On a lenient search path this became a single "skipping directory" warning and the remaining rules were dropped with no per-file signal.

This change discovers and expands one rule directory first, then runs that directory's bootstrap scripts. Bootstrap for a directory finishes before the next directory is discovered, so search-path order is unchanged.

Changes

  • pkg/codingcontext/context.go: split discovery (discoverPendingRule) from bootstrap/publication (bootstrapAndPublishRules).
  • Lenient paths: a bootstrap failure logs a warning, excludes only that rule, and continues with later rules in the same directory.
  • Strict paths: a bootstrap failure is still fatal. Rules after the failing bootstrap are not published.
  • Parse or expansion errors still stop discovery of the rest of that directory. On a lenient path, rules already discovered remain eligible for bootstrap, and processing continues with the next directory.
  • docs/reference/search-paths.md: document the new failure handling.

Testing

  • go test -race -count=1 ./pkg/codingcontext/
  • New coverage in context_bootstrap_isolation_test.go:
    • lenient bootstrap failure skips only the failing rule
    • strict bootstrap failure is fatal
    • directory discovery completes before that directory's bootstraps
    • bootstrap of directory N completes before discovery of directory N+1
    • lenient parse failure keeps earlier rules and does not block a later search path

Line Changes

Category + Added - Deleted
Tests 312 0
Docs 18 0
Main code (pkg/codingcontext) 92 33

Definition of Done

  • Lenient bootstrap failure excludes only the failing rule
  • Later sibling rules in the same directory are still discovered and published
  • Strict bootstrap failure remains fatal
  • Search-path order is preserved across directories
  • Reviewer approval

@r4ravi2008
r4ravi2008 force-pushed the review/lenient-bootstrap-failure-isolation branch from 332e883 to 8fe4848 Compare September 23, 2026 00:10
Bootstrap ran inside the directory walk, so one failed script aborted
the rest of that directory. Discover and expand a directory first, then
run its bootstraps. On a lenient path, skip only the failing rule.
Describe the discover-then-bootstrap order and how strict vs lenient
search paths treat bootstrap and parse failures.
@r4ravi2008
r4ravi2008 force-pushed the review/lenient-bootstrap-failure-isolation branch from 8fe4848 to f9319b0 Compare September 23, 2026 00:10
Stop wrapping the same find-and-execute message twice so
callers can match the rule file without reading error text.
@swedishborgie
swedishborgie merged commit a914db4 into kitproj:main Sep 23, 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