From 98ca17cdc304945efe3d0efd851887885a767b02 Mon Sep 17 00:00:00 2001 From: crimson-knight Date: Wed, 18 Nov 2026 16:54:54 -0500 Subject: [PATCH 1/3] Gate CI on the generated app linking no PCRE2 scripts/check_generated_app_linkage.sh generates the default SQLite app, builds it, and fails when its binary links libpcre2 or holds a pcre2_ symbol; it repeats the check after a scaffold adds a Grant model, and a Regex control program proves the check can fail. The generated-app-linkage CI job runs it on ubuntu-24.04 and macos-15 with sha256-verified Crystal 1.22.2. --- scripts/check_generated_app_linkage.sh | 122 +++++++++++++++++++++++++ scripts/linkage/regex_control.cr | 4 + 2 files changed, 126 insertions(+) create mode 100755 scripts/check_generated_app_linkage.sh create mode 100644 scripts/linkage/regex_control.cr diff --git a/scripts/check_generated_app_linkage.sh b/scripts/check_generated_app_linkage.sh new file mode 100755 index 0000000..efb5cc4 --- /dev/null +++ b/scripts/check_generated_app_linkage.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash +# Checks that the app `amber new` generates links no regex engine. +# +# 1. scripts/linkage/regex_control.cr links PCRE2, which proves the check can fail. +# 2. `amber new linkage_probe -d sqlite` builds into a binary that links no +# libpcre2 and holds no pcre2_ symbol, and its home page answers 200. +# 3. After `amber generate scaffold` adds a Grant model, controller and schema, +# the rebuilt binary still links no PCRE2 and its specs pass. +# +# usage: scripts/check_generated_app_linkage.sh /path/to/amber [OUTPUT_DIR] +# Set CRYSTAL to choose the compiler; crystal-alpha is preferred when present. +# Minecart must be on PATH (scripts/install_pinned_minecart.sh puts it there). +set -euo pipefail + +if [[ $# -lt 1 || $# -gt 2 ]]; then + echo "usage: $0 /path/to/amber [output-directory]" >&2 + exit 64 +fi + +script_dir="$(cd "$(dirname "$0")" && pwd)" +cli_path="$1" +if [[ "$cli_path" != /* ]]; then + cli_path="$(cd "$(dirname "$cli_path")" && pwd)/$(basename "$cli_path")" +fi +output_directory="${2:-${TMPDIR:-/tmp}/amber-generated-app-linkage}" +probe_port="${LINKAGE_PROBE_PORT:-39128}" +if [[ -z "${CRYSTAL:-}" ]]; then + if command -v crystal-alpha >/dev/null 2>&1; then CRYSTAL=crystal-alpha; else CRYSTAL=crystal; fi +fi +command -v minecart >/dev/null 2>&1 || { echo "Minecart is required to generate the app" >&2; exit 1; } + +rm -rf "$output_directory" +mkdir -p "$output_directory" +app_path="$output_directory/linkage_probe" +server_pid="" + +cleanup() { + if [[ -n "$server_pid" ]] && kill -0 "$server_pid" 2>/dev/null; then + kill "$server_pid" 2>/dev/null || true + wait "$server_pid" 2>/dev/null || true + fi +} +trap cleanup EXIT + +list_libraries() { + if [[ "$(uname -s)" == "Darwin" ]]; then + otool -L "$1" | tail -n +2 | awk '{print $1}' + else + ldd "$1" | awk '{print $1}' + fi +} + +count_pcre2_libraries() { + list_libraries "$1" | grep -c pcre2 || true +} + +count_pcre2_symbols() { + nm "$1" 2>/dev/null | grep -c pcre2_ || true +} + +status=0 + +# Fails the run when the binary reaches PCRE2, and prints what it links. +check_binary_is_pcre2_free() { + local label="$1" binary="$2" + echo "$label links:" + list_libraries "$binary" | sed 's/^/ /' + local library_count symbol_count + library_count="$(count_pcre2_libraries "$binary")" + symbol_count="$(count_pcre2_symbols "$binary")" + if [[ "$library_count" -ne 0 || "$symbol_count" -ne 0 ]]; then + echo "FAIL: $label reaches PCRE2 ($library_count libraries, $symbol_count pcre2_ symbols)" + status=1 + else + echo "ok: $label links no PCRE2 and holds no pcre2_ symbol" + fi +} + +"$CRYSTAL" --version | head -1 + +"$CRYSTAL" build "$script_dir/linkage/regex_control.cr" -o "$output_directory/regex_control" +control_library_count="$(count_pcre2_libraries "$output_directory/regex_control")" +control_symbol_count="$(count_pcre2_symbols "$output_directory/regex_control")" +if [[ "$control_library_count" -eq 0 && "$control_symbol_count" -eq 0 ]]; then + echo "FAIL: regex_control shows no PCRE2, so this check cannot see it" + status=1 +else + echo "ok: regex_control reaches PCRE2 ($control_library_count libraries, $control_symbol_count pcre2_ symbols), so the check can fail" +fi + +(cd "$output_directory" && "$cli_path" new linkage_probe -d sqlite -y --skip-agent-setup) +cd "$app_path" + +mkdir -p bin +"$CRYSTAL" build src/linkage_probe.cr -o bin/linkage_probe +check_binary_is_pcre2_free "default app" bin/linkage_probe + +AMBER_ENV=development AMBER_SERVER_PORT="$probe_port" bin/linkage_probe > "$output_directory/server.log" 2>&1 & +server_pid=$! +home_status="000" +for _ in $(seq 1 50); do + home_status="$(curl --silent --output /dev/null --max-time 1 --write-out '%{http_code}' "http://127.0.0.1:$probe_port/" || true)" + [[ "$home_status" == "200" ]] && break + sleep 0.2 +done +if [[ "$home_status" == "200" ]]; then + echo "ok: the default app answers GET / with 200" +else + echo "FAIL: the default app answered GET / with $home_status" + tail -20 "$output_directory/server.log" + status=1 +fi +cleanup +server_pid="" + +"$cli_path" generate scaffold Pet name:string:required species:string:required adopted:bool +"$CRYSTAL" build src/linkage_probe.cr -o bin/linkage_probe_scaffold +check_binary_is_pcre2_free "scaffolded app" bin/linkage_probe_scaffold +AMBER_ENV=test "$cli_path" database migrate +AMBER_ENV=test "$CRYSTAL" spec + +exit $status diff --git a/scripts/linkage/regex_control.cr b/scripts/linkage/regex_control.cr new file mode 100644 index 0000000..b988858 --- /dev/null +++ b/scripts/linkage/regex_control.cr @@ -0,0 +1,4 @@ +# Control program for scripts/check_generated_app_linkage.sh. It uses Regex, +# so its binary must show PCRE2; that proves the linkage check can fail. +pattern = Regex.new("a+b") +exit(pattern.matches?(ARGV[0]? || "aab") ? 0 : 1) From c303bca0f1d707079d9f27ef519370fb452028e5 Mon Sep 17 00:00:00 2001 From: crimson-knight Date: Fri, 20 Nov 2026 06:59:44 -0500 Subject: [PATCH 2/3] Amber CLI 2.0.11 on Amber 2.0.0-beta.11, Grant 0.24.0 and asset_pipeline 0.38.0 New apps pin Amber v2.0.0-beta.11 (f987f1bb), Grant v0.24.0 (7bb4b9d4) and asset_pipeline v0.38.0 (73c89c34) by commit. amber new checks every one of them in shard.lock: its commit and its sha256-v2 checksum, or the git-tree checksum an older Minecart records, and on Windows its commit alone. The three releases live in PinnedRelease values, so the lock check is one loop. The generated-app-linkage CI job checks that the default app links no PCRE2 before and after a scaffold, and the beta contract requires it. --- .github/workflows/ci.yml | 63 +++++++++++++++++++++ README.md | 14 +++-- RELEASE_SETUP.md | 2 +- docs/BETA_WEB_APP.md | 8 +-- docs/ONBOARDING.md | 24 +++++--- docs/RELEASE_CHECKLIST.md | 6 +- scripts/check_beta_contract.sh | 24 +++++--- scripts/check_generated_app_linkage.sh | 2 + scripts/smoke_generated_web.ps1 | 8 +-- scripts/smoke_generated_web.sh | 19 ++++--- shard.yml | 2 +- spec/commands/doctor_spec.cr | 4 +- spec/commands/new_command_spec.cr | 61 ++++++++++++++++---- spec/generators/native_app_spec.cr | 2 +- src/amber_cli.cr | 2 +- src/amber_cli/amber_release.cr | 8 +-- src/amber_cli/commands/generate.cr | 8 +-- src/amber_cli/commands/new_command.cr | 43 ++++++++------ src/amber_cli/commands/setup_lsp_command.cr | 2 +- src/amber_cli/documentation.cr | 2 +- src/amber_cli/generators/native_app.cr | 2 +- src/amber_cli/pinned_releases.cr | 38 +++++++++++++ src/amber_cli/templates/app/README.md.ecr | 4 +- src/amber_cli/templates/app/shard.yml.ecr | 6 +- 24 files changed, 263 insertions(+), 91 deletions(-) create mode 100644 src/amber_cli/pinned_releases.cr diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b49cdb7..81559fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,3 +178,66 @@ jobs: else echo "No integration tests found, skipping..." fi + + # The app `amber new` generates (SQLite, Grant, asset_pipeline) links no + # regex engine, before and after a scaffold adds a Grant model. The stock + # tarballs link PCRE2 statically, so the check reads symbols as well as + # libraries, and a control program that uses Regex must show them. + generated-app-linkage: + name: Generated app links no PCRE2 on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + needs: test + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + crystal_version: 1.22.2 + crystal_tarball: crystal-1.22.2-1-linux-x86_64-bundled.tar.gz + crystal_sha256: 0dc5c3ff1b5710c3981e207a6241fc06cc28fadb6622d5fdb21999adf1ca2309 + - os: macos-15 + crystal_version: 1.22.2 + crystal_tarball: crystal-1.22.2-1-darwin-universal.tar.gz + crystal_sha256: 9c73ddd00aa8c9bf9f8fdc5aebdde99a92a63c2e2539b8ad5f9b8a27813ddc6f + + steps: + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + persist-credentials: false + + - name: Install the generated app's system libraries (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libsqlite3-dev libyaml-dev libssl-dev libgmp-dev zlib1g-dev + + - name: Install the generated app's system libraries (macOS) + if: runner.os == 'macOS' + run: brew install libyaml gmp + + - name: Install Crystal ${{ matrix.crystal_version }} (sha256-verified) + env: + CRYSTAL_TARBALL: ${{ matrix.crystal_tarball }} + CRYSTAL_SHA256: ${{ matrix.crystal_sha256 }} + CRYSTAL_VERSION: ${{ matrix.crystal_version }} + run: | + set -euo pipefail + archive="$RUNNER_TEMP/$CRYSTAL_TARBALL" + curl -fsSL --retry 3 -o "$archive" \ + "https://github.com/crystal-lang/crystal/releases/download/$CRYSTAL_VERSION/$CRYSTAL_TARBALL" + echo "$CRYSTAL_SHA256 $archive" | shasum -a 256 -c - + tar -xzf "$archive" -C "$RUNNER_TEMP" + echo "$RUNNER_TEMP/crystal-$CRYSTAL_VERSION-1/bin" >> "$GITHUB_PATH" + + - name: Build pinned Minecart + run: scripts/install_pinned_minecart.sh + + - name: Install dependencies + run: minecart install --frozen --skip-ai-docs + + - name: Compile CLI + run: crystal build src/amber_cli.cr --no-debug -o amber + + - name: Check what the generated app links + run: scripts/check_generated_app_linkage.sh ./amber "$RUNNER_TEMP/generated-app-linkage" diff --git a/README.md b/README.md index c99cdff..e629a29 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [![GitHub release](https://img.shields.io/github/release/amberframework/amber_cli.svg)](https://github.com/amberframework/amber_cli/releases) [![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://amberframework.github.io/amber_cli/) -Amber CLI is the standalone command-line companion for Amber V2. CLI `2.0.10` -creates the supported Amber `2.0.0-beta.10` ECR web application and includes +Amber CLI is the standalone command-line companion for Amber V2. CLI `2.0.11` +creates the supported Amber `2.0.0-beta.11` ECR web application and includes development, generator, database, and LSP tooling. Its agent tooling also works in plain Crystal apps and shards; see [Agent tooling](#agent-tooling-for-any-crystal-project). @@ -42,13 +42,13 @@ are selected by the installed core catalog, not pinned by this tap. ### Direct release archive -The CLI `2.0.10` release has `darwin-arm64`, `linux-x86_64`, and +The CLI `2.0.11` release has `darwin-arm64`, `linux-x86_64`, and `linux-arm64` binary archives. A direct archive does not install Minecart or the native dependencies, so Homebrew is the beginner path. Windows x86-64 has no release archive. ```bash -version=v2.0.10 +version=v2.0.11 platform=darwin-arm64 asset="amber_cli-${platform}.tar.gz" @@ -90,13 +90,15 @@ or a file under `app/assets/` changes. Open . The web template is deliberately small: -- Amber from `amberframework/amber`, pinned to `2.0.0-beta.10` by commit - (`d775841a0af43bf512f1c9b704906fccdf8863f7`), with its checksum (`sha256-v2:e1099a4f7a25db316b2abdf80f999a2753a0fcc056834f3abe6d9b5a88ae945d`) checked in `shard.lock` +- Amber from `amberframework/amber`, pinned to `2.0.0-beta.11` by commit + (`f987f1bb19b789f8f14b000b6ee00ed496fe6cbb`), with its checksum (`sha256-v2:732bd8a19fed53e2e8ef0ee768dab03466abf502324d55de5f81961ac75456fa`) checked in `shard.lock` - ECR views (Slang and Kilt are not supported in Amber V2) - typed development, test, and production YAML - branded homepage, controller spec, and fingerprinted CSS, JavaScript, SVG, font, image, and general static-file support - a browser-native import map with a local JavaScript module entry point +- Grant `v0.24.0` and asset_pipeline `v0.38.0`, pinned by commit and checked + in `shard.lock` the same way, so the built app links no PCRE2 - Grant ORM, Micrate-powered migration commands, and the selected database driver - SQLite by default, so the first persisted feature needs no database server diff --git a/RELEASE_SETUP.md b/RELEASE_SETUP.md index 9b8feb2..59c8e07 100644 --- a/RELEASE_SETUP.md +++ b/RELEASE_SETUP.md @@ -106,7 +106,7 @@ Publishing the release triggers the automated flow: 3. package the tagged source and publish its archive and checksum Before pushing the tap commit, download the published -`amber_cli-source-2.0.10.tar.gz` archive, verify its sidecar checksum, and compare +`amber_cli-source-2.0.11.tar.gz` archive, verify its sidecar checksum, and compare its SHA-256 with `Formula/amber_cli.rb`. The CI-generated gzip archive can have different bytes from a local archive of the same commit, so update the formula to the published asset hash when they differ. Then run the tap smoke diff --git a/docs/BETA_WEB_APP.md b/docs/BETA_WEB_APP.md index 9e6c690..129123b 100644 --- a/docs/BETA_WEB_APP.md +++ b/docs/BETA_WEB_APP.md @@ -1,7 +1,7 @@ # Amber V2 Beta Web App -This guide is the consumer smoke test for Amber CLI `2.0.10` and Amber -`2.0.0-beta.10`. It is expected to pass on Apple Silicon macOS, x86_64 Linux, +This guide is the consumer smoke test for Amber CLI `2.0.11` and Amber +`2.0.0-beta.11`. It is expected to pass on Apple Silicon macOS, x86_64 Linux, and ARM64 Linux. Windows x86-64 runs the complete generated-app smoke in CI. A `shard.lock` written on Windows records different `sha256-v2:` values from one written on macOS or Linux, so a team on both needs a lock for each. @@ -14,7 +14,7 @@ minecart --version amber --version ``` -Crystal must be at least 1.20 and earlier than 2.0. Amber CLI must be 2.0.10 or +Crystal must be at least 1.20 and earlier than 2.0. Amber CLI must be 2.0.11 or newer. ## 2. Generate the web app @@ -35,7 +35,7 @@ grep -E '^(template|database|model):' .amber.yml ``` The dependency must be `amberframework/amber` at commit -`d775841a0af43bf512f1c9b704906fccdf8863f7` (`2.0.0-beta.10` on `v2-dev`); the +`f987f1bb19b789f8f14b000b6ee00ed496fe6cbb` (`v2.0.0-beta.11`); the template must be `ecr`, the database must be `sqlite`, and the model layer must be `grant`. `shard.yml` must include Grant and Asset Pipeline pinned by commit, and no database driver shard unless you selected MySQL. Grant ships its own diff --git a/docs/ONBOARDING.md b/docs/ONBOARDING.md index 3242976..e449b64 100644 --- a/docs/ONBOARDING.md +++ b/docs/ONBOARDING.md @@ -2,7 +2,7 @@ This page takes a new developer from a bare machine to an Amber V2 app with checksum-verified dependencies, and with editor and coding-assistant rules active -from the first edit. It covers Amber CLI 2.0.10, Amber 2.0.0-beta.10 and Minecart +from the first edit. It covers Amber CLI 2.0.11, Amber 2.0.0-beta.11 and Minecart 2025.11.25.9 on Apple Silicon macOS and Linux. ## What you get @@ -13,7 +13,7 @@ from the first edit. It covers Amber CLI 2.0.10, Amber 2.0.0-beta.10 and Minecar | `amber-lsp` | Language server, API lookup and rule checks | Same formula | | `minecart` | Installs dependencies and verifies their checksums | Dependency of the formula | | Crystal | Compiles the app | Dependency of the formula | -| Amber 2.0.0-beta.10 | The framework, its rule pack and its guides | Pinned in each new app | +| Amber 2.0.0-beta.11 | The framework, its rule pack and its guides | Pinned in each new app | | Grant | The ORM and its tenancy rule pack | Pinned in each new app | | Asset Pipeline | CSS, JavaScript and image assets | Pinned in each new app | | micrate | Database migrations | Built into `amber database` | @@ -36,8 +36,8 @@ HOMEBREW_NO_AUTO_UPDATE=1 brew install amberframework/amber_cli/amber_cli Check the result: ```bash -amber --version # Amber CLI v2.0.10 -amber-lsp --version # amber-lsp 1.0.0 (amber_cli 2.0.10, ...) +amber --version # Amber CLI v2.0.11 +amber-lsp --version # amber-lsp 1.0.0 (amber_cli 2.0.11, ...) minecart --version # Minecart 2025.11.25.9 ``` @@ -185,18 +185,24 @@ end ## Upgrade an existing app -Pin the release's commit and move the lock: +Pin the release commits and move the lock: ```yaml dependencies: amber: github: amberframework/amber - commit: d775841a0af43bf512f1c9b704906fccdf8863f7 # 2.0.0-beta.10 on v2-dev + commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11 + grant: + github: crimson-knight/grant + commit: 7bb4b9d45e74c490e6f3ad80cef8cc1cebd5b889 # v0.24.0 + asset_pipeline: + github: amberframework/asset_pipeline + commit: 73c89c3417a5282d9ac4179b283bcc660b7f898a # v0.38.0 ``` ```bash -minecart update amber -grep -A3 '^ amber:' shard.lock # checksum: sha256-v2:e1099a4f7a25db316b2abdf80f999a2753a0fcc056834f3abe6d9b5a88ae945d +minecart update amber grant asset_pipeline +grep -A3 '^ amber:' shard.lock # checksum: sha256-v2:732bd8a19fed53e2e8ef0ee768dab03466abf502324d55de5f81961ac75456fa amber setup:agent ``` @@ -205,4 +211,4 @@ notice about them. Minecart 2025.11.25.9 stops on a folder in `lib/` that `shard.lock` does not pin, and names it. Remove that folder and install again. Then read the -[beta.10 release notes](https://github.com/amberframework/amber/blob/v2.0.0-beta.10/RELEASE_NOTES_V2_BETA10.md). +[beta.11 release notes](https://github.com/amberframework/amber/blob/v2.0.0-beta.11/RELEASE_NOTES_V2_BETA11.md). diff --git a/docs/RELEASE_CHECKLIST.md b/docs/RELEASE_CHECKLIST.md index b23d08d..6d24e36 100644 --- a/docs/RELEASE_CHECKLIST.md +++ b/docs/RELEASE_CHECKLIST.md @@ -5,13 +5,13 @@ Homebrew formula pins Amber and Minecart source archives and checksums. ## 1. Framework prerequisite -1. Confirm the published `v2.0.0-beta.10` prerelease has its source archive and +1. Confirm the published `v2.0.0-beta.11` prerelease has its source archive and checksum and matches the generated app's exact framework pin. 2. Check the framework's migration and support-matrix links. ## 2. CLI release -1. Confirm `shard.yml` and `AmberCLI::VERSION` both say `2.0.10`. +1. Confirm `shard.yml` and `AmberCLI::VERSION` both say `2.0.11`. 2. Generate a web app and verify it pins the framework prerelease. 3. Verify the generated app pins the reviewed Asset Pipeline release exactly, has a Minecart SHA-256 checksum for every dependency, and has assistant @@ -27,7 +27,7 @@ Homebrew formula pins Amber and Minecart source archives and checksums. 7. Confirm the Windows x86-64 generated app passes its full CI smoke, including launch and asset probes. This is a generated-app release gate, with no Windows archive yet. -8. Tag `v2.0.10`, publish the release, and wait for the binary and source +8. Tag `v2.0.11`, publish the release, and wait for the binary and source archives and checksum files to upload. Compare the published source archive hash with the reviewed Homebrew formula before pushing the tap. diff --git a/scripts/check_beta_contract.sh b/scripts/check_beta_contract.sh index e5f56d4..412b92b 100755 --- a/scripts/check_beta_contract.sh +++ b/scripts/check_beta_contract.sh @@ -3,24 +3,30 @@ set -euo pipefail shard_version="$(awk '/^version:/ { print $2; exit }' shard.yml)" cli_version="$(sed -n 's/.*VERSION = "\([^"]*\)".*/\1/p' src/amber_cli.cr | head -1)" -test "$shard_version" = "2.0.10" +test "$shard_version" = "2.0.11" test "$cli_version" = "$shard_version" grep -F 'github: amberframework/amber' src/amber_cli/commands/new_command.cr -grep -F 'commit: #{AmberRelease::COMMIT} # #{AmberRelease::VERSION} on v2-dev' src/amber_cli/commands/new_command.cr -grep -F 'COMMIT = "d775841a0af43bf512f1c9b704906fccdf8863f7"' src/amber_cli/amber_release.cr -grep -F 'TREE = "e06f26daef02a30e91114b2c71224920e0c097de"' src/amber_cli/amber_release.cr -grep -F 'CHECKSUM = "sha256-v2:e1099a4f7a25db316b2abdf80f999a2753a0fcc056834f3abe6d9b5a88ae945d"' src/amber_cli/amber_release.cr +grep -F 'commit: #{AmberRelease::COMMIT} # v#{AmberRelease::VERSION}' src/amber_cli/commands/new_command.cr +grep -F 'COMMIT = "f987f1bb19b789f8f14b000b6ee00ed496fe6cbb"' src/amber_cli/amber_release.cr +grep -F 'TREE = "fc2433e6cf3b55fc779977cc70b1270c7910c920"' src/amber_cli/amber_release.cr +grep -F 'CHECKSUM = "sha256-v2:732bd8a19fed53e2e8ef0ee768dab03466abf502324d55de5f81961ac75456fa"' src/amber_cli/amber_release.cr grep -F 'template: ecr' src/amber_cli/commands/new_command.cr grep -F 'model: grant' src/amber_cli/commands/new_command.cr grep -F 'database: #{database}' src/amber_cli/commands/new_command.cr grep -F 'github: crimson-knight/grant' src/amber_cli/commands/new_command.cr grep -F 'github: amberframework/asset_pipeline' src/amber_cli/commands/new_command.cr -grep -F 'commit: ac630a4c948080bf45e9b1e66451c48da9a69349 # 0.37.1' src/amber_cli/commands/new_command.cr +grep -F 'commit: #{GrantRelease::COMMIT} # v#{GrantRelease::VERSION}' src/amber_cli/commands/new_command.cr +grep -F 'commit: #{AssetPipelineRelease::COMMIT} # v#{AssetPipelineRelease::VERSION}' src/amber_cli/commands/new_command.cr +grep -F 'COMMIT = "7bb4b9d45e74c490e6f3ad80cef8cc1cebd5b889"' src/amber_cli/pinned_releases.cr +grep -F 'CHECKSUM = "sha256-v2:0c295bd9da92146c5482c63326adb402b24e33c152af86025a27f9da1a086f51"' src/amber_cli/pinned_releases.cr +grep -F 'COMMIT = "73c89c3417a5282d9ac4179b283bcc660b7f898a"' src/amber_cli/pinned_releases.cr +grep -F 'CHECKSUM = "sha256-v2:80ea8ac95943a3c5be438e68c2ef2f00d9b9783f0787fcd67ef346f135d9510c"' src/amber_cli/pinned_releases.cr +grep -F 'commit: 7bb4b9d45e74c490e6f3ad80cef8cc1cebd5b889 # v0.24.0' src/amber_cli/templates/app/shard.yml.ecr grep -F 'github: amberframework/asset_pipeline' src/amber_cli/templates/app/shard.yml.ecr -grep -F 'commit: ac630a4c948080bf45e9b1e66451c48da9a69349 # 0.37.1' src/amber_cli/templates/app/shard.yml.ecr +grep -F 'commit: 73c89c3417a5282d9ac4179b283bcc660b7f898a # v0.38.0' src/amber_cli/templates/app/shard.yml.ecr grep -F 'github: amberframework/amber' src/amber_cli/generators/native_app.cr -grep -F 'commit: d291e0930dd22b14a2d10f75a9de063abb0e64e4 # v2.0.0-beta.10' src/amber_cli/generators/native_app.cr +grep -F 'commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11' src/amber_cli/generators/native_app.cr grep -F 'version: ~> 0.37.1' src/amber_cli/generators/native_app.cr if grep -F 'branch:' src/amber_cli/generators/native_app.cr; then echo "native app template contains a mutable dependency branch" >&2 @@ -43,6 +49,8 @@ if grep -F '# schema = #{class_name}Schema.new(data)' src/amber_cli/commands/g fi grep -F 'scripts/smoke_generated_web.sh ./amber' .github/workflows/release.yml +test -x scripts/check_generated_app_linkage.sh +grep -F 'scripts/check_generated_app_linkage.sh ./amber' .github/workflows/ci.yml if grep -R -F 'AMBER_CANDIDATE_FRAMEWORK' .github/workflows; then echo "CI workflows must test the published framework emitted by the template" >&2 exit 1 diff --git a/scripts/check_generated_app_linkage.sh b/scripts/check_generated_app_linkage.sh index efb5cc4..41cf0b6 100755 --- a/scripts/check_generated_app_linkage.sh +++ b/scripts/check_generated_app_linkage.sh @@ -31,6 +31,8 @@ command -v minecart >/dev/null 2>&1 || { echo "Minecart is required to generate rm -rf "$output_directory" mkdir -p "$output_directory" +# The script changes into the app, so keep the output directory absolute. +output_directory="$(cd "$output_directory" && pwd)" app_path="$output_directory/linkage_probe" server_pid="" diff --git a/scripts/smoke_generated_web.ps1 b/scripts/smoke_generated_web.ps1 index b4a2b57..676d227 100644 --- a/scripts/smoke_generated_web.ps1 +++ b/scripts/smoke_generated_web.ps1 @@ -43,7 +43,7 @@ $amberConfig = [System.IO.File]::ReadAllText($amberConfigPath) if (-not $manifest.Contains("github: amberframework/amber")) { throw "Generated shard.yml does not include Amber" } -if (-not $manifest.Contains("commit: d775841a0af43bf512f1c9b704906fccdf8863f7 # 2.0.0-beta.10 on v2-dev")) { +if (-not $manifest.Contains("commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11")) { throw "Generated shard.yml does not pin the supported Amber beta" } if (-not $manifest.Contains("github: crimson-knight/grant")) { @@ -55,7 +55,7 @@ if ($manifest.Contains("crystal-sqlite3")) { if (-not $manifest.Contains("github: amberframework/asset_pipeline")) { throw "Generated shard.yml does not include Asset Pipeline" } -if (-not $manifest.Contains("commit: ac630a4c948080bf45e9b1e66451c48da9a69349 # 0.37.1")) { +if (-not $manifest.Contains("commit: 73c89c3417a5282d9ac4179b283bcc660b7f898a # v0.38.0")) { throw "Generated shard.yml does not pin the supported Asset Pipeline release" } if (-not (Test-Path (Join-Path $appPath ".claude/CLAUDE.md"))) { @@ -74,7 +74,7 @@ if (-not $amberConfig.Contains("database: sqlite") -or -not $amberConfig.Contain if ($FrameworkCommit) { $releasedRepository = " github: amberframework/amber" - $releasedFramework = " commit: d775841a0af43bf512f1c9b704906fccdf8863f7 # 2.0.0-beta.10 on v2-dev" + $releasedFramework = " commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11" if (-not $manifest.Contains($releasedRepository)) { throw "Generated shard.yml does not contain the expected Amber repository" } @@ -118,7 +118,7 @@ try { $expectedAmberCommit = $FrameworkCommit $expectedAmberGit = "https://github.com/$FrameworkRepository.git" } else { - $expectedAmberCommit = "d775841a0af43bf512f1c9b704906fccdf8863f7" + $expectedAmberCommit = "f987f1bb19b789f8f14b000b6ee00ed496fe6cbb" $expectedAmberGit = "https://github.com/amberframework/amber.git" } if ($amberEntry -notmatch "(?m)^ git: $([regex]::Escape($expectedAmberGit))\r?$") { diff --git a/scripts/smoke_generated_web.sh b/scripts/smoke_generated_web.sh index ae264f6..3f23794 100755 --- a/scripts/smoke_generated_web.sh +++ b/scripts/smoke_generated_web.sh @@ -46,11 +46,11 @@ grep -F 'AMBER_ENV=test crystal spec' "$script_dir/../src/amber_cli/templates/ap ! grep -F 'crystal-alpha' "$script_dir/../src/amber_cli/templates/app/.amber.yml.ecr" grep -F "github: amberframework/amber" "$app_path/shard.yml" -grep -F "commit: d775841a0af43bf512f1c9b704906fccdf8863f7 # 2.0.0-beta.10 on v2-dev" "$app_path/shard.yml" +grep -F "commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11" "$app_path/shard.yml" grep -F "github: crimson-knight/grant" "$app_path/shard.yml" grep -F "github: amberframework/asset_pipeline" "$app_path/shard.yml" -grep -F "commit: ac630a4c948080bf45e9b1e66451c48da9a69349 # 0.37.1" "$app_path/shard.yml" -grep -F "commit: 623c4bcad284fcee000244c8b26651f925e23ceb" "$app_path/shard.yml" +grep -F "commit: 73c89c3417a5282d9ac4179b283bcc660b7f898a # v0.38.0" "$app_path/shard.yml" +grep -F "commit: 7bb4b9d45e74c490e6f3ad80cef8cc1cebd5b889" "$app_path/shard.yml" ! grep -F "crystal-sqlite3" "$app_path/shard.yml" grep -F "template: ecr" "$app_path/.amber.yml" grep -F "database: sqlite" "$app_path/.amber.yml" @@ -68,7 +68,7 @@ fi if [[ -n "$framework_commit" ]]; then sed -i.bak -E "s# github: amberframework/amber# github: ${framework_repository}#" "$app_path/shard.yml" - sed -i.bak -E "s/ commit: d775841a0af43bf512f1c9b704906fccdf8863f7( # [^#]+)?$/ commit: ${framework_commit}/" "$app_path/shard.yml" + sed -i.bak -E "s/ commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb( # [^#]+)?$/ commit: ${framework_commit}/" "$app_path/shard.yml" rm -f "$app_path/shard.yml.bak" fi @@ -86,7 +86,10 @@ else minecart install --frozen fi test -s shard.lock -grep -F "version: 0.23.4+git.commit.623c4bcad284fcee000244c8b26651f925e23ceb" shard.lock +grep -F "version: 0.24.0+git.commit.7bb4b9d45e74c490e6f3ad80cef8cc1cebd5b889" shard.lock +grep -A3 '^ grant:$' shard.lock | grep -qE '^ checksum: (sha256-v2:0c295bd9da92146c5482c63326adb402b24e33c152af86025a27f9da1a086f51|git-tree:ac01af3a3edb7d881c798c755e0845ad04383225)$' +grep -F "version: 0.38.0+git.commit.73c89c3417a5282d9ac4179b283bcc660b7f898a" shard.lock +grep -A3 '^ asset_pipeline:$' shard.lock | grep -qE '^ checksum: (sha256-v2:80ea8ac95943a3c5be438e68c2ef2f00d9b9783f0787fcd67ef346f135d9510c|git-tree:42caf3fc2d1af5e97417e7d7947dddd025e405e1)$' grep -F "version: 0.14.0" shard.lock # Each shard entry carries exactly one checksum. awk ' @@ -100,14 +103,14 @@ if [[ -n "$framework_commit" ]]; then expected_amber_commit="$framework_commit" expected_amber_git="https://github.com/${framework_repository}.git" else - expected_amber_commit="d775841a0af43bf512f1c9b704906fccdf8863f7" + expected_amber_commit="f987f1bb19b789f8f14b000b6ee00ed496fe6cbb" expected_amber_git="https://github.com/amberframework/amber.git" fi grep -qxF " git: ${expected_amber_git}" <<<"$amber_entry" grep -qE "^ version: [^ ]+\+git\.commit\.${expected_amber_commit}$" <<<"$amber_entry" if [[ -z "$framework_commit" ]]; then - grep -qxF " version: 2.0.0-beta.10+git.commit.d775841a0af43bf512f1c9b704906fccdf8863f7" <<<"$amber_entry" - grep -qxF " checksum: sha256-v2:e1099a4f7a25db316b2abdf80f999a2753a0fcc056834f3abe6d9b5a88ae945d" <<<"$amber_entry" + grep -qxF " version: 2.0.0-beta.11+git.commit.f987f1bb19b789f8f14b000b6ee00ed496fe6cbb" <<<"$amber_entry" + grep -qxF " checksum: sha256-v2:732bd8a19fed53e2e8ef0ee768dab03466abf502324d55de5f81961ac75456fa" <<<"$amber_entry" fi "$cli_path" assets build "$cli_path" assets check diff --git a/shard.yml b/shard.yml index 55af3c8..9acff78 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: amber_cli -version: 2.0.10 +version: 2.0.11 authors: - crimson-knight diff --git a/spec/commands/doctor_spec.cr b/spec/commands/doctor_spec.cr index 7310c0a..1eab829 100644 --- a/spec/commands/doctor_spec.cr +++ b/spec/commands/doctor_spec.cr @@ -17,7 +17,7 @@ module DoctorCommandSpecHelper File.write(File.join(project_root, ".claude/settings.json"), claude_settings) File.write(File.join(project_root, ".codex/hooks.json"), codex_settings) setup_manifest = AmberCLI::Agent::AgentSetupManifest.new( - "2.0.10", + "2.0.11", "1.0.0", AmberCLI::Agent::AgentSetupGuidance::GENERATED_HOOK_VERSION, ) @@ -153,7 +153,7 @@ describe "amber doctor" do Dir.mkdir_p(File.join(project_root, ".amber")) old_guidance = "Before using a library API you are not sure of, run `amber-lsp lookup 'Type.method'`." File.write(File.join(project_root, ".amber/agent_setup.json"), <<-JSON) - {"amber_cli_version":"2.0.10","minimum_amber_lsp_version":"1.0.0","generated_hook_version":"5"} + {"amber_cli_version":"2.0.11","minimum_amber_lsp_version":"1.0.0","generated_hook_version":"5"} JSON File.write(File.join(project_root, ".amber/amber-agent-hook"), "#!/bin/sh\n#{old_guidance}\n") File.write(File.join(project_root, "CLAUDE.md"), "\n#{old_guidance}\n\n") diff --git a/spec/commands/new_command_spec.cr b/spec/commands/new_command_spec.cr index db5bcab..02b1c09 100644 --- a/spec/commands/new_command_spec.cr +++ b/spec/commands/new_command_spec.cr @@ -33,21 +33,62 @@ describe AmberCLI::Commands::NewCommand do checksum: #{AmberCLI::AmberRelease::CHECKSUM} LOCK - it "accepts a lock with Amber at the pinned commit and tree" do - lock = "version: 2.0\nshards:\n#{amber_lock_entry}\n" + grant_lock_entry = <<-LOCK + grant: + git: https://github.com/crimson-knight/grant.git + version: #{AmberCLI::GrantRelease::VERSION}+git.commit.#{AmberCLI::GrantRelease::COMMIT} + checksum: #{AmberCLI::GrantRelease::CHECKSUM} + LOCK + + asset_pipeline_lock_entry = <<-LOCK + asset_pipeline: + git: https://github.com/amberframework/asset_pipeline.git + version: #{AmberCLI::AssetPipelineRelease::VERSION}+git.commit.#{AmberCLI::AssetPipelineRelease::COMMIT} + checksum: #{AmberCLI::AssetPipelineRelease::CHECKSUM} + LOCK + + pinned_entries = "#{amber_lock_entry}\n#{grant_lock_entry}\n#{asset_pipeline_lock_entry}" + + it "accepts a lock with Amber, Grant and asset_pipeline at their pinned commits and checksums" do + lock = "version: 2.0\nshards:\n#{pinned_entries}\n" AmberCLI::Commands::NewCommand.minecart_lock_problem(lock).should be_nil end - it "accepts the git-tree checksum an older Minecart records" do - older_entry = amber_lock_entry.sub(AmberCLI::AmberRelease::CHECKSUM, "git-tree:#{AmberCLI::AmberRelease::TREE}") - lock = "version: 2.0\nshards:\n#{older_entry}\n" + it "accepts the git-tree checksums an older Minecart records" do + older_entries = pinned_entries + .sub(AmberCLI::AmberRelease::CHECKSUM, "git-tree:#{AmberCLI::AmberRelease::TREE}") + .sub(AmberCLI::GrantRelease::CHECKSUM, "git-tree:#{AmberCLI::GrantRelease::TREE}") + .sub(AmberCLI::AssetPipelineRelease::CHECKSUM, "git-tree:#{AmberCLI::AssetPipelineRelease::TREE}") + lock = "version: 2.0\nshards:\n#{older_entries}\n" AmberCLI::Commands::NewCommand.minecart_lock_problem(lock).should be_nil end + it "rejects a lock that leaves out Grant" do + lock = "version: 2.0\nshards:\n#{amber_lock_entry}\n#{asset_pipeline_lock_entry}\n" + AmberCLI::Commands::NewCommand.minecart_lock_problem(lock).should eq("Minecart did not lock Grant") + end + + it "rejects a lock with asset_pipeline at another commit" do + other_commit = "2" * 40 + lock = "version: 2.0\nshards:\n#{pinned_entries.sub(AmberCLI::AssetPipelineRelease::COMMIT, other_commit)}\n" + problem = AmberCLI::Commands::NewCommand.minecart_lock_problem(lock) + problem.to_s.should contain("Minecart locked asset_pipeline at a revision other than v#{AmberCLI::AssetPipelineRelease::VERSION}") + end + + {% unless flag?(:win32) %} + it "rejects a lock whose Grant checksum differs from the pinned release" do + other_checksum = "sha256-v2:#{"0" * 64}" + lock = "version: 2.0\nshards:\n#{pinned_entries.sub(AmberCLI::GrantRelease::CHECKSUM, other_checksum)}\n" + problem = AmberCLI::Commands::NewCommand.minecart_lock_problem(lock) + problem.to_s.should contain("Minecart locked Grant") + problem.to_s.should contain(AmberCLI::GrantRelease::CHECKSUM) + end + {% end %} + {% unless flag?(:win32) %} it "rejects a lock whose Amber checksum differs from the pinned release" do other_checksum = "sha256-v2:#{"0" * 64}" - lock = "version: 2.0\nshards:\n#{amber_lock_entry.sub(AmberCLI::AmberRelease::CHECKSUM, other_checksum)}\n" + lock = "version: 2.0\nshards:\n#{pinned_entries.sub(AmberCLI::AmberRelease::CHECKSUM, other_checksum)}\n" problem = AmberCLI::Commands::NewCommand.minecart_lock_problem(lock) problem.should_not be_nil problem.to_s.should contain(AmberCLI::AmberRelease::CHECKSUM) @@ -56,7 +97,7 @@ describe AmberCLI::Commands::NewCommand do it "rejects a lock with Amber at another commit" do other_commit = "1" * 40 - lock = "version: 2.0\nshards:\n#{amber_lock_entry.sub(AmberCLI::AmberRelease::COMMIT, other_commit)}\n" + lock = "version: 2.0\nshards:\n#{pinned_entries.sub(AmberCLI::AmberRelease::COMMIT, other_commit)}\n" AmberCLI::Commands::NewCommand.minecart_lock_problem(lock).should_not be_nil end @@ -172,13 +213,13 @@ describe AmberCLI::Commands::NewCommand do shard = File.read(File.join(destination, "shard.yml")) shard.should contain("github: amberframework/amber") - shard.should contain("commit: #{AmberCLI::AmberRelease::COMMIT} # #{AmberCLI::AmberRelease::VERSION} on v2-dev") + shard.should contain("commit: #{AmberCLI::AmberRelease::COMMIT} # v#{AmberCLI::AmberRelease::VERSION}") shard.should contain("grant:") shard.should contain("github: crimson-knight/grant") - shard.should contain("commit: 623c4bcad284fcee000244c8b26651f925e23ceb") + shard.should contain("commit: #{AmberCLI::GrantRelease::COMMIT} # v#{AmberCLI::GrantRelease::VERSION}") shard.should contain("asset_pipeline:") shard.should contain("github: amberframework/asset_pipeline") - shard.should contain("commit: ac630a4c948080bf45e9b1e66451c48da9a69349") + shard.should contain("commit: #{AmberCLI::AssetPipelineRelease::COMMIT} # v#{AmberCLI::AssetPipelineRelease::VERSION}") shard.should_not contain("version: ~> 0.37.1") shard.should_not contain("crystal-sqlite3") shard.should_not contain("crystal-pg") diff --git a/spec/generators/native_app_spec.cr b/spec/generators/native_app_spec.cr index 152c5b9..a3b9dfa 100644 --- a/spec/generators/native_app_spec.cr +++ b/spec/generators/native_app_spec.cr @@ -42,7 +42,7 @@ describe AmberCLI::Generators::NativeApp do # Must have amber (patterns only) shard_content.should contain("amber:") shard_content.should contain("github: amberframework/amber") - shard_content.should contain("commit: d291e0930dd22b14a2d10f75a9de063abb0e64e4 # v2.0.0-beta.10") + shard_content.should contain("commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11") shard_content.should contain("github: crimson-knight/grant") shard_content.should contain("commit: 6c9da3c8180e612f76ff9ad9c76242a0402ce6d9") File.exists?(File.join(project_path, "shard.lock")).should be_false diff --git a/src/amber_cli.cr b/src/amber_cli.cr index ea149cf..a2fc83f 100644 --- a/src/amber_cli.cr +++ b/src/amber_cli.cr @@ -42,7 +42,7 @@ end Log.builder.bind "*", :info, backend module AmberCLI - VERSION = "2.0.10" + VERSION = "2.0.11" def self.run(args = ARGV) if args.empty? diff --git a/src/amber_cli/amber_release.cr b/src/amber_cli/amber_release.cr index a924cab..8f9f74b 100644 --- a/src/amber_cli/amber_release.cr +++ b/src/amber_cli/amber_release.cr @@ -4,10 +4,10 @@ module AmberCLI # it. A release of Amber CLI that moves to a new Amber release changes all of # them together. module AmberRelease - VERSION = "2.0.0-beta.10" - COMMIT = "d775841a0af43bf512f1c9b704906fccdf8863f7" - TREE = "e06f26daef02a30e91114b2c71224920e0c097de" + VERSION = "2.0.0-beta.11" + COMMIT = "f987f1bb19b789f8f14b000b6ee00ed496fe6cbb" + TREE = "fc2433e6cf3b55fc779977cc70b1270c7910c920" # What Minecart 2025.11.25.9 and newer record for this tree in `shard.lock`. - CHECKSUM = "sha256-v2:e1099a4f7a25db316b2abdf80f999a2753a0fcc056834f3abe6d9b5a88ae945d" + CHECKSUM = "sha256-v2:732bd8a19fed53e2e8ef0ee768dab03466abf502324d55de5f81961ac75456fa" end end diff --git a/src/amber_cli/commands/generate.cr b/src/amber_cli/commands/generate.cr index 8efcdff..625327f 100644 --- a/src/amber_cli/commands/generate.cr +++ b/src/amber_cli/commands/generate.cr @@ -308,7 +308,7 @@ RETRIES # #{class_name}.new.enqueue(delay: 5.minutes) # #{class_name}.new.enqueue(queue: "critical") # -# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.10/docs/guides/background-jobs.md +# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.11/docs/guides/background-jobs.md class #{class_name} < Amber::Jobs::Job include JSON::Serializable @@ -406,7 +406,7 @@ METHOD # .subject("Welcome!") # .deliver # -# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.10/docs/guides/mailer.md +# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.11/docs/guides/mailer.md class #{class_name}Mailer < Amber::Mailer::Base def initialize(@user_name : String, @user_email : String) end @@ -612,7 +612,7 @@ SPEC # Clients subscribe to this channel through a ClientSocket. # Messages sent to this channel are handled by `handle_message`. # -# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.10/docs/guides/websockets.md +# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.11/docs/guides/websockets.md class #{class_name}Channel < Amber::WebSockets::Channel # Called when a client subscribes to this channel. # Use this for authorization or sending initial state. @@ -643,7 +643,7 @@ CHANNEL # Configure in config/routes.cr: # websocket "/#{file_name}", #{class_name}Socket # -# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.10/docs/guides/websockets.md +# See: https://github.com/amberframework/amber/blob/v2.0.0-beta.11/docs/guides/websockets.md struct #{class_name}Socket < Amber::WebSockets::ClientSocket channel "#{file_name}:*", #{class_name}Channel diff --git a/src/amber_cli/commands/new_command.cr b/src/amber_cli/commands/new_command.cr index 73a2301..da8195e 100644 --- a/src/amber_cli/commands/new_command.cr +++ b/src/amber_cli/commands/new_command.cr @@ -1,5 +1,5 @@ require "../core/base_command" -require "../amber_release" +require "../pinned_releases" require "../generators/native_app" require "../static_assets" require "./setup_agent_command" @@ -295,35 +295,44 @@ module AmberCLI::Commands # Describes what is wrong with a generated application's `shard.lock`, or # returns nil when each dependency entry carries exactly one checksum and - # Amber is locked at `AmberRelease::COMMIT` with `AmberRelease::CHECKSUM`, - # or `AmberRelease::TREE` from a Minecart older than 2025.11.25.9. + # every release in `LIST_OF_PINNED_RELEASES` (Amber, Grant, asset_pipeline) + # is locked at its commit with its `sha256-v2:` checksum, or with its + # `git-tree:` checksum from a Minecart older than 2025.11.25.9. def self.minecart_lock_problem(lock : String) : String? entries = lock_entries(lock) if entries.empty? || entries.values.any? { |entry_lines| entry_lines.count { |line| LOCK_CHECKSUM_LINE.matches?(line) } != 1 } return "Minecart did not lock every dependency with exactly one checksum" end - amber_entry = entries["amber"]? - return "Minecart did not lock Amber" unless amber_entry - - expected_version = " version: #{AmberRelease::VERSION}+git.commit.#{AmberRelease::COMMIT}" - unless amber_entry.includes?(expected_version) && records_the_release_checksum?(amber_entry) - return "Minecart locked Amber at a revision other than v#{AmberRelease::VERSION} " \ - "(commit #{AmberRelease::COMMIT}, checksum #{AmberRelease::CHECKSUM})" + LIST_OF_PINNED_RELEASES.each do |release| + if problem = pinned_release_problem(entries, release) + return problem + end end nil end + private def self.pinned_release_problem(entries : Hash(String, Array(String)), release : PinnedRelease) : String? + entry_lines = entries[release.shard_name]? + return "Minecart did not lock #{release.display_name}" unless entry_lines + + expected_version = " version: #{release.version}+git.commit.#{release.commit}" + return nil if entry_lines.includes?(expected_version) && records_the_release_checksum?(entry_lines, release) + + "Minecart locked #{release.display_name} at a revision other than v#{release.version} " \ + "(commit #{release.commit}, checksum #{release.checksum})" + end + # A Windows checkout can rewrite line endings and has no executable bit, so it # hashes differently from the release. There the commit in the version line is # the pin, and the entry still has to carry exactly one checksum. - private def self.records_the_release_checksum?(amber_entry : Array(String)) : Bool + private def self.records_the_release_checksum?(entry_lines : Array(String), release : PinnedRelease) : Bool {% if flag?(:win32) %} true {% else %} - amber_entry.includes?(" checksum: #{AmberRelease::CHECKSUM}") || - amber_entry.includes?(" checksum: git-tree:#{AmberRelease::TREE}") + entry_lines.includes?(" checksum: #{release.checksum}") || + entry_lines.includes?(" checksum: git-tree:#{release.tree}") {% end %} end @@ -416,13 +425,13 @@ targets: dependencies: amber: github: amberframework/amber - commit: #{AmberRelease::COMMIT} # #{AmberRelease::VERSION} on v2-dev + commit: #{AmberRelease::COMMIT} # v#{AmberRelease::VERSION} grant: github: crimson-knight/grant - commit: 623c4bcad284fcee000244c8b26651f925e23ceb # 0.23.4 + commit: #{GrantRelease::COMMIT} # v#{GrantRelease::VERSION} asset_pipeline: github: amberframework/asset_pipeline - commit: ac630a4c948080bf45e9b1e66451c48da9a69349 # 0.37.1 + commit: #{AssetPipelineRelease::COMMIT} # v#{AssetPipelineRelease::VERSION} #{database_shard_dependency} SHARD @@ -493,7 +502,7 @@ server database. Set `DATABASE_URL` to override the environment YAML URL. ## Production configuration Set at least `AMBER_SERVER_SECRET_KEY_BASE`. See the -[Amber V2 beta guide](https://github.com/amberframework/amber/blob/v2.0.0-beta.10/docs/beta-installation.md). +[Amber V2 beta guide](https://github.com/amberframework/amber/blob/v2.0.0-beta.11/docs/beta-installation.md). ## What is on by default diff --git a/src/amber_cli/commands/setup_lsp_command.cr b/src/amber_cli/commands/setup_lsp_command.cr index 273b007..9d07c36 100644 --- a/src/amber_cli/commands/setup_lsp_command.cr +++ b/src/amber_cli/commands/setup_lsp_command.cr @@ -38,7 +38,7 @@ module AmberCLI::Commands content = <<-YAML # Amber LSP Configuration - # See: https://github.com/amberframework/amber/blob/v2.0.0-beta.10/docs/guides/lsp-setup.md + # See: https://github.com/amberframework/amber/blob/v2.0.0-beta.11/docs/guides/lsp-setup.md # Override built-in rule settings # rules: diff --git a/src/amber_cli/documentation.cr b/src/amber_cli/documentation.cr index 9a9d287..f3c6523 100644 --- a/src/amber_cli/documentation.cr +++ b/src/amber_cli/documentation.cr @@ -89,7 +89,7 @@ module AmberCLI::Documentation # - **.amber.yml** - Project configuration # - **.gitignore** - Git ignore rules # - # The web template pins Amber `2.0.0-beta.10`, uses ECR, and includes Grant, + # The web template pins Amber `2.0.0-beta.11`, uses ECR, and includes Grant, # Micrate-powered database commands, and the selected database driver. Model, # scaffold, and migration generators are supported. API-resource, # authentication, and native generators are preview surfaces during the beta. diff --git a/src/amber_cli/generators/native_app.cr b/src/amber_cli/generators/native_app.cr index f28f60f..14afa9e 100644 --- a/src/amber_cli/generators/native_app.cr +++ b/src/amber_cli/generators/native_app.cr @@ -118,7 +118,7 @@ dependencies: # Amber Framework V2 (patterns only, NO HTTP server for native apps) amber: github: amberframework/amber - commit: d291e0930dd22b14a2d10f75a9de063abb0e64e4 # v2.0.0-beta.10 + commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11 # Grant ORM (ActiveRecord-style, replaces Granite in V2) grant: diff --git a/src/amber_cli/pinned_releases.cr b/src/amber_cli/pinned_releases.cr new file mode 100644 index 0000000..69ee50c --- /dev/null +++ b/src/amber_cli/pinned_releases.cr @@ -0,0 +1,38 @@ +require "./amber_release" + +module AmberCLI + # One shard release that `amber new` writes into a new application's + # `shard.yml`, pinned by commit, with the checksums Minecart must record for + # it: `checksum` from Minecart 2025.11.25.9 and newer, and `git-tree:` + # from an older Minecart. + record PinnedRelease, + shard_name : String, + display_name : String, + version : String, + commit : String, + tree : String, + checksum : String + + # The Grant release that `amber new` pins (tag `v0.24.0`). + module GrantRelease + VERSION = "0.24.0" + COMMIT = "7bb4b9d45e74c490e6f3ad80cef8cc1cebd5b889" + TREE = "ac01af3a3edb7d881c798c755e0845ad04383225" + CHECKSUM = "sha256-v2:0c295bd9da92146c5482c63326adb402b24e33c152af86025a27f9da1a086f51" + end + + # The asset_pipeline release that `amber new` pins (tag `v0.38.0`). + module AssetPipelineRelease + VERSION = "0.38.0" + COMMIT = "73c89c3417a5282d9ac4179b283bcc660b7f898a" + TREE = "42caf3fc2d1af5e97417e7d7947dddd025e405e1" + CHECKSUM = "sha256-v2:80ea8ac95943a3c5be438e68c2ef2f00d9b9783f0787fcd67ef346f135d9510c" + end + + # Every release a generated application's `shard.lock` must record exactly. + LIST_OF_PINNED_RELEASES = [ + PinnedRelease.new("amber", "Amber", AmberRelease::VERSION, AmberRelease::COMMIT, AmberRelease::TREE, AmberRelease::CHECKSUM), + PinnedRelease.new("grant", "Grant", GrantRelease::VERSION, GrantRelease::COMMIT, GrantRelease::TREE, GrantRelease::CHECKSUM), + PinnedRelease.new("asset_pipeline", "asset_pipeline", AssetPipelineRelease::VERSION, AssetPipelineRelease::COMMIT, AssetPipelineRelease::TREE, AssetPipelineRelease::CHECKSUM), + ] +end diff --git a/src/amber_cli/templates/app/README.md.ecr b/src/amber_cli/templates/app/README.md.ecr index 4a9c4f8..c89aba4 100644 --- a/src/amber_cli/templates/app/README.md.ecr +++ b/src/amber_cli/templates/app/README.md.ecr @@ -1,6 +1,6 @@ # <%= @name %> -An ECR web application generated by Amber CLI for Amber `2.0.0-beta.10`. +An ECR web application generated by Amber CLI for Amber `2.0.0-beta.11`. ## Run it @@ -30,7 +30,7 @@ the app to target a server database. ## Production configuration Set at least `AMBER_SERVER_SECRET_KEY_BASE` and `AMBER_DATABASE_URL`. See the -[Amber V2 beta guide](https://github.com/amberframework/amber/blob/v2.0.0-beta.10/docs/beta-installation.md). +[Amber V2 beta guide](https://github.com/amberframework/amber/blob/v2.0.0-beta.11/docs/beta-installation.md). ## Tests diff --git a/src/amber_cli/templates/app/shard.yml.ecr b/src/amber_cli/templates/app/shard.yml.ecr index c3d9926..73181c5 100644 --- a/src/amber_cli/templates/app/shard.yml.ecr +++ b/src/amber_cli/templates/app/shard.yml.ecr @@ -15,13 +15,13 @@ targets: dependencies: amber: github: amberframework/amber - commit: d775841a0af43bf512f1c9b704906fccdf8863f7 # 2.0.0-beta.10 on v2-dev + commit: f987f1bb19b789f8f14b000b6ee00ed496fe6cbb # v2.0.0-beta.11 grant: github: crimson-knight/grant - commit: 623c4bcad284fcee000244c8b26651f925e23ceb # 0.23.4 + commit: 7bb4b9d45e74c490e6f3ad80cef8cc1cebd5b889 # v0.24.0 asset_pipeline: github: amberframework/asset_pipeline - commit: ac630a4c948080bf45e9b1e66451c48da9a69349 # 0.37.1 + commit: 73c89c3417a5282d9ac4179b283bcc660b7f898a # v0.38.0 <%# Grant ships its own Postgres and SQLite drivers; only MySQL needs a shard. -%> <% if @database == "mysql" -%> mysql: From f655754cc340fcd96acefa8c3353c501ce8bc5c3 Mon Sep 17 00:00:00 2001 From: crimson-knight Date: Fri, 20 Nov 2026 07:14:12 -0500 Subject: [PATCH 3/3] Put the macOS Crystal tarball's shards on PATH in the linkage job The darwin tarball ships shards only in embedded/bin, so Minecart could not run micrate's postinstall script. Add embedded/bin after bin. --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81559fe..109e0f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -228,7 +228,13 @@ jobs: "https://github.com/crystal-lang/crystal/releases/download/$CRYSTAL_VERSION/$CRYSTAL_TARBALL" echo "$CRYSTAL_SHA256 $archive" | shasum -a 256 -c - tar -xzf "$archive" -C "$RUNNER_TEMP" - echo "$RUNNER_TEMP/crystal-$CRYSTAL_VERSION-1/bin" >> "$GITHUB_PATH" + crystal_root="$RUNNER_TEMP/crystal-$CRYSTAL_VERSION-1" + # The macOS tarball keeps shards only in embedded/bin, and Minecart runs shards + # for postinstall scripts. Each GITHUB_PATH line goes in front, so bin/ wins. + if [[ -d "$crystal_root/embedded/bin" ]]; then + echo "$crystal_root/embedded/bin" >> "$GITHUB_PATH" + fi + echo "$crystal_root/bin" >> "$GITHUB_PATH" - name: Build pinned Minecart run: scripts/install_pinned_minecart.sh