Skip to content

Tracking: Architecture / runtime unification #392

Description

@dowdiness

Context

This is the canonical tracker for the architecture / runtime-unification sequence.
Use this issue to track PR order and boundary intent; keep detailed design in
docs/design/architecture-execution-plan-2026-06-12.md and
docs/design/architecture-redesign-2026-06-12.md.

The current architecture pressure is boundary clarity, not a full rewrite:

  • the tree-walker remains the correctness oracle;
  • bytecode is the long-term optimization path, not an independent semantic owner;
  • closure conversion is legacy experimental evidence, not the destination;
  • runtime operations should own observable JavaScript semantics;
  • stdlib/compiler representation access is classified debt to retire over time;
  • mutable state should remain owned by explicit interpreter/realm/host records.

Current baseline — 2026-06-25

Local reconciliation status:

  • make architecture-audit exists and passes.
  • Stage 0 guardrails are implemented: mutable-state audit, import-boundary audit,
    representation-access audit, and surface-taxonomy audit.
  • Current audit baseline:
    • 73 local imports
    • 2 allowlisted import debts
    • 1294 classified representation-access sites
    • 13 generated-interface packages
    • 597 public symbols
    • 12 package-defaulted symbols
  • scripts/architecture_representation_access.json is current as of the
    reconciliation refresh.
  • Bytecode has file-level IR/lowering/VM separation:
    • compiler/bytecode_ir.mbt
    • compiler/bytecode_lower.mbt
    • compiler/bytecode_vm.mbt
  • The bytecode/tree-walker equivalence harness exists in
    compiler/bytecode_test.mbt and unsupported labels are centralized as
    UNSUPPORTED_* constants in compiler/bytecode_ir.mbt.

Interpretation: the 1294 representation-access sites are classified debt, not
a solved boundary. Future architecture PRs should either shrink that number or
explain why it stays stable.

Current architecture PR sequence

Seq PR / Issue Goal Boundary strengthened Status Required validation Audit delta
PR0 #456 Reconcile architecture docs and representation inventory with current repo state Planning / guardrails merged moon check; moon test; make architecture-audit; moon info; moon fmt; git diff --check inventory current; audit passing
PR1 #245 Audit runtime state ownership and keep mutable state realm/host/interpreter-owned State ownership queued moon check; moon test; make architecture-audit state audit remains empty
PR2 #307 / PR #461 Migrate ToLength / ToIndex from Int to Int64 Spec-sized index semantics merged moon check; moon test; focused length/index tests; make architecture-audit; moon info; CI strict/non-strict Test262 shards no accidental boundary growth
PR3 #439 Type environment markers before marker set grows Environment marker ownership conditional moon check; moon test; make architecture-audit; delete-focused Test262 check if touched no new ad-hoc marker strings

Status vocabulary

Use one of:

  • queued
  • active
  • blocked
  • review
  • merged
  • deferred
  • conditional

#439 is intentionally conditional: do it when environment marker call sites
or marker kinds grow enough that string keys become an actual pressure.

Completed / reconciled items from the older tracker

These are no longer next-step blockers:

PR contract

Every PR in this sequence should include:

Architecture sequence: PR N of #392

Boundary strengthened:
- ...

Behavior changes:
- None / intentional: ...

Audit effect:
- import boundary: unchanged / changed
- representation inventory: unchanged / shrank by N / refreshed
- surface taxonomy: unchanged / changed

Validation:
- [ ] moon check
- [ ] moon test
- [ ] make architecture-audit
- [ ] moon info
- [ ] moon fmt
- [ ] git diff --check

Rollback:
- ...

Rules:

  • Prefer behavior-preserving, reversible PRs.
  • Do not combine architecture cleanup with unrelated conformance feature work.
  • Do not expand closure conversion feature coverage except for bug fixes,
    benchmark maintenance, or retirement-support work.
  • If a PR touches bytecode semantics, add or update tree-walker equivalence
    coverage in compiler/bytecode_test.mbt.
  • If a PR changes public/generated surfaces, run moon info and explain the
    .mbti diff.
  • If representation-access debt grows, the PR must justify why and identify the
    retirement stage.

Acceptance criteria for this tracker

This tracking issue can close when:

Notes

  • This tracker is internal architecture work. Conformance numbers should only be
    cited from CI artifacts / make test262-report, not copied from stale prose.
  • The goal is reduced blast radius and clearer ownership, not aesthetic package
    reshuffling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureInternal architecture / unification / cross-cutting refactorenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions