Repository navigation
docs(plugins): reconcile the hook reference with HookType (#1743) - #1772
bernalalexis-try wants to merge 4 commits into
Conversation
…-computing#1743) Document the 9 missing hooks (generation batch and event, adapter function, streaming), add the Adapter and Streaming categories, fix the hook counts, and add a test that fails when a HookType member has no section or policy table row. Signed-off-by: Alexis <alexisnahuel.bernal@estudiantes.unahur.edu.ar>
ajbozarth
left a comment
There was a problem hiding this comment.
I am still on the fence about codifying this, but overall this is a solid PR
Some feedback from Claude. Verified the inventory against HookType, the payload dataclasses, and policies.py — counts, sections, table rows, and writable fields all check out, and the guard test passes.
One optional note: the sampling_loop_start "Fires:" line (existing, not touched by this PR) still reads as firing for any strategy, but stream() runs never fire sampling_loop_* — they use streaming_* + RetryEvent. Now that the Streaming pipeline section sits right below it, a one-line caveat there would close the reader-confusion that motivated #1743. Optional, since every explicit ask in the issue is satisfied.
…pling_loop hooks Signed-off-by: Alexis <alexisnahuel.bernal@estudiantes.unahur.edu.ar>
|
Thanks for the review. Pushed 089da12, which merges current main and:
I could not run markdownlint or the full mypy pass locally, so I am relying on CI for those. |
AngeloDanducci
left a comment
There was a problem hiding this comment.
Thanks for the update, started CI, one small nit about resolve.
|
|
||
| from mellea.plugins.types import HookType | ||
|
|
||
| PLUGINS_DOC = Path(__file__).parents[2] / "docs" / "docs" / "concepts" / "plugins.mdx" |
There was a problem hiding this comment.
| PLUGINS_DOC = Path(__file__).parents[2] / "docs" / "docs" / "concepts" / "plugins.mdx" | |
| PLUGINS_DOC = Path(__file__).resolve().parents[2] / "docs" / "docs" / "concepts" / "plugins.mdx" |
Probably okay without this but the other path walks we have use resolve.
| 3. **Returns a result** — continue unchanged, continue with a modified payload, or block execution entirely | ||
|
|
||
| Plugins are organized into six hook categories: | ||
| Plugins are organized into eight hook categories: |
There was a problem hiding this comment.
nit: perhaps we should make this count generic so we don't need to update it in the future (less thrash)
| Plugins are organized into eight hook categories: | |
| Plugins are organized into different hook categories: |
|
@bernalalexis-try soft ping in case you missed our above feedback notifications :) |
|
Thanks both. Pushed fdd4bb5 with the two nits:
|
ajbozarth
left a comment
There was a problem hiding this comment.
This LGTM, pending @AngeloDanducci approval we can merge this. If you want to fix the DCO error you can follow Claude advice pasted below, otherwise I can bypass it since its correct for at least one commit (the actual requirement)
Thanks, both nits and the sampling_loop_start caveat look good. One thing left: DCO is failing because fdd4bb51 is missing its Signed-off-by line (it also looks like it was committed with a different email than the earlier commits). Running git commit --amend --signoff --no-edit followed by git push --force-with-lease should fix it.
Fixes #1743.
The hook reference in
docs/docs/concepts/plugins.mdxhad drifted from theHookTypeenum, which defines 27 hooks in 8 groups.generation_batch_pre_call,generation_batch_post_call,generation_batch_error,generation_event,adapter_function_invocation_complete,adapter_function_phase_complete,streaming_start,streaming_event,streaming_end.test/plugins/test_plugin_docs.py, which fails when aHookTypemember has no####section or policy table row, or when the count text goes stale.Writable fields in the policy table were taken from
mellea/plugins/policies.py; the new hooks other thangeneration_batch_pre_callare observe-only.Checked that every
HookTypevalue has a section and a table row. I haven't run the new pytest file locally.