Skip to content

refactor(skillignore): replace the memoized negation search with a loop - #984

Merged
runkids merged 1 commit into
mainfrom
runkids/skillignore-negation-cleanup
Nov 23, 2026
Merged

runkids merged 1 commit into
mainfrom
runkids/skillignore-negation-cleanup

Conversation

@runkids

@runkids runkids commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)
  • Approved feature or large change (the linked issue has the approved label)

Linked Issue

Follow-up to #980. No issue.

What changes

  • negationReachesUnder is a loop instead of a memoized recursion. A ** met before the directory runs out always absorbs the rest of it, so the recursion never changed the answer. Behavior is the same, and the walk no longer allocates a map per ignored directory.
  • TestDiscoverSourceSkills_GlobNegationMatchesSyncWalk pins the bug fix(skillignore): keep directories a negation re-enables walkable #980 fixed where users saw it. With build/ and !**/keep, the walk diff and check use (with CanSkipDir) and the walk sync uses must both return build__keep and plain.
  • TestCanSkipDir gains a case for a negation that ends above the directory (!/build against build/sub), the one branch no case reached. Three cases that repeated another case's path are removed.

Checks

  • make check passes in the devcontainer.
  • The discovery test fails against the pre-fix(skillignore): keep directories a negation re-enables walkable #980 skillignore.go (flat names = [plain], want [build__keep plain]) and passes now.
  • The new CanSkipDir case fails when that branch returns true instead of false.
  • A scratch comparison of the old and new negationReachesUnder agreed on 2,000,000 random pattern and directory pairs, including repeated **, empty segments and invalid globs. It is not committed.

Checklist

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

A "**" met before the directory runs out always absorbs the rest of it,
so the recursion and memo added in #980 never change the answer. A loop
gives the same results without allocating a map per ignored directory.

The new discovery test pins what users saw: the walk diff and check use
(with CanSkipDir) and the one sync uses must return the same skills for
a glob negation, or diff reports a synced skill as an orphan. A CanSkipDir
case now covers a negation that ends above the directory, the one branch
no case reached, and three cases that repeated another case's path are gone.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T02:09:32.669921Z d902ae6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@runkids
runkids merged commit 5e985e2 into main Nov 23, 2026
10 checks passed
@runkids
runkids deleted the runkids/skillignore-negation-cleanup branch November 23, 2026 03:00
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.

1 participant