Skip to content

Set up haxelib and the test libraries in agent-setup.sh - #13131

Merged
Simn merged 3 commits into
developmentfrom
claude/agent-setup-haxelib
Nov 3, 2026
Merged

Simn merged 3 commits into
developmentfrom
claude/agent-setup-haxelib

Conversation

@Simn

@Simn Simn commented Nov 3, 2026

Copy link
Copy Markdown
Member

Agents in fresh containers could build the compiler with extra/agent-setup.sh, but they couldn't run the unit tests: haxelib wasn't built and utest wasn't installed, so -lib utest failed. The old Copilot workflow did these steps itself; this PR moves them into the script so every agent environment gets them.

Changes

extra/agent-setup.sh gets a haxelib phase. It's on by default; --no-haxelib skips it, and so does --no-build.

  • Runs git submodule update --init --recursive and make haxelib. Neko comes from the apt packages the script already installs (neko neko-dev).
  • Links haxe and haxelib into /usr/local/bin, or $HAXELIB_BIN_DIR if set. Both have to be on PATH: the compiler runs haxelib from PATH for -lib (src/compiler/highLevel.ml), and haxelib path in turn runs haxe from PATH. Without the haxe link it fails with "Cannot get haxe version".
  • Runs haxelib setup ~/haxelib (or $HAXELIB_REPO) if no repository is configured yet.
  • Installs the libraries from the old Copilot list from git: utest, hxnodejs, hxcoro, hxcpp, hxjava and haxeserver. Then it bootstraps hxcpp.
  • Re-runs skip libraries that are already installed, and skip the hxcpp bootstrap once hxcpp.n exists.

The opam block now goes at the top of ~/.bashrc and ~/.profile. Ubuntu's default ~/.bashrc returns early in non-interactive shells ([ -z "$PS1" ] && return), so the block the script appended at the end never reached the shells agents run commands in, and dune or opam weren't found. If an older version of the script appended the block, re-running moves it to the top.

copilot-setup-steps.yml now calls agent-setup.sh --no-apt --no-profile instead of repeating the build and haxelib steps, so the library list lives only in the script. It keeps the setup-neko action. It drops the STATICLINK=1 build, make package_unix and the ldd checks.

AGENTS.md is updated to match.

Testing

Done in a Claude Code cloud container (Ubuntu, running as root), with the script run against a temporary HOME:

  • A fresh run took about 15s for the haxelib phase, including the hxcpp bootstrap. A second run skipped everything already installed.
  • With PATH limited to the bin dir plus /usr/bin:/bin, haxe --cwd tests/unit compile-macro.hxml passes: ALL TESTS OK.
  • The migration starting from this container's real .bashrc/.profile (block appended at the end) leaves exactly one block at the top and doesn't change the rest of the file. bash -c 'source ~/.bashrc' with no PS1 set picks up OPAMROOT, dune and haxelib.
  • The non-root sudo path is exercised only by the Copilot Setup Steps run on this branch, which hadn't finished when this PR was opened.

Generated by Claude Code

Agents in fresh containers could build the compiler but not run the
unit tests, because haxelib and utest were missing. agent-setup.sh now
also builds haxelib, links haxe and haxelib into /usr/local/bin (-lib
runs haxelib from PATH, which runs haxe from PATH), sets up a haxelib
repository and installs the libraries the tests use, bootstrapping
hxcpp. Re-runs skip what is already installed; --no-haxelib skips it.

The opam block now goes at the top of ~/.bashrc and ~/.profile: the
default Ubuntu ~/.bashrc returns early in non-interactive shells, so
the appended block never reached the shells agents run commands in.
A block appended by the previous version is moved.

The Copilot setup workflow now relies on the script for this instead
of duplicating the steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Va4FXD77Wkx2gP2orXUPv1

Simn commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

mac-test (hl, x86_64, macos-15-intel) fails here in unit.TestBasetypes.testInt64Map, line 286:

expected "12884901893#-8589934597" but it is "-8589934597#12884901893"

This failure doesn't come from this PR. Development's own CI run on the base commit 234c1a6 (run 41638638166) fails the same way in the same job, and that is the only failing job in that run. This PR only changes extra/agent-setup.sh, the Copilot setup workflow and AGENTS.md, and the main CI uses none of them.

The assertion sorts the two Int64 keys with Reflect.compare and gets them in the wrong order. So it looks like an Int64 comparison problem in the HashLink bytecode run on macOS Intel; HL/C passes in the same job. There's no fix for it on development yet, so there's nothing to port into this PR.


Generated by Claude Code

…rectory

The haxelib phase used ln -sf, which silently replaced whatever was at
/usr/local/bin/haxe and /usr/local/bin/haxelib, including a real Haxe
installation on a developer's machine. It now only creates the links
where nothing exists yet or replaces links into a Haxe checkout (another
worktree or an earlier run, which it logs), and otherwise warns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Va4FXDYunkfcakJ5BFq4hq
@Simn
Simn merged commit 464ed12 into development Nov 3, 2026
63 checks passed
@Simn
Simn deleted the claude/agent-setup-haxelib branch November 3, 2026 15:21
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.

2 participants