Files
prometeu-studio/discussion/lessons/DSC-0108-pbs-production-contracts-executable-examples/LSN-0107-quoted-project-identities-and-installed-authoring-contracts.md
T
bquarkz 71fb80efc3
Test / Tests and coverage occurred while executing withChecks step.
Intrepid/Prometeu/Studio/pipeline/head There was a failure building this commit
feat(studio): ship JavaFX 2 Play and delegate integration tooling
Launch the JavaFX 2 project shell on Java 25 with an interactive viewport,
managed Play lifecycle and project mutation guards. Preserve headless/MCP and
save compatibility, and qualify exact runtime executable bundles.
Separate unit JaCoCo gates from opt-in integration suites and use the internal
Pong fixture for the headless visual pilot.
Move maintenance and native conformance tools into tooling; retain the VS Code
extension and update current navigation links.

Validation: tooling make verify passed, including 1064 Studio unit tests,
JaCoCo thresholds and 22 headless integration tests.
2026-11-19 17:32:03 +00:00

162 lines
10 KiB
Markdown

---
id: LSN-0107
ticket: pbs-production-contracts-executable-examples
title: Quoted Project Identities and Installed Authoring Contracts
created: 2026-11-10
tags: [compiler, pbs, sdk, documentation, integration]
---
## Problem and consolidated decision
**Owner:** compiler/pbs. **Discussion:** DSC-0108. This lesson consolidates accepted
DEC-0091 and completed PLN-0169, originating in AGD-0110. The user explicitly
accepted the detailed decision and authorized planning and implementation.
Production authoring exposed two different problems. Some existing rules were
poorly explained or illustrated by outdated SDK calls. Separately, a project
could have a valid manifest name such as `zelda-1` that PBS could not spell in an
import. Neither problem justified changing boolean effects, global initialization,
visibility or runtime behavior by inference.
The decision added one language feature: ordinary quoted strings in the project
segment of module references. It preserved the remaining language contracts and
required complete, installed examples with observable expectations. Eight
authoring scenarios now have 21 positive/negative compilation cases in the
existing reference tree.
## Source spelling is not project identity
```pbs
import { Inventory } from @"zelda-1":inventory;
import { Collision } from @"physics-2d":api;
```
The parser decodes the ordinary string once before common resolution. Only the
project segment accepts this alternative; module-path segments remain PBS
identifiers. Existing `@game:state` and new `@"game":state` identify the same module,
global storage and declarations. The five existing escapes are `\\`, `\"`, `\n`,
`\r`, `\t`. No trimming, case folding, slug generation or path interpretation
changes the decoded identity.
`PbsSourceNames` shares ordinary string decoding with expression literals and
formats non-identifier or keyword project names with quotes. Module completions,
editorial descriptions and linking diagnostics use this source formatting. The
common manifest and `ModuleReference(project, pathSegments)` contract did not
need a new field or a PBS-specific name restriction.
Reserved-space admission also operates on the decoded name: `@"sdk":gfx` and
`@"core":color` remain stdlib-only. `@app` is an ordinary name, not a universal
self alias. Quoting names does not discover dependencies or grant visibility.
A blank quoted name needs special care during error recovery. Reporting a parser
error while retaining that invalid import allowed common identity construction
to throw. The parser now preserves the source error and omits the invalid import
from its recovered import list. This prevents an internal exception without
inventing a placeholder project name.
## Teach the existing authoring contracts
The [installed authoring guide](../../../prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/pbs-knowledge/examples/game/1/production/GUIDE.md)
is available as `pbs:example:game:1:production/GUIDE.md`. Its cases and complete
project files are ordinary references from the existing provider/index.
| Scenario | What the example demonstrates |
| --- | --- |
| Visibility | File-private omission, admitted sibling `mod` declarations, external `pub` access and per-signature overload admission. |
| Public API/private helper | A consumer uses public `Box` operations without importing its defining private `Hidden` helper. |
| Shared state | Mutations remain visible through the defining API; service references retain singleton identity; equivalent project spellings share storage. |
| Construction and Init | Direct global construction, private auxiliaries, procedural factories in admitted Init bodies, file/project bootstrap order and one-shot initialization. |
| Boolean effects | All four eager boolean spellings evaluate left then right once for both left values; nested `if` provides a safe guard. |
| Optional/bounds | Vacancy and lazy fallback differ from negative/equal-to-length/empty-array bounds faults. |
| Project addressing | Owning and dependency projects with hyphens, exact escaped names, quoted/plain equivalence, reserved spaces and invalid/unresolved controls. |
| Current SDK | A complete game uses `Gfx.fill_rect` and imports `Color` from `@core:color`, matching the distributed API. |
The `authoring` project keeps construction in the defining state module. It
exports operations instead of asking consumers to construct private implementation
details. A sibling file accesses explicitly admitted globals; a consumer in
another module uses the public API. Global construction produces the private
state, file Init sets the expected trace/count, and project Init observes that
state before the first Frame. Three frames verify that Init does not repeat.
The boolean example records trace 12 from two effectful operands for each spelling
and left value. A false conjunction or true disjunction still executes its right
operand. The deliberately unsafe counterparts fault on array bounds; the nested-if
control completes normally. `values[index] else fallback()` handles `none` at a
valid position, not a trap caused by an invalid access.
## Verify installed inputs and execution separately
`InstalledKnowledgeProbe` extracts the actual candidate reference resources in a
scratch working directory outside the checkout. `ProductionContractsInstalledProbe`
compiles every case, verifies its normative reference IDs and expected diagnostic
code/phase, records unchanged source hashes and emits separate executable
cartridges. It records all 54 installed JAR hashes, actual frontend/pipeline
origins, Java version and the installed SDK catalog identity.
Installed frontend/LSP analysis agrees on the quoted projects. The dependency
case checks navigation into the actual read-only dependency snapshot and a valid
quoted completion label. Read-only navigation uses the existing external-source
registry; the local-only definition projection intentionally filters these sources.
The existing generated-animation fixture also compiles under `zelda-1` and checks
its generated read-only origins.
The maintained `qualify-installed-contracts.py` reuses the original production
runner's headless protocol harness. It rejects a distribution whose JAR hashes
differ from those recorded at compilation, retains PBX/cartridge hashes and
checks process termination. Normal programs contain state/effect assertions;
deliberate bounds cases require exact trap code 3, rather than accepting any fault.
This distinguishes an expected bounds failure from a failed assertion or loader.
## Final qualification
The [qualification report](evidence/qualification.json) and [evidence guide](evidence/README.md)
record the commands, identities, detailed matrices and explicit limits.
| Gate | Result |
| --- | --- |
| Required PBS, build-pipeline, LSP, app and installed suites | 729 recorded tests; 716 passed, 13 pre-existing skips; zero failures/errors. |
| Installed authoring compilation | 21 correctly classified cases: 12 successful compilations and nine expected source rejections. |
| Installed guest behavior | 11 executions: six normal three-frame successes and five exact bounds faults; every worker terminated. |
| Unchanged original production corpus | 168 matching compilation observations and 108 matching guest executions: 104 normal successes and four deliberate faults. |
| Installed knowledge compatibility | Existing spec aliases and compiler/SDK catalog identity retained; 54 product JAR identities recorded. |
The runtime was the existing debug headless executable identified by SHA-256
`a0cb4b16a46634d56ffd7ae5f142017158165f297ddf4925c19da34166482ee6`.
No runtime source, game workspace or memcard was written, and no commit was created.
## Limits and recurring mistakes
- A well-formed unavailable project is a resolver failure, while a malformed or
blank project spelling is a source syntax failure. The current resolver check
`E_LINK_IMPORT_MODULE_NOT_FOUND` is exposed in the existing linking phase.
- Do not restrict all frontend manifest names to hide a PBS grammar limitation,
intern the quote characters, decode escapes twice or duplicate shared storage.
- A parser diagnostic alone is insufficient if recovery later passes an invalid
name into a stricter common constructor. Test the complete compiler path.
- Do not teach helper export, file merging or type renaming as requirements of
the binding/nominal bugs already corrected in [LSN-0106](../DSC-0111-pbs-production-reproductions-and-fixes/LSN-0106-pbs-production-binding-and-lowering-corrections.md).
- Gfx is qualified for installed API compilation. Graphical execution and pixel
output were not tested. This is not installed-runtime distribution qualification.
- The diagnostic explanation schema has no navigable reference-ID field for
these mappings. The installed guide supplies explicit code/rule/example
mappings without schema changes or Studio message inference.
- The selected corpus does not prove every authoring combination. The historical
regression corpus remains unchanged and is independently qualified.
## Maintenance references
Normative source: PBS [3 — Core Syntax](../../../docs/specs/compiler-languages/pbs/3.%20Core%20Syntax%20Specification.md),
[4 — Static Semantics](../../../docs/specs/compiler-languages/pbs/4.%20Static%20Semantics%20Specification.md),
[5 — Manifest/SDK Resolution](../../../docs/specs/compiler-languages/pbs/5.%20Manifest%2C%20Stdlib%2C%20and%20SDK%20Resolution%20Specification.md),
[9 — Dynamic Semantics](../../../docs/specs/compiler-languages/pbs/9.%20Dynamic%20Semantics%20Specification.md),
[12 — Diagnostics](../../../docs/specs/compiler-languages/pbs/12.%20Diagnostics%20Specification.md),
[14 — Typed Arrays/Optional](../../../docs/specs/compiler-languages/pbs/14.%20Typed%20Arrays%20and%20Optional%20Execution%20Specification.md)
and [Compiler 14 — Resolution/Linking](../../../docs/specs/compiler/14.%20Name%20Resolution%20and%20Module%20Linking%20Specification.md).
Reproduction: [production corpus runner guide](../../../../tooling/scripts/pbs-production-corpus/README.md),
[installed expectations](../../../prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/pbs-knowledge/examples/game/1/production/cases.json),
[installed probe](../../../prometeu-app/src/test/java/p/studio/app/compiler/ProductionContractsInstalledProbe.java)
and [quoted-project parser tests](../../../prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/parser/PbsQuotedProjectTest.java).
DEC-0091 and PLN-0169 are completed control artifacts consolidated here; their
workflow files are removed by housekeeping.