feat(plugins,engine): build lifecycle hooks (on_build_start / on_build_finish) — Issue #11 - #32
Merged
Merged
Conversation
…on_build_finish hookspecs Closes part of #11. Adds plugin-facing abort exception and build result dataclass. Two new hookspecs: on_build_start (collect-all-errors abort semantics) and on_build_finish (receives BuildResult). Engine callsites in Task A2.
… apidoc Closes part of #11. - Invoke on_build_start before stale detection with collect-all-errors abort pattern - Invoke on_build_finish with BuildResult(compiled_files, output_dir) - Remove hardcoded golem.plugins.apidoc import and call from BuildEngine.build_site - Update lifecycle documentation in engine docstrings - Add unit tests for collect-all-errors, single abort, finish hook, and apidoc decoupling
…e original exception in strict mode
…de for unexpected plugin errors
- Add __all__ to golem/plugins/__init__.py exposing GolemBuildAbortError and BuildResult - Update test_plugins_exports to assert GolemBuildAbortError and BuildResult - Add test_build_engine_strict_mode_raises_when_apidoc_fails - Add incremental build test checking on_build_finish receives empty compiled_files
…lic APIs - GolemBuildAbortError: replace RST Example:: with [source,python] fence block - BuildResult: replace free-text field descriptions with [attributes] labeled list - apidoc.on_build_start: expand one-liner to full docstring with [parameters] and [raises] - build_site: add GolemBuildAbortError specifically to [raises] section
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.
Summary
Implements Issue #11: decouples the engine from concrete plugin imports and adds two new lifecycle hook points that plugins can use to run logic before and after the compilation pipeline.
Changes
golem/plugins/__init__.pyGolemBuildAbortError(Exception)— exception plugin authors raise fromon_build_startto abort the buildBuildResultdataclass — carriescompiled_files: list[Path]andoutput_dir: Pathtoon_build_finishimplson_build_start(config)hookspec — called before stale detection; supports collect-all-errors abort semanticson_build_finish(config, result: BuildResult)hookspec — called after all documents written to disk__all__added exposing all public plugin symbolsgolem/engine.pygolem.plugins.apidoc.generate_api_docs(engine no longer coupled to any concrete plugin)on_build_startcollect-all-errors loop before stale detection: runs ALL implementations, accumulates everyGolemBuildAbortError, then raises a single summary erroron_build_finishdispatch after disk write withBuildResult_invoke_build_start_hookscopesinspect.signaturenarrowly to avoid duplicate hook execution onValueError/TypeErrorgolem/plugins/apidoc/__init__.pyon_build_starthookimpl restores API doc generation via the lifecycle hook (same logic, now decoupled)Tests
on_build_finishpayload, apidoc decoupling, no-op whenapi_packagesunset, strict-mode propagation, incremental build resultCloses #11