prometeu-studio/discussion/lessons/DSC-0060-multi-frontend-validation-boundaries/LSN-0063-language-vs-platform-validation-ownership.md
bQUARKz d7c2ec880f
Some checks are pending
Intrepid/Prometeu/Studio/pipeline/pr-master Build started...
JaCoCo Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 61.95% (17766/28676) * Branch Coverage: 52.69% (6860/13019) * Lines of Code: 28676 * Cyclomatic Complexity: 11490 #### Quality Gates Summary Output truncated.
Test / Build skipped: 15, passed: 645
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
implements PLN-0126
Publish the language-versus-platform validation matrix in compiler-general
specs, retitle spec 19, and recut PBS diagnostics so common structural
failures are not PBS coverage.

Housekeep DSC-0060 with LSN-0063.
2026-09-19 01:11:50 +01:00

130 lines
5.3 KiB
Markdown

---
id: LSN-0063
ticket: multi-frontend-validation-boundaries
title: Language vs platform validation ownership
created: 2026-09-19
tags: [compiler, compiler-general, compiler-pbs, backend, validation, multi-frontend]
---
# Language vs platform validation ownership
## Original Problem
PBS mixed two kinds of rejection. Some failures only make sense with the
language: syntax, types, markers, barrel files, imports. Others belong to any
executable frontend: malformed `IRBackend`, invalid lifecycle declarations,
missing assembled wrappers, host-capability identity, bytecode/preload.
Without an ownership rule, the next frontend would copy PBS validators, or the
common layer would start knowing `[Init]`, barrel, and `E_SEM_*`. Spec 19 was
still titled as PBS verification, and the PBS diagnostics catalog listed
wrapper and boot-guard failures as PBS coverage.
Lifecycle assembly had already moved (`LSN-0062`). That proved the pattern. It
did not inventory the rest.
## Consolidated Decision
A validation lives at the lowest layer that understands the failure without
knowing the source language.
- Language: needs AST, tokens, a language marker, a barrel, or another source
rule.
- Platform: can be checked on `IRBackend`, `IRLifecycleDeclaration`, IRVM, PBX,
host/capability tables, or ids.
The discussion published that matrix. It did not extract a generic
validator-core and did not move validators whose common contract is not closed.
Host admission is split. PBS owns the source shape of `[Host]` and
`[Capability]`. Platform owns canonical `(module, name, version)` identity and
capability consistency once those facts exist on `IRReservedMetadata`. The
current validator may stay in the PBS package until a later plan. `E_HOST_*`
is not eternal PBS semantics.
The same fact may exist on both sides with distinct identities. PBS can report
`E_SEM_MISSING_PROJECT_FRAME`; the common layer still rejects an executable
declaration with no frame root.
Platform codes are `COMMON_*`, `LOWER_IRVM_*`, or `MARSHAL_*`. PBS keeps
`E_PARSE_*`, `E_SEM_*`, `E_LINK_*`, and `E_HOST_*`. Copy origin/span when
present; a missing origin is a structural error, not a reason to invent a span.
Linking and barrel stay language-owned. `Addressable` is platform-owned and was
classified only. SDK canonical source and the broad architectural harness stay
on adjacent discussions.
## Final Implementation
The work was editorial and test-facing.
Spec 19 is now `Compiler Verification and Safety Checks Specification`. Gates
S-U and S-I are unchanged. Section 11 states the classification rule, the
English ownership matrix, diagnostic identity, dual reporting, and the
host-admission split. It explicitly refuses validator-core extraction and
package moves.
PBS diagnostics spec 12 keeps marker, syntax, semantics, linking, and
host-attribute coverage. Common structural failures now point at spec 19
section 11 and spec 20 instead of appearing as PBS required coverage.
Spec 20 cross-references that same compiler-general ownership. The conformance
matrix added `G19-11.1` through `G19-11.6` and `PBS12-11`.
`CommonBackendArchitectureTest` now guards `backend/`, `lifecycle/`, and all
common pipeline stages. `ValidationOwnershipSpecTest` locks the title, matrix,
and PBS recut.
`PbsHostAdmissionValidator` remains under `p.studio.compiler.pbs`. No linking
or asset production code moved.
## Examples
Language-owned:
- parse errors;
- `[Init]` / `[Frame]` signature and colocation;
- barrel and import failures;
- `host call not allowed during init`.
Platform-owned and already implemented:
- invalid `IRLifecycleDeclaration`;
- assembled wrapper, boot guard, and synthetic origin preconditions;
- IRVM and marshal rejection families.
Classified as platform, not moved:
- canonical host-binding identity on `IRReservedMetadata`;
- `Addressable` / asset path.
Dual reporting:
- missing `[Frame]` in PBS source is `E_SEM_MISSING_PROJECT_FRAME`;
- an executable declaration without frame root is a common structural error.
## Pitfalls
- Do not treat “classified as platform” as “move the class now.” Host admission
still waits on the SDK source discussion.
- Do not merge language and platform failures into one hybrid code. Two
identities are cheaper than a lost message.
- Do not put PBS governance or PBS diagnostics in charge of compiler-general
safety gates.
- Do not scan PBS frontend sources with the platform architecture guard. The
guard is for common validators, not for the language package that must remain.
- Do not invent a validator-core because several common checks exist. They
already live on their stages.
## References
- Decision: `DEC-0047`
- Plan: `PLN-0126`
- Related lesson: `LSN-0062` - Common lifecycle assembly after frontend declaration
- Related lesson: `LSN-0059` - Common IRBackend handoff and backend guardrails
- `docs/specs/compiler/19. Verification and Safety Checks Specification.md`
- `docs/specs/compiler-languages/pbs/12. Diagnostics Specification.md`
- `docs/specs/compiler/20. IRBackend to IRVM Lowering Specification.md`
- `docs/specs/compiler/22. Backend Spec-to-Test Conformance Matrix.md`
- `prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/specs/ValidationOwnershipSpecTest.java`
- `prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/specs/CommonBackendArchitectureTest.java`