feat(pbs): add explicit guest lifecycle hooks

This commit is contained in:
2026-10-28 09:12:48 +00:00
parent eb7d6a2398
commit 9504f4694a
41 changed files with 1209 additions and 24 deletions
@@ -320,3 +320,26 @@ See [PBS generic contracts](../../../compiler/pbs/specs/generic-contracts.md).
Generic diagnostics distinguish duplicate/unbound parameters, exact arity, raw or improperly inferred application, unjustified symbolic capabilities, invalid substituted positions, constructor errors, collapsed overloads, invalid bound owners, overlap and bounded expansion. Preserve declaration and requesting-use locations with a short instantiation chain. Editor projections retain symbolic parameter, concrete argument and generic origin identities. Generated instance names and host stacks do not replace source explanations.
See [Concrete generic structs and free functions](../../../compiler/pbs/specs/generic-structs-and-free-functions.md).
## Guest lifecycle diagnostics and conformance
Invalid target, marker arguments and combinations are source-anchored syntax or
reserved-attribute diagnostics. Nongeneric empty signatures use
`E_SEM_INVALID_LIFECYCLE_SIGNATURE`; generic-instantiation admission may also
report the existing generic lifecycle error. `E_SEM_DUPLICATE_LIFECYCLE_ROLE`
identifies the role, conflicting declarations and their source locations across
the project graph; import order MUST NOT select a winner. Source diagnostics do
not guess physical FunctionIds. Typed handoff/PBX validation rejects duplicate
roles, captures, invalid signatures and physical entry-zero targets separately
from runtime load failures and executed traps.
Conformance MUST include both/one/no-hook cases, arbitrary names, imported and
repeated-import targets, invalid source surfaces, valid globals/closures,
optimized targets with no callers and ordinary direct calls. Execute generated
production PBX through production runtime/host Home/resume, observing ordered
effects, retained PC/state/init guard and gameplay frame/tick counters. Trap,
fuel exhaustion across slices and direct/transitive FRAME_SYNC are required;
sync fixtures use synthetic common IR because PBS exposes no sync construct.
Record revisions, platform/configuration, commands, scenarios, oracles and
results. Existing runtime tests alone are not producer integration evidence.