6.7 KiB
| id | ticket | title | status | created | completed | tags | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0010 | compiler-analyze-compile-build-pipeline-split | Refactor BuilderPipelineService into explicit analyze, compile, and build entrypoints | done | 2026-03-30 | 2026-03-30 |
|
Objective
Implement the canonical pipeline entrypoints from DEC-0007 in prometeu-build-pipeline, replacing the monolithic public run surface with explicit analyze, compile, and build operations.
Background
The current BuilderPipelineService exposes one public run(config, logs) entrypoint and internally constructs a filesystem-anchored BuilderPipelineContext.
DEC-0007 requires:
- one canonical pipeline with fixed stage ordering,
analyze,compile, andbuildas explicit public entrypoints,- stable result contracts rather than leaking
BuilderPipelineContext, - filesystem-default context construction outside the pipeline itself.
Scope
Included
- Refactor
BuilderPipelineServicepublic API to explicit entrypoints. - Introduce stable result models for
analyze,compile, andbuild. - Refactor context/config construction so filesystem-default composition is no longer hardcoded inside the pipeline service.
- Keep the canonical stage ordering unchanged.
Excluded
- Updating downstream callsites and tests outside the core pipeline module.
- Editor/LSP-specific consumers beyond the generic context/config model.
- Housekeeping deletion of historical docs or discussion artifacts.
Execution Steps
Step 1 - Introduce explicit result contracts
What: Add stable result types for each public entrypoint so the service no longer exposes BuilderPipelineContext as the external contract.
How: Define result models with the minimum DEC-0007 requirements:
AnalysisSnapshotor equivalent foranalyze,- an in-memory compile result carrying validated executable artifacts for
compile, - a build result carrying the persisted artifact location and compile payload for
build. Keep internal mutable pipeline state inBuilderPipelineContext, but add explicit adapters from context to public result objects. File(s):
prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/models/BuilderPipelineContext.javaprometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/messages/prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/models/
Step 2 - Split service entrypoints by terminal stage
What: Refactor BuilderPipelineService so each public entrypoint stops at the DEC-0007 terminal stage.
How: Replace the public run flow with explicit methods that execute the same canonical stage list through bounded terminal stages:
analyzestops afterFrontendPhasePipelineStage,compilestops afterVerifyBytecodePipelineStage,buildstops afterWriteBytecodeArtifactPipelineStage. Use one shared stage execution helper so the implementation does not fork stage order or error handling logic across entrypoints. File(s):
prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/workspaces/BuilderPipelineService.javaprometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/workspaces/PipelineStage.java
Step 3 - Externalize context construction
What: Remove the implicit filesystem-default context construction from inside the pipeline service.
How: Refactor BuilderPipelineContext.compilerContext(...) and surrounding config flow so entrypoints receive the context/config composition required for their caller.
Preserve filesystem support, but move its construction into explicit factories or caller-side composition helpers rather than hardcoding it as the only pipeline-owned mode.
File(s):
prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/models/BuilderPipelineContext.javaprometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/messages/BuilderPipelineConfig.javaprometeu-compiler/prometeu-compiler-core/src/main/java/p/studio/compiler/utilities/SourceProviderFactory.java
Step 4 - Keep canonical stage behavior intact
What: Ensure the refactor preserves the semantic order and gating behavior of the current executable pipeline.
How: Keep the stage order fixed, preserve current error propagation, and ensure compile still covers lowering, optimization, emission, link precheck, and verification before any build-specific artifact write occurs.
File(s):
prometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/workspaces/BuilderPipelineService.javaprometeu-compiler/prometeu-build-pipeline/src/main/java/p/studio/compiler/workspaces/stages/*.java
Test Requirements
Unit Tests
- Add service-level tests proving each entrypoint stops at its required terminal stage.
- Add tests proving
analyzeproduces the minimum snapshot contract and does not populate backend artifact outputs. - Add tests proving
compilereturns validated in-memory artifacts without writing to disk. - Add tests proving
buildextendscompileonly with artifact persistence.
Integration Tests
- Preserve or replace the existing end-to-end pipeline integration coverage with explicit
build-based integration tests. - Add an integration test that exercises
compileagainst a real project root and asserts no artifact file is written.
Manual Verification
- Inspect the public API of
BuilderPipelineServiceto confirmrunis gone. - Verify the default filesystem composition is not hardcoded as the only context path inside the service.
- Verify stage order remains unchanged from DEC-0007.
Acceptance Criteria
BuilderPipelineServiceexposes explicitanalyze,compile, andbuildentrypoints and no longer exposes publicrun.- Public result types exist and
BuilderPipelineContextis no longer the external contract. analyze,compile, andbuildstop exactly at the DEC-0007 terminal stages.- Filesystem-default behavior is still supported but is composed outside the pipeline core.
- The canonical executable path preserves current PBS-facing correctness through emit, link, and verify.
Dependencies
- PLN-0009 should land first or in parallel if the spec wording is stable.
- No downstream callsite migration should begin until the new entrypoints and result models exist.
Risks
- Refactoring context ownership without a clear composition boundary can accidentally leave filesystem behavior embedded in the service.
- Result models that mirror the mutable context too closely will leak internal implementation details back into the public API.
- If stage slicing is duplicated per method instead of shared, drift between
compileandbuildcan reappear immediately.