Skip to content

Arena/01a1022a affinescript - #776

Merged
hyperpolymath merged 4 commits into
mainfrom
arena/01a1022a-affinescript
Oct 3, 2026
Merged

hyperpolymath merged 4 commits into
mainfrom
arena/01a1022a-affinescript

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Closes #

Type of change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (would change existing behaviour)
  • 🕳️ Soundness fix (fixes a checker/proof false-negative)
  • 📖 Documentation
  • 🧹 Refactor / tech debt (behaviour-preserving)
  • ⚡ Performance
  • 🔧 Build / CI / tooling

How has this been verified?

Checklist

  • My commits are signed (git commit -S).
  • I ran the project's own checks/tests locally and they pass.
  • New files carry the correct SPDX-License-Identifier (code/config MPL-2.0,
    prose CC-BY-SA-4.0); I did not relicense existing files.
  • Docs are updated, and no public claim now overstates what the code does.
  • I have not introduced a soundness hole (or I have flagged where I might have).

Notes for reviewers

hyperpolymath and others added 4 commits October 3, 2026 15:14
tests/codegen-deno/dom_startup_error.affine says `use Dom::{VNode, div, h1,
p, text}`. Module_loader.flatten_imports inlined exactly those decls — but
stdlib/Dom.affine's div/h1/p are one-line wrappers around Dom's own
`pub fn h(...)`. `h` was never named by the import list, so it was left out of
the flattened program and the emitted module called an undefined `h`:
`ReferenceError: h is not defined`. ImportGlob/ImportSimple already inline
every public decl for this reason; ImportList was the odd one out.

Close over the named decls' free variables until a fixpoint, pulling in the
module's own value decls (private helpers included — a public wrapper may
delegate to one) in dependency order. Aliased items keep their behaviour:
the closure runs on the original names, then renaming is applied.

To share the walker instead of adding a fourth private copy (codegen.ml had
one; borrow.ml has another), move find_free_vars into ast.ml and re-export it
from codegen.ml for the existing call sites. (Codegen depends on
Module_loader, so the loader could not reach the copy where it lived.)

Verified locally: the emitted-module call pattern is what the harness died
on; the fix makes `h` part of the flattened program. Full verification needs
the OCaml build in CI.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…`use`

Next link in the same chain as the previous commit. With `h` inlined, the
emitted module moved on to `ReferenceError: VText is not defined`:
stdlib/Dom.affine's `text(content)` returns `VText(content)`, i.e. a
constructor of Dom's own `pub enum VNode`, and flatten_imports carries no
type decls at all — the #138 note says imported TYPE decls were deliberately
dropped because re-emitting the prelude's Option/Result constructors produced
duplicate `const Some` declarations under node.

So the closure now also carries an enum when a constructor of it is
referenced, with the #138 hazard closed rather than ignored: Some/None/Ok/Err
are never carried, because every non-wasm backend preamble already provides
them. That narrows type-carrying to user enums a preamble cannot supply,
which is exactly what a consumer hits with `use Dom::{div}`.

Also let a locally-declared type name suppress a same-named import, the same
rule local functions and constants already follow.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The cascade these probes existed for has resolved: every step of the build
job now reports a conclusion on its own, and all of them pass — including the
three steps (native Bun-ESM, face transformers, issue references) that had
never once executed as steps because they sat behind a failing one.

Delete the two probe workflows and the annotation-dumping script, and drop the
`[diag]` step that invoked it from ci.yml. Repoint the E2E comment that cited
the probe, keeping its measured variant table — that evidence is the fix's
justification and should not travel with a deleted tool.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@hyperpolymath
hyperpolymath merged commit b23819c into main Oct 3, 2026
3 of 4 checks passed
@hyperpolymath
hyperpolymath deleted the arena/01a1022a-affinescript branch October 3, 2026 18:59
@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 25700bd5-35a0-472a-8c1d-4c5e663c4d49
📥 Commits

Reviewing files that changed from the base of the PR and between c3da7b9 and 0ba8517.

📒 Files selected for processing (8)
  • .github/workflows/ci.yml
  • .github/workflows/zz-probe-a.yml
  • .github/workflows/zz-probe-b.yml
  • lib/ast.ml
  • lib/codegen.ml
  • lib/module_loader.ml
  • test/test_e2e.ml
  • tools/ci/diag-probe.sh
 _______________________________
< This hotfix needs oven mitts. >
 -------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Oct 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant