Skip to content

test: cover plugin registry beforeQuery chaining - #162

Open
kingzzoov-ctrl wants to merge 1 commit into
outerbase:mainfrom
kingzzoov-ctrl:bounty-71-plugin-registry-coverage
Open

kingzzoov-ctrl wants to merge 1 commit into
outerbase:mainfrom
kingzzoov-ctrl:bounty-71-plugin-registry-coverage

Conversation

@kingzzoov-ctrl

@kingzzoov-ctrl kingzzoov-ctrl commented May 12, 2026 •

Copy link
Copy Markdown

/claim #71

This PR fixes a small regression in StarbasePluginRegistry.beforeQuery so each plugin hook receives the previous hook output exactly once, and adds a focused regression test that asserts call counts and arguments across multiple plugins.

What changed

  • Removed the duplicate await plugin.beforeQuery(opts) call that re-ran every hook with the original query.
  • Added a regression test proving:
    • each beforeQuery hook is called exactly once;
    • the second hook receives the first hook's modified SQL/params;
    • the final return value is the last hook output.

Demo video

Short local verification demo: https://github.com/kingzzoov-ctrl/starbasedb/releases/tag/starbasedb-pr162-demo-2026-05-13

Artifact details:

  • File: starbasedb-pr162-demo-2026-05-13.mp4
  • Duration: 12s
  • Size: 106,802 bytes
  • SHA-256: 34e4f9abce0a4090ceb74c9237fe1859530581ea98e0f326a4ac06b9794ba30e

Demo / verification transcript

$ npx pnpm@9.15.9 exec vitest run src/plugin.test.ts --coverage.enabled false
RUN  v2.1.8 /root/revenue-agent/work/starbasedb

✓ src/plugin.test.ts (9 tests) 16ms

Test Files  1 passed (1)
Tests  9 passed (9)
$ git diff --check
# no output; whitespace check passed

Notes

  • Scope is intentionally narrow: one production-line fix plus one focused regression test.
  • I posted /attempt #71 in the issue thread before opening this PR.
  • The repository still has unrelated pre-existing TypeScript/lint issues in other files, so the focused plugin test is the validation target for this change.

@kingzzoov-ctrl

Copy link
Copy Markdown
Author

Quick verification refresh: I re-ran the focused test suite (
RUN v2.1.8 /root/revenue-agent/work/starbasedb

stdout | src/plugin.test.ts > StarbasePluginRegistry > should register plugins correctly
Plugin MockPlugin registered

✓ src/plugin.test.ts (9 tests) 64ms

Test Files 1 passed (1)
Tests 9 passed (9)
Start at 12:12:15
Duration 1.34s (transform 288ms, setup 0ms, collect 265ms, tests 64ms, environment 0ms, prepare 288ms)) and ; both pass locally. This PR still looks clean/mergeable from my side, so it should be ready for maintainer review when available.

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