Skip to content

Comments

fix(config): sort plugin paths for deterministic load order#14547

Open
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng:fix/plugin-load-order-deterministic
Open

fix(config): sort plugin paths for deterministic load order#14547
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng:fix/plugin-load-order-deterministic

Conversation

@kevinWangSheng
Copy link

@kevinWangSheng kevinWangSheng commented Feb 21, 2026

Issue for this PR

Closes #14492

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Sorts plugin file paths in loadPlugin() after glob scanning. Glob.scan() returns results in readdir order which is nondeterministic. Adding .sort() makes load order alphabetical so users can control hook execution order via filename prefixes (e.g. 00_safety.ts, 50_helper.ts).

How did you verify your code works?

Reviewed the single-line change. Array.sort() on file URL strings produces stable alphabetical order. All CI checks pass.

Screenshots / recordings

N/A - no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Glob.scan() returns results in filesystem (readdir) order, which is
nondeterministic and can change after file recreation or FS migration.
Sort discovered plugin paths so users can control execution order with
filename prefixes (e.g. 00_safety.ts, 50_helper.ts).

Fixes anomalyco#14492

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Feb 21, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Plugin load order within a directory is nondeterministic

1 participant