fix(hooks): pass appended review on ctx.extra.review for after:review#436
Merged
Conversation
The review handler called fireAfterHook without the extra argument,
so ctx.extra was undefined for after:review subscribers — even though
docs/plugin-schema.md documents extra.review as the contract. A hook
reading ctx.extra.review.verdict to route reject/concern verdicts
silently saw undefined.
Pass the terminal (just-appended) review as { review }. Add a
regression test asserting the hook receives lense/verdict/comment/by.
Surfaced by dogfood: a review→issue automation hook on a private
deployment read ctx.extra.review and got nothing.
before:review carrying its own payload is tracked separately (it
fires before the append, so the documented shape needs a distinct
decision).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
gate reviewhandler calledfireAfterHookwithout theextraargument, so
ctx.extrawasundefinedfor everyafter:reviewhook — even though
docs/plugin-schema.mddocumentsextra.reviewas the contract:
A hook reading
ctx.extra.review.verdictto route reject/concernverdicts therefore saw
undefinedand silently did nothing.How
review.tsnow passes the terminal (just-appended) review as{ review }:HookBus.fireAfterHookalready accepted the optionalextraarg —only the call site was missing it.
Test
Adds a regression test in
tests/interface/hookPluginLoader.test.tsasserting an
after:reviewhook receiveslense/verdict/comment/byonctx.extra.review. Before this fix the same testrecords
NO_EXTRA.How it surfaced
Dogfood. A
review → issueautomation hook on a private deploymentread
ctx.extra.review.verdictand got nothing — the documentedpayload never arrived. Tracing it back led to the missing call-site
argument.
Scope note
before:reviewcarrying its own payload is out of scope here. Itfires before the append, so the documented "appended review" shape
needs a distinct decision (the review-to-be vs. the review-as-landed).
Tracking that separately rather than guessing in this PR.
Pre-existing test failures (unrelated to this PR)
maincurrently has ~19 failing tests unrelated to this change:tools/lore-scope.shis absent (staledist/artifacts),#239expects the removed--executorsingular flag, and adoctorissues-dir detection case. This PR's diff touches only theafter:reviewhook call site and its test; the new regression testpasses.