prometeu-runtime/docs/specs/pbs/files/PRs para Junie.md
Nilton Constantino f80cb64f66
pr 58
2026-02-02 16:31:06 +00:00

2.5 KiB

Why: The compiler must emit a single closed-world executable blob.

Scope

  • Move all link responsibilities to prometeu_compiler:

    • Input: Vec<CompiledModule> (in build-plan order)
    • Output: ProgramImage (single PBS v0 bytecode blob)
  • Linker responsibilities (v0):

    • resolve imports to exports across modules
    • validate symbol visibility (pub only)
    • assign final FunctionTable indices
    • patch CALL opcodes to final func_id
    • merge constant pools deterministically
    • emit final PBS v0 image

Deliverables

  • link(modules) -> Result<ProgramImage, LinkError>

  • LinkError variants:

    • unresolved import
    • duplicate export
    • incompatible symbol signature (if available)

Tests

  • archive-pbs/test01 as integration test:

    • root depends on a lib
    • root calls into lib
    • final blob runs successfully in VM

Acceptance

  • Compiler emits a single executable blob; VM performs no linking.

PR-16 — VM Boundary Cleanup: remove linker behavior from runtime

Why: Runtime must be dumb and deterministic.

Scope

  • Audit prometeu_core and prometeu_bytecode:

    • VM loads PBS v0 module
    • VM verifies (optional) and executes
  • Remove or disable any linker-like behavior in runtime:

    • no dependency resolution
    • no symbol lookup by name
    • no module graph assumptions

Deliverables

  • VM init path uses:

    • BytecodeLoader::load()(code, const_pool, functions)
    • verifier as an execution gate

Tests

  • runtime loads and executes compiler-produced blob

Acceptance

  • Linking is fully compiler-owned.

PR-17 — Diagnostics UX: dependency graph and resolution trace

Why: Dependency failures must be explainable.

Scope

  • Add compiler diagnostics output:

    • resolved dependency graph
    • alias → project mapping
    • explanation of conflicts or failures
  • Add CLI/API flag:

    • --explain-deps

Deliverables

  • human-readable resolution trace

Tests

  • snapshot tests for diagnostics output (best-effort)

Acceptance

  • Users can debug dependency and linking issues without guesswork.

Suggested Execution Order

  1. PR-09 → PR-10 → PR-11
  2. PR-12 → PR-13
  3. PR-14 → PR-15
  4. PR-16 → PR-17

Notes for Junie

  • Keep all v0 decisions simple and deterministic.
  • Prefer explicit errors over silent fallback.
  • Treat archive-pbs/test01 as the north-star integration scenario.
  • No background work: every PR must include tests proving behavior.