Skip to content

Migrate from Spago 0.21.0 to Spago 1.0.3#63

Closed
FranklinChen wants to merge 1 commit intoexercism:mainfrom
FranklinChen:migrate-spago-v1
Closed

Migrate from Spago 0.21.0 to Spago 1.0.3#63
FranklinChen wants to merge 1 commit intoexercism:mainfrom
FranklinChen:migrate-spago-v1

Conversation

@FranklinChen
Copy link
Contributor

Summary

  • Migrate from Spago 0.21.0 (Dhall config) to Spago 1.0.3 (YAML + Registry package set 73.0.0)
  • Upgrade Docker base image from node:20-bullseye-slim to node:22-bookworm-slim (Spago 1.0.3 requires Node.js >= 22.5.0 for node:sqlite)
  • Rewrite bin/run.sh for Spago 1.0 compatibility in Docker's --read-only --network none environment
  • Regenerate expected_results.json for all 5 test examples with Spago 1.0 output format

Details

Docker changes

  • Node.js 22: Spago 1.0.3 uses the node:sqlite built-in module, requiring Node.js >= 22.5.0
  • npm cache cleanup: Added npm cache clean --force to reduce image size
  • Documented dependencies: Each apt package now has a comment explaining why it's needed

run.sh changes

  • Package name rewriting: Exercise spago.yaml has its package name rewritten to "pre-compiled" to match the pre-compiled lockfile, enabling --pure mode (no registry access needed)
  • HOME=/tmp: Spago's SQLite cache needs a writable directory; Docker runs with --read-only so we redirect HOME to the tmpfs mount
  • --offline --pure: Fully sandboxed execution with no network or registry access
  • Output sanitization: Updated for Spago 1.0 output format — strips new preamble lines, build summary table, JavaScript stack traces from test failures

Configuration

  • spago.yaml replaces spago.dhall + packages.dhall in pre-compiled/ and all test examples
  • Uses registry-based package set 73.0.0 (for PureScript >=0.15.15 <0.16.0)

Companion PR

Requires companion PR in exercism/purescript (will link once created).

Test plan

  • All 5 Docker test examples pass (bin/run-tests-in-docker.sh)
    • example-success: correct pass result
    • example-all-fail: clean error output without stack traces
    • example-partial-fail: mixed pass/fail output
    • example-syntax-error: compiler error message preserved
    • example-empty-file: compiler error message preserved
  • Docker image builds successfully with --platform linux/amd64
  • Tests run correctly with --network none --read-only constraints

🤖 Generated with Claude Code

Replace Dhall configuration with spago.yaml using registry-based package
set 73.0.0. Update Docker image and test runner for Spago 1.0 compatibility.

Key changes:
- Dockerfile: node:22-bookworm-slim (Spago 1.0.3 needs node:sqlite),
  documented dependencies, npm cache cleanup
- bin/run.sh: rewrite package name to match pre-compiled lockfile for
  --offline --pure mode, HOME=/tmp for read-only Docker, sanitize
  Spago 1.0 output (strip stack traces, new preamble format)
- pre-compiled: spago.yaml replaces dhall files
- Test examples: spago.yaml, regenerated expected_results.json

Companion PR needed in exercism/purescript.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FranklinChen FranklinChen requested a review from a team as a code owner February 9, 2026 04:57
Copilot AI review requested due to automatic review settings February 9, 2026 04:57
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Hello 👋 Thanks for your PR.

This repo does not currently have dedicated maintainers. Our guardians team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed.

If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track.

Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum.

(cc @exercism/guardians)

@FranklinChen
Copy link
Contributor Author

Companion track PR: exercism/purescript#322

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the PureScript test-runner tooling from Spago 0.21 (Dhall) to Spago 1.0.3 (YAML + Registry package set), updating the Docker runtime and runner scripts to support fully sandboxed execution.

Changes:

  • Replace spago.dhall/packages.dhall with spago.yaml across pre-compiled/ and all test examples (registry package set 73.0.0).
  • Update Docker image to Node 22 (bookworm) and adjust build steps for Spago 1.
  • Update runner scripts/output sanitization and regenerate expected test outputs for Spago 1 formatting.

Reviewed changes

Copilot reviewed 25 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Dockerfile Switch to Node 22 image; update dependency installation and precompiled project install step.
.dockerignore Update ignored precompiled artifacts list for Docker build context.
bin/run.sh Update runner to Spago 1 workflow (spago.yaml, --offline --pure, lockfile usage) and revise output sanitization.
bin/run-tests.sh Update test harness to discover spago.yaml projects instead of spago.dhall.
bin/update-tests.sh Reword script intent for YAML-based configs (currently no-op).
pre-compiled/spago.yaml New Spago 1 YAML config for the precompiled dependency workspace.
pre-compiled/spago.dhall Remove legacy Dhall config.
pre-compiled/packages.dhall Remove legacy package-set Dhall reference.
pre-compiled/package.json Bump spago devDependency to ^1.0.3.
tests/example-all-fail/spago.yaml New Spago 1 YAML config for the test example.
tests/example-all-fail/spago.dhall Remove legacy Dhall config.
tests/example-all-fail/packages.dhall Remove legacy package-set Dhall reference.
tests/example-all-fail/expected_results.json Update expected failure output to match Spago 1 sanitized output.
tests/example-partial-fail/spago.yaml New Spago 1 YAML config for the test example.
tests/example-partial-fail/spago.dhall Remove legacy Dhall config.
tests/example-partial-fail/packages.dhall Remove legacy package-set Dhall reference.
tests/example-partial-fail/expected_results.json Update expected failure output to match Spago 1 sanitized output.
tests/example-syntax-error/spago.yaml New Spago 1 YAML config for the test example.
tests/example-syntax-error/spago.dhall Remove legacy Dhall config.
tests/example-syntax-error/packages.dhall Remove legacy package-set Dhall reference.
tests/example-syntax-error/expected_results.json Update expected compiler error output to match Spago 1 formatting.
tests/example-empty-file/spago.yaml New Spago 1 YAML config for the test example.
tests/example-empty-file/spago.dhall Remove legacy Dhall config.
tests/example-empty-file/packages.dhall Remove legacy package-set Dhall reference.
tests/example-empty-file/expected_results.json Update expected compiler error output to match Spago 1 formatting.
tests/example-success/spago.yaml New Spago 1 YAML config for the test example.
tests/example-success/spago.dhall Remove legacy Dhall config.
tests/example-success/packages.dhall Remove legacy package-set Dhall reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

COPY pre-compiled pre-compiled/
RUN cd pre-compiled \
&& npm install \
&& npx spago install \
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dockerfile comment says dependencies are “pre-compiled” and runtime reuses pre-compiled/output and pre-compiled/.spago, but the build stage now only runs npx spago install. If spago install doesn’t produce output/, the runtime cp -R -p pre-compiled/output in bin/run.sh will fail and you’ll lose the intended cache/precompile behavior (or potentially fail in stricter shells). Consider adding an explicit dependency build step (e.g., Spago’s deps-only build) or otherwise ensuring output/ is generated during image build.

Suggested change
&& npx spago install \
&& npx spago install \
&& npx spago build --deps-only \

Copilot uses AI. Check for mistakes.
@FranklinChen
Copy link
Contributor Author

Companion track PR: exercism/purescript#323 (replaces #322)

@FranklinChen
Copy link
Contributor Author

# sed -e "s/pre-compiled/${slug}/" < "${project_dir}/spago.dhall" > "${exercise_dir}/spago.dhall"
cp "${project_dir}/packages.dhall" "${exercise_dir}/packages.dhall"
# Test examples use a minimal dependency set, not the full pre-compiled one.
# Only update if the test's spago.yaml workspace section needs to change.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this loop supposed to do anything?

@IsaacG
Copy link
Member

IsaacG commented Feb 9, 2026

This PR cannot be reopened as it was force pushed

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

Comments