Skip to content

Update the deps and conform to the latest architecture spec#5

Closed
nikita-volkov wants to merge 9 commits into
masterfrom
modernize
Closed

Update the deps and conform to the latest architecture spec#5
nikita-volkov wants to merge 9 commits into
masterfrom
modernize

Conversation

@nikita-volkov

Copy link
Copy Markdown
Collaborator

This brings the code in conformance to the same patterns as the other gens have.

The gen architecture spec: https://github.com/pgenie-io/gen-sdk/blob/master/docs/generator-architecture.md

….Sigs

Pins gen/Deps/Contract.dhall (new) and bumps gen/Deps/Sdk.dhall to gen-sdk
v2.0.0, removing the gen/Deps/package.dhall barrel. Rewires
Structures/CustomKind.dhall and all 11 Interpreters/*.dhall plus all 10
Templates/*.dhall to import Lude/Prelude/Contract/Sdk directly instead of
through the barrel, replacing the local gen/Algebras/{Interpreter,Template}
sig-constructors with gen-sdk's Sdk.Sigs.interpreter / Sdk.Sigs.template
(now deleted). Matches the shape java.gen's current release already uses.

Query.dhall, Result.dhall, and ResultColumns.dhall keep their pre-existing
bare-export shape (like Member.dhall/ParamsMember.dhall) instead of adopting
Sdk.Sigs.interpreter: their `run` functions take 3/4 curried arguments
(config, lookup, [rowClassName], input), which doesn't fit Sigs.interpreter's
fixed 2-argument Config -> Input -> Result shape. This extends the
Member/ParamsMember exception already called out in the migration plan to
these three files, confirmed against their actual call sites in
Project.dhall/Query.dhall.

gen/compile.dhall and gen/Gen.dhall still reference the removed barrel and
are intentionally left broken until the next task rewrites the root entry
point (Config.dhall/compile.dhall -> Interpret.dhall, Gen.dhall ->
package.dhall).
….dhall

Task 4 of the Dhall dependency/layout migration: consumes
Interpreters/Project.dhall's Sdk.Sigs.interpreter-shaped run and produces
the Sdk.Sigs.generator-built entry point, now that the Deps barrel is gone
(Tasks 1-3).

- gen/compile.dhall -> gen/Interpret.dhall: drops the outer Optional Config
  unwrap (Sdk.Sigs.generator substitutes defaultConfig for the omitted-block
  case), keeps the per-field Prelude.Optional.fold defaults and importName
  derivation; imports Contract/Prelude directly instead of through the
  deleted barrel.
- gen/Gen.dhall -> gen/package.dhall: builds Sdk.Sigs.generator Config
  Config/default interpret, with Config/default supplying an all-None
  Config.
…mos/

Pure directory move for gen/ -> src/ (relative imports inside are
unaffected). tests/Exhaustive.dhall becomes demos/Exhaustive.dhall and is
rewritten to use Sdk.Output.toFileMap, since Sdk.Sigs.generator-built
modules no longer expose compileToFileMap.
…tive.dhall to demos/

Tasks 1-5 renamed gen/ to src/, gen/Gen.dhall to src/package.dhall, and
tests/Exhaustive.dhall to demos/Exhaustive.dhall. This updates every
external reference to the old paths across CI workflows, dev scripts,
docs, and the bench harness.

- .github/workflows/ci.yml, release.yml, build-contract-shell.sh: path refs.
- README.md, AGENTS.md, DESIGN.md: doc path refs; DESIGN.md's section 10
  tree diagram and entry-point description rewritten to match the actual
  post-move src/ layout (Interpret.dhall/package.dhall, no more Algebras/,
  Sdk.Sigs.generator instead of Sdk.module).
- build.bash, mise.toml: dev-script path refs.
- bench/generate.sh, bench/as-source.sh: gen/ -> src/ copies; the
  as-Source/plain-import sha256 substitution pair for gen-sdk is verified
  via `dhall hash` to be a no-op for v2.0.0 (both modes hash to the same
  value, unlike the old v0.11.0 pair), so only a comment remains; the lude
  pair is untouched since lude's pin is unchanged by this migration.
- tests/fixture-project/project1.pgn.yaml: the fixture project's own
  `gen:` key still pointed at the now-deleted gen/Gen.dhall, which would
  break the harness and the `golden` mise task; updated to src/package.dhall.
tests/_harness.py's GEN_DIR (and its two consumers) still pointed the
harness at the repo-root gen/ directory, which Task 5 deleted when it
renamed gen/ to src/. Every test using the session-scoped generated_tree
fixture, or building its own copytree in test_unsupported_types.py, would
have hit FileNotFoundError on the very first pgn run. Renamed the constant
to SRC_DIR (was misleading otherwise), pointed it at src/, matched the
copied-tree destination directory name to what project1.pgn.yaml's
`gen: ../../src/package.dhall` (fixed in the prior commit) actually
resolves against, and fixed the two hardcoded yaml literals in
test_unsupported_types.py plus conftest.py's docstring.

Confirmed via `python3 -m py_compile` and a repo-wide grep for any
remaining gen/-as-directory or GEN_DIR references in .py files (none).
Documents the gen-contract v4.0.1 / gen-sdk v2.0.0 migration and gen/->src/
layout restructure under # Upcoming, and updates Config.dhall's doc comment
to reference Interpret.dhall instead of the old compile.dhall name.
…ltColumns

These were declared but never exported (unlike Member.dhall/ParamsMember.dhall,
which do export Run), left over from documenting each file's actual multi-arg
call signature during the gen-sdk v2 migration. Flagged by final review as
harmless but pointless; removing rather than exporting keeps these three
files' tails exactly as they were pre-migration, matching the migration's
"keep bare exports verbatim" instruction for this exception group.
This reverts commit 15c2836.
@slavashvets

Copy link
Copy Markdown
Owner

Superseded by #16. The new PR carries this work forward and documents what was retained and what changed. Closing this PR in favor of #16. Thanks, Nikita.

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