Migrate test toolchain to the new Spago (spago.yaml + registry)#114
Merged
Conversation
Swap the dev-shell spago pin from legacy 0.21.0 to the overlay's 1.0.4 and migrate test/ps from spago.dhall/packages.dhall to spago.yaml + spago.lock. The package set is a registry baseline (pure packages) plus extraPackages git overrides for the Lua FFI forks, mirroring the old upstream-ps // upstream-lua Dhall set where the forks won. - flake.nix: spago-bin.spago-0_21_0 -> spago-bin.spago-1_0_4 (purs unchanged) - test/ps/spago.yaml: registry 77.8.0 baseline + git overrides for the purescript-lua/* forks (current tags, deps inlined since the forks lack their own spago.yaml). A no-op backend (cmd: "true") makes spago emit CoreFn: the new spago manages codegen itself and rejects --codegen in --purs-args. - test/ps/spago.lock: committed for reproducible golden inputs. - move golden sources golden/ -> src/ (the new spago only globs src/ and test/); .lua FFI files stay co-located next to each .purs so foreign resolution works. - Golden/Spec.hs: build command "spago build -u '-g corefn'" -> "spago build". - regenerate goldens: golden.lua is byte-identical (same fork versions), only corefn.json modulePath and golden.ir .spago/p/<hash> paths churn; the eval/golden.txt oracles are untouched and stay green (314/0). - docs: CLAUDE.md + GOLDEN_TESTING.md (spago.yaml, build cmd, src/ paths, PSLUA_GOLDEN_ACCEPT regeneration instead of golden_reset). Out of scope (separate follow-ups): adding spago.yaml to the fork repos, registering pslua as a first-class spago backend, and the README backend example. Closes #55
There was a problem hiding this comment.
Pull request overview
Migrates the PureScript golden-test project (test/ps) from legacy Dhall-based Spago to the PureScript Spago toolchain (spago.yaml + registry + spago.lock), aligning the harness and repository docs with the new build behavior and source layout.
Changes:
- Bump the dev-shell Spago pin to
spago-bin.spago-1_0_4and switch the test project config totest/ps/spago.yaml(registry baseline +extraPackagesfork overrides + no-op backend for CoreFn emission). - Relocate golden PureScript sources under
test/ps/src/(Spago 1.x globbing) and update the golden harness to runspago build. - Regenerate/adjust committed golden artifacts (
corefn.json,golden.ir, etc.) to reflect the new source paths and.spago/p/...layout; update docs accordingly.
Reviewed changes
Copilot reviewed 77 out of 147 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| flake.nix | Bumps pinned Spago in the dev shell to the PureScript Spago release used by the migrated test project. |
| test/ps/spago.yaml | New Spago 1.x configuration: registry package set + Lua fork overrides + no-op backend to force CoreFn output. |
| test/ps/spago.dhall | Removes legacy Dhall Spago project config. |
| test/ps/packages.dhall | Removes legacy Dhall package-set composition (upstream-ps // upstream-lua). |
| test/Language/PureScript/Backend/Lua/Golden/Spec.hs | Updates harness compilation step to spago build (Spago 1.x workflow). |
| lib/Language/PureScript/Backend/IR/Types.hs | Updates comment references to the new test/ps/src/... golden source location. |
| docs/GOLDEN_TESTING.md | Updates golden-testing documentation for src/ layout and new Spago/CoreFn behavior. |
| CLAUDE.md | Updates contributor docs for Spago 1.x, spago.yaml/lockfile usage, and golden regeneration workflow. |
| test/ps/src/Golden/Values/Test.purs | Golden input source now under src/ for Spago 1.x globbing. |
| test/ps/src/Golden/Unbinding/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/TailRecM2Shadow/Test.purs | Golden regression module added under src/. |
| test/ps/src/Golden/StringCodePoints/Test.purs | Adds an end-to-end CodePoints golden under src/ targeting registry + forked strings. |
| test/ps/src/Golden/ReturnTableField/Test.purs | Golden module under src/ for foreign-import table-field behavior. |
| test/ps/src/Golden/ReturnTableField/Test.lua | Co-located Lua FFI file under src/ to preserve foreign resolution behavior. |
| test/ps/src/Golden/Reexport/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/Reexport/ReExports.purs | Golden input source now under src/. |
| test/ps/src/Golden/Reexport/Exports.purs | Golden input source now under src/. |
| test/ps/src/Golden/RecursiveBindings/Test.purs | Golden input source now under src/ (includes explanatory comments). |
| test/ps/src/Golden/RecordsUpdate/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/RecordsAccess/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/RecDataDefs/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/ProfunctorDictLens/Test.purs | Golden input source now under src/ for dictionary-lambda regression coverage. |
| test/ps/src/Golden/PatternMatching/Test2.purs | Golden input source now under src/. |
| test/ps/src/Golden/PatternMatching/Test1.purs | Golden input source now under src/. |
| test/ps/src/Golden/Newtype/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/Nested/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/NameShadowing/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/MaybeChainModule/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/MaybeChain/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/LongWriterBind/Test.purs | Golden input source now under src/ (stress test for deep binds). |
| test/ps/src/Golden/LongStateBind/Test.purs | Golden input source now under src/ (stress test for deep binds). |
| test/ps/src/Golden/LongStackBind/Test.purs | Golden input source now under src/ (stress test for deep binds). |
| test/ps/src/Golden/LongReaderBind/Test.purs | Golden input source now under src/ (stress test for deep binds). |
| test/ps/src/Golden/LongDoBlock/Test.purs | Golden input source now under src/ (large do-block stress case). |
| test/ps/src/Golden/LongBindFlipped/Test.purs | Golden input source now under src/ (deep bind-flipped chain stress). |
| test/ps/src/Golden/LongApplyChain/Test.purs | Golden input source now under src/ (deep applicative chain stress). |
| test/ps/src/Golden/Issue37/Test.purs | Golden input source now under src/ for issue #37 repro. |
| test/ps/src/Golden/Inline/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/HelloPrelude/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/GenericEqTwoTypes/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/Foreign/Test.purs | Golden input source now under src/ (foreign vs local binding behavior). |
| test/ps/src/Golden/Foreign/Test.lua | Co-located Lua FFI under src/. |
| test/ps/src/Golden/Foreign/Lib.purs | Golden input source now under src/ (foreign imports). |
| test/ps/src/Golden/Foreign/Lib.lua | Co-located Lua FFI under src/. |
| test/ps/src/Golden/Fibonacci/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/DerivedFunctor/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/DataDeclarations/Test2.purs | Golden input source now under src/. |
| test/ps/src/Golden/DataDeclarations/Test1.purs | Golden input source now under src/. |
| test/ps/src/Golden/Currying/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/CharLiterals/Test.purs | Golden input source now under src/ (char escaping regression coverage). |
| test/ps/src/Golden/CaseStatements/Test.purs | Golden input source now under src/ (case/guard lowering coverage). |
| test/ps/src/Golden/BugListGenericEq/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/Bug1/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/Beta/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/ArrayPatternMatch/Test.purs | Golden input source now under src/ (array pattern binder indexing regression). |
| test/ps/src/Golden/ArrayOfUnits/Test.purs | Golden input source now under src/. |
| test/ps/src/Golden/Annotations/M2.purs | Golden input source now under src/ (annotation/inline behavior). |
| test/ps/src/Golden/Annotations/M1.purs | Golden input source now under src/ (annotation/inline behavior). |
| test/ps/src/Golden/Annotations/M1.lua | Co-located Lua FFI under src/. |
| test/ps/output/Golden.Values.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Unbinding.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.TestReturnTableField/golden.ir | Updates IR source path from golden/ to src/. |
| test/ps/output/Golden.TestReturnTableField/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir | Updates IR .spago/... paths to the new .spago/p/<pkg>/<commit>/... layout. |
| test/ps/output/Golden.Reexport.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Reexport.ReExports/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Reexport.Exports/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.RecordsUpdate.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.RecordsAccess.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.RecDataDefs.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.Newtype.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Nested.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.MaybeChain.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongWriterBind.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongStateBind.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongStackBind.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongReaderBind.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongMaybeBindModule.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongMaybeBind.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongExceptBind.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongEitherBind.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongDoBlock.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongCallbackChain.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongBindFlipped.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.LongApplyChain.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.Issue37.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.Inline.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.HelloPrelude.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.HelloPrelude.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.Foreign.Test/golden.ir | Updates IR source paths from golden/ to src/. |
| test/ps/output/Golden.Foreign.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Foreign.Lib/golden.ir | Updates IR source paths from golden/ to src/. |
| test/ps/output/Golden.Foreign.Lib/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Fibonacci.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.DerivedFunctor.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.DataDeclarations.Test2/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.DataDeclarations.Test1/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Currying.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.CharLiterals.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.BugListGenericEq.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.Bug1.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Beta.Test/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.ArrayOfUnits.Test/golden.ir | Updates IR .spago/... paths to .spago/p/... layout. |
| test/ps/output/Golden.Annotations.M2/golden.ir | Updates IR source paths from golden/ to src/. |
| test/ps/output/Golden.Annotations.M2/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
| test/ps/output/Golden.Annotations.M1/golden.ir | Updates IR source paths from golden/ to src/. |
| test/ps/output/Golden.Annotations.M1/corefn.json | Updates committed CoreFn modulePath from golden/ to src/. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #55. Builds on #54 (toolchain provider → purescript-overlay).
Migrates the test-project toolchain from the legacy Haskell spago (0.21.0, Dhall) to the new PureScript spago (1.0.4,
spago.yaml+ registry +spago.lock). This is the interim migration that lands the test project; the broader follow-ups (addingspago.yamlto the fork repos, registeringpsluaas a first-class spago backend, the README backend example) are intentionally out of scope, per the issue's own recommendation.What changed
spago-bin.spago-0_21_0→spago-bin.spago-1_0_4.pursstays 0.15.16, so the compiler that stampsbuiltWithis unchanged.registry: 77.8.0baseline (pure, no-FFI packages) plusextraPackagesgit overrides for every FFI-bearing Lua fork (purescript-lua/purescript-lua-*, current tags), with dependency lists inlined and mirrored from the Lua package set'spackages.dhall. This replaces the oldupstream-ps // upstream-luaDhall set where the forks won. No registry set is built forpurs0.15.16, so the baseline uses the latest 0.15.15 set — the same proven-compatible pairing the old Dhall set used.backend: { cmd: "true" }. The new spago manages codegen itself and rejects--codegenin--purs-args; declaring a backend is the supported way to make it emit CoreFn (--codegen corefn), which is all the harness needs. This also sidesteps the corefn-staleness bug (spago build didn't update corefn in output directory purescript/spago#643).src/andtest/, so the golden sources move undersrc/. The.luaFFI files stay co-located next to each.purs, so the harness's foreign resolution (which searches next to the source file) keeps working.spago build -u '-g corefn'→spago build.spago.yaml, the new build command, thesrc/layout, andPSLUA_GOLDEN_ACCEPTas the safe regeneration path (note:golden_resetdestroys the hand-verifiedeval/golden.txtoracle).Why PR #41 was incomplete
PR #41 added a
spago.yamlbut left the sources undergolden/, so the new spago compiled zero project modules and the harness silently read stale committedcorefn.json. Verified here: withoutsrc/, a clean build emits 0 Golden corefn out of 211. Relocating the sources is the fix #41 missed. #41 also used outdatedUnisay/*fork URLs (the forks now live underpurescript-lua/*) and ignoredspago.lock.Verification
golden.luais byte-identical (0 of 52 changed) — the generated Lua is unchanged because the migration preserves the exact same fork versions. Onlycorefn.jsonmodulePath(golden/→src/) andgolden.irlibrary paths (.spago/<pkg>/<ver>/→.spago/p/<pkg>/<commit-hash>/) churn.eval/golden.txtoracles are untouched and pass — semantics preserved across the package-set move.PSLUA_GOLDEN_ACCEPT=1(regeneration) and without it (at-rest, CI-equivalent): 314 examples, 0 failures.