prometeu-studio/docs/pbs/pull-requests/PR-020-pbs-lowering-admission-gates.md
2026-03-24 13:42:21 +00:00

44 lines
1.3 KiB
Markdown

# PR-020 - PBS Lowering Admission Gates
## Briefing
Lowering currently proceeds even when syntax/static/linking diagnostics contain errors. This PR introduces explicit admission gates so invalid programs are rejected before IR lowering.
## Motivation
Lowering must not convert required rejections into accepted lowered artifacts.
## Target
- `PbsFrontendCompiler` and `PBSFrontendPhaseService` lowering flow.
- Frontend-to-IR admission policy.
## Scope
- Block IR emission for source units with fatal diagnostics.
- Preserve deterministic diagnostics already emitted by previous phases.
- Keep successful paths unchanged.
## Method
- Introduce phase gate checks before `lowerFunctions` / file merge.
- Ensure failed units are excluded from emitted IR.
- Keep build issue adaptation behavior stable.
## Acceptance Criteria
- Files/modules with syntax/static/linking errors are not lowered.
- No invalid callable appears in IR output after failed admission.
- Valid files continue lowering unchanged.
## Tests
- Add tests proving failed parse/semantic/linking input does not emit IR functions.
- Add tests proving clean input still emits expected IR.
- Run frontend phase service and compiler suites.
## Non-Goals
- Redefining diagnostics severity policy.
- Introducing partial lowering recovery strategy.