Skip to content

fix: run plugin beforeQuery hooks once#196

Open
Treasure520520 wants to merge 1 commit into
outerbase:mainfrom
Treasure520520:bounty/71-plugin-registry-before-query
Open

fix: run plugin beforeQuery hooks once#196
Treasure520520 wants to merge 1 commit into
outerbase:mainfrom
Treasure520520:bounty/71-plugin-registry-before-query

Conversation

@Treasure520520
Copy link
Copy Markdown

Summary

/claim #71

This adds a focused regression slice for StarbasePluginRegistry.beforeQuery() and fixes the covered hook-order bug.

The registry was invoking each plugin's beforeQuery() twice: once with the progressively modified SQL/params, then again with the original options. The second call could trigger duplicate plugin side effects while ignoring the chained SQL/param state. The registry now calls each hook once and passes the modified SQL/params to the next plugin in order.

Verification

  • COREPACK_ENABLE_AUTO_PIN=0 corepack pnpm exec vitest --run src/plugin.test.ts
  • COREPACK_ENABLE_AUTO_PIN=0 corepack pnpm exec prettier --check src/plugin.ts src/plugin.test.ts
  • git diff --check

Note: the local commit used --no-verify because .husky/pre-commit calls a global pnpm binary that is not available in this shell. The same focused Corepack verification above passed after commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant