Skip to content

Check for dead code in CI - #9246

Open
cknitt wants to merge 3 commits into
prune-flow-parserfrom
dead-code-ci
Open

cknitt wants to merge 3 commits into
prune-flow-parserfrom
dead-code-ci

Conversation

@cknitt

@cknitt cknitt commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Stacked on #9208. Runs make dead-code in CI, so new dead code in the OCaml sources fails the build.

The check runs in the build-compiler job entry that builds the playground (ubuntu-26.04-arm, build_playground: true), right after the playground build. That entry has the browser-profile dependencies the check needs: it analyzes the native and the browser build trees together, so code used only by the playground counts as live.

It needs reanalyze 2.27.0, the first release that can analyze both trees together. The step clones the v2.27.0 tag, builds reanalyze with dune in the job's existing switch (seconds), and passes it to make dead-code through REANALYZE:

git -c advice.detachedHead=false clone --quiet --depth 1 --branch v2.27.0 https://github.com/rescript-lang/reanalyze.git "$RUNNER_TEMP/reanalyze"
opam exec -- sh -c 'cd "$RUNNER_TEMP/reanalyze" && dune build -p reanalyze @install'
REANALYZE="$RUNNER_TEMP/reanalyze/_build/install/default/bin/reanalyze.exe" opam exec -- make dead-code

Why not opam install reanalyze? The first version of this PR tried that. opam recompiled the whole restored switch (62 packages, about 4 minutes), because it misses the musl system package of the static switch and treats that as a system change. Building from the tag avoids touching the switch. (opam exec runs from the repository because the CI switch is local to it.) It also doesn't wait for the opam package (ocaml/opam-repository#31123), and works the same once that's published.

On this stack, make dead-code reports 0 issues with reanalyze 2.27.0, locally and in CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT

@cknitt
cknitt added this pull request to stack #9209 November 6, 2026 20:53
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Changelog

🏠 Internal

  • Check in CI that reanalyze reports no dead code in the OCaml sources.

Semantic Diff

3 commits · Full page

Check for dead code in CI

6d640de · cknitt + Claude · Nov 06, 2026, 20:53 UTC

The build-compiler job that builds the playground now runs make dead-code after the playground build, so new dead code fails CI. It installs reanalyze 2.27.0, the first release that analyzes the native and the browser build trees together, from its tag until the opam-repository package is merged.

Build reanalyze from its tag instead of installing it with opam

102f322 · cknitt + Claude · Nov 06, 2026, 21:27 UTC

In CI, opam install reanalyze recompiled the whole restored switch (62 packages, about 4 minutes): opam misses the musl system package of the static switch and treats that as a system change. The step now clones the v2.27.0 tag and builds reanalyze with dune in the existing switch (seconds), and passes it to make dead-code with REANALYZE. This also works unchanged once the opam package is published.

✨ Run opam exec from the repository when building reanalyze

2f2adec · cknitt + Claude · Nov 06, 2026, 21:40 UTC · new

CI's opam switch is local to the repository, and opam exec finds it from the current directory: run from inside the reanalyze clone it failed with "No switch is currently set". opam exec now runs from the repository and changes into the clone itself.

The build-compiler job that builds the playground now runs make dead-code
after the playground build, so new dead code fails CI. It installs
reanalyze 2.27.0, the first release that analyzes the native and the
browser build trees together, from its tag until the opam-repository
package is merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
@pkg-pr-new

pkg-pr-new Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9246

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9246

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9246

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9246

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9246

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9246

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9246

commit: 2f2adec

cknitt and others added 2 commits November 6, 2026 21:27
In CI, opam install reanalyze recompiled the whole restored switch (62
packages, about 4 minutes): opam misses the musl system package of the
static switch and treats that as a system change. The step now clones
the v2.27.0 tag and builds reanalyze with dune in the existing switch
(seconds), and passes it to make dead-code with REANALYZE. This also
works unchanged once the opam package is published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
CI's opam switch is local to the repository, and opam exec finds it from
the current directory: run from inside the reanalyze clone it failed
with "No switch is currently set". opam exec now runs from the
repository and changes into the clone itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt

cknitt commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T06:08:14.020114Z 2f2adec Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 2f2adec1af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cknitt
cknitt marked this pull request as ready for review November 7, 2026 06:16
@cknitt
cknitt requested a review from cristianoc November 7, 2026 06:16

This branch has not been deployed

No deployments
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