Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.47.5"
"flutter": "3.50.0-0.1.pre"
}
4 changes: 3 additions & 1 deletion .github/actions/setup-flutter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ runs:
{
printf 'flutter-version=%s\n' "$version"
printf 'dart-version=%s\n' "$(printf '%s' "$release" | jq -r '.dart')"
printf 'channel=%s\n' "$(printf '%s' "$release" | jq -r '.channel // "stable"')"
printf 'sha256=%s\n' "$(printf '%s' "$release" | jq -r '.sha256')"
} >> "$GITHUB_OUTPUT"

Expand All @@ -61,11 +62,12 @@ runs:
shell: bash
env:
FLUTTER_VERSION: ${{ steps.release.outputs.flutter-version }}
FLUTTER_CHANNEL: ${{ steps.release.outputs.channel }}
FLUTTER_ARCHIVE_SHA256: ${{ steps.release.outputs.sha256 }}
FLUTTER_ARCHIVE: ${{ runner.temp }}/flutter-archive/${{ steps.release.outputs.flutter-version }}/flutter.tar.xz
run: |
set -euo pipefail
archive_url="https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz"
archive_url="https://storage.googleapis.com/flutter_infra_release/releases/${FLUTTER_CHANNEL}/linux/flutter_linux_${FLUTTER_VERSION}-${FLUTTER_CHANNEL}.tar.xz"
mkdir -p "$(dirname "$FLUTTER_ARCHIVE")"
if [ ! -f "$FLUTTER_ARCHIVE" ]; then
curl --fail --location --silent --show-error \
Expand Down
25 changes: 13 additions & 12 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@
- `example`: sample usage.

## Environment and setup
- Required SDKs: Dart `>=3.9.0 <4.0.0`, Flutter `>=3.35.0` (see `/pubspec.yaml`).
- Required SDKs: Dart `>=3.14.0-315.1.beta <4.0.0`, Flutter `>=3.50.0-0.1.pre` (see `/pubspec.yaml`).
- CI pins Flutter to the version in `/.fvmrc`. Add a new version to `/.github/flutter-releases.json` with its checksum before a workflow may install it.
- Use from repo root:
1. `dart pub get`
2. `dart run melos bootstrap`
- Optional one-shot setup script: `./setup.sh` (validates the Flutter SDK, bootstraps the workspace, and installs Node tools when npm is available).
2. `dart pub global activate melos 8.9.0` (must match the exact root dev dependency)
3. `dart pub global run melos bootstrap`
- Optional one-shot setup script: `./setup.sh` (validates the Flutter SDK, activates the pinned Melos CLI, bootstraps the workspace, and installs Node tools when npm is available).

## Commands you should run
- Full CI-equivalent local check: `dart run melos run test --no-select`
- Full CI-equivalent local check: `dart pub global run melos run test --no-select`
- Runs strict analyze (`dart analyze . --fatal-infos`) and package tests.
- Useful targeted commands:
- `dart run melos run analyze`
- `dart run melos run test:dart`
- `dart run melos run test:flutter`
- `dart run melos run build` (when generator-related code changes)
- `dart run melos run test:gen` (for generator changes)
- `dart run melos run validate-jsonschema` (for JSON Schema conformance tooling)
- `dart pub global run melos run analyze`
- `dart pub global run melos run test:dart`
- `dart pub global run melos run test:flutter`
- `dart pub global run melos run build` (when generator-related code changes)
- `dart pub global run melos run test:gen` (for generator changes)
- `dart pub global run melos run validate-jsonschema` (for JSON Schema conformance tooling)

## Change-scope guidance
- Keep changes minimal and package-scoped; do not refactor unrelated files.
Expand All @@ -44,12 +45,12 @@
- `/.github/workflows/release.yml` verifies the tag with `dart scripts/verify_release_tag.dart` and reruns the preflight before it publishes.
- Conventional Commits are expected for commit messages.
- Versioning and tag-only publishing are documented in `/PUBLISHING.md`.
Use `dart run melos version` to prepare versions; publication runs only from
Use `dart pub global run melos version` to prepare versions; publication runs only from
a reviewed `v*` tag through the release workflow.

## Errors encountered during onboarding and workarounds
1. **Error:** `melos: command not found` when running checks in a fresh environment.
**Workaround:** resolve root dependencies with `dart pub get`, then invoke the workspace-local executable via `dart run melos ...`.
**Workaround:** complete the global Melos activation in the setup steps above, then use `dart pub global run melos ...`; a global executable `PATH` entry is not needed. Root dependency resolution alone does not install the global CLI.
2. **Error:** `dart: command not found` in bare sandbox environments.
**Workaround:** install Flutter (which includes Dart), then run `./setup.sh`.
3. **Observed CI state:** workflow run may show `conclusion: action_required` with no jobs for PR contexts awaiting approval/permissions.
Expand Down
5 changes: 5 additions & 0 deletions .github/flutter-releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"3.47.5": {
"dart": "3.13.4",
"sha256": "2132e990f236f8d22e7c6314b29a191a95b10d7cbcfec9b4e2e303d996652cbb"
},
"3.50.0-0.1.pre": {
"dart": "3.14.0-315.1.beta",
"channel": "beta",
"sha256": "62f0ae902d0feb380e45e257777132c3dd37800278cc69561393bfe2be8da53c"
}
}
}
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@ jobs:
- name: Resolve workspace dependencies
run: dart pub get

- name: Activate the pinned Melos CLI
run: dart pub global activate melos 8.9.0

- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
run: dart run scripts/format.dart --output=none --set-exit-if-changed

- name: Analyze and test every package
run: dart run melos run ci --no-select
run: dart pub global run melos run ci --no-select

- name: Test numeric parity and JSON Schema imports in Chrome
working-directory: packages/ack
run: |
dart test --platform chrome \
dart --enable-experiment=augmentations test --platform chrome \
test/schemas/numeric_platform_parity_test.dart \
test/schemas/extensions/numeric_extensions_test.dart \
test/schemas/extensions/list_schema_extensions_test.dart \
Expand All @@ -54,4 +57,8 @@ jobs:

- name: Test JSON Schema import bridge in Chrome
working-directory: packages/ack_json_schema_builder
run: dart test --platform chrome test/from_json_schema_builder_test.dart
run: dart --enable-experiment=augmentations test --platform chrome test/from_json_schema_builder_test.dart

- name: Test augmented models in Chrome
working-directory: example
run: dart --enable-experiment=augmentations test --platform chrome test/class_first_models_test.dart
19 changes: 10 additions & 9 deletions .github/workflows/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ env:
# against the change severity, so a breaking change requires a major bump.
API_BASELINE_VERSION: '1.6.2'
# The lowest SDK versions that packages/*/pubspec.yaml accept.
MINIMUM_DART_VERSION: '3.11.0'
MINIMUM_FLUTTER_VERSION: '3.41.2'
MINIMUM_DART_VERSION: '3.14.0-315.1.beta'
MINIMUM_FLUTTER_VERSION: '3.50.0-0.1.pre'


jobs:
Expand All @@ -46,10 +46,8 @@ jobs:
- name: Resolve workspace dependencies
run: dart pub get

# The complete workspace cannot resolve on the minimum SDK, because
# flutter_test pins an older test_api than ack_generator's analyzer floor
# allows. The pure-Dart members still must resolve, so they get their own
# staged workspace.
# Stage pure-Dart members without Flutter's SDK packages to verify that
# consumers using the standalone minimum Dart SDK can resolve them.
- name: Stage the pure-Dart workspace
run: dart scripts/stage_min_sdk_workspace.dart "${{ runner.temp }}/min-dart"

Expand Down Expand Up @@ -86,7 +84,7 @@ jobs:
echo "::group::$package"
(cd "$package" && dart analyze . --fatal-infos)
if [ -d "$package/test" ]; then
(cd "$package" && dart test)
(cd "$package" && dart --enable-experiment=augmentations test)
fi
echo "::endgroup::"
done
Expand Down Expand Up @@ -123,7 +121,7 @@ jobs:
set -euo pipefail
flutter pub get
flutter analyze --fatal-infos
flutter test
flutter test --enable-experiment=augmentations

json-schema-draft7:
name: JSON Schema Draft-7 batch validation
Expand Down Expand Up @@ -193,6 +191,9 @@ jobs:
- name: Resolve workspace dependencies
run: dart pub get

- name: Activate the pinned Melos CLI
run: dart pub global activate melos 8.9.0

# `.g.dart` holds the generated Ack models, schemas, and JSON mapping.
# A clean rebuild must reproduce them identically.
- name: Delete the committed generator output
Expand All @@ -202,7 +203,7 @@ jobs:
| xargs -0 --no-run-if-empty rm --

- name: Regenerate from a clean tree
run: dart run melos run build --no-select
run: dart pub global run melos run build --no-select

- name: Require the regenerated output to match the repository
run: |
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Breaking & Substitutions

* Target Dart 3.14 / Flutter 3.50 using the available prerelease toolchain.
Class-first model augmentations replace generated mixins and handwritten
schema/parsing forwarders; primary-constructor examples need only fields and
annotations. See the SDK setup and migration guide for experiment flags.

* **Single `.g.dart` part & direct JSON emitter (`#189`)**: `ack_generator:ack_generator`
now emits a single `<file>.g.dart` part via `SharedPartBuilder` with direct
`toJson()` / `fromJson()` helpers (no `json_serializable` or `json_annotation`
Expand Down Expand Up @@ -83,6 +88,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Fixed

* Preserve child validation on inherited primary-constructor fields and support
model fields named `dynamic` or `override` in generated augmentations.
* Update the pinned API-audit tool to recognize primary constructors and public
names of private named field parameters correctly.
* Explicit Draft-7 export rejects unsupported Draft 2020-12 assertions rather
than emitting keywords that Draft-7 validators ignore.
* Imported schema exports preserve JSON Pointer targets through retrieval URI
Expand Down
30 changes: 23 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,29 @@ review. By participating, you agree to follow the

## Development setup

The workspace uses Flutter `3.50.0-0.1.pre` / Dart `3.14.0-315.1.beta`.
Install/select the SDK pinned by `.fvmrc` before running commands (for example,
`fvm use` and `fvm dart ...`). Do not use a global older Dart SDK.
The analyzer configuration and Melos commands enable experimental augmentations.

Melos requires a globally activated CLI matching the exact workspace version.
`./setup.sh` performs the setup below and installs optional Node tooling when
npm is available. To set up manually:

```bash
dart pub get
dart run melos bootstrap
dart pub global activate melos 8.9.0
dart pub global run melos bootstrap
```

Ack uses a Melos workspace. Run commands from the repository root unless a
package README says otherwise.
package README says otherwise. Use `dart pub global run melos ...` so the
activated CLI does not need to be on `PATH`.

Use `dart pub global run melos run format` to format authored sources. The beta
SDK's formatter does not preserve `augment` declarations, so this command
excludes generated `.g.dart` files. The generator formats those files itself;
CI checks them by regenerating from a clean tree.

## Before opening a PR

Expand All @@ -23,22 +39,22 @@ package README says otherwise.
4. Run the relevant checks:

```bash
dart run melos run analyze
dart run melos run test
dart pub global run melos run analyze
dart pub global run melos run test
```

For code generation changes, also run:

```bash
dart run melos run test:gen
dart pub global run melos run test:gen
```

The generator suite is memory-heavy: nine tests tagged `integration` run
real `build_runner` builds in temporary packages. For a quick check while
iterating, skip them:

```bash
dart run melos run test:gen:unit
dart pub global run melos run test:gen:unit
```

Run the full `test:gen` before opening the PR. Run one generator suite at a
Expand All @@ -50,7 +66,7 @@ Tag any new test that runs a real `build_runner` build with
For JSON Schema export changes, also run:

```bash
dart run melos run validate-jsonschema
dart pub global run melos run validate-jsonschema
```

## Commit style
Expand Down
12 changes: 7 additions & 5 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ References: [Melos versioning](https://melos.invertase.dev/commands/version),

1. Check pub.dev and tags before selecting the version; published versions and
their changelog sections are immutable.
2. Start a release branch from current `origin/main` and resolve dependencies:
2. Complete [development setup](./CONTRIBUTING.md#development-setup), including
the pinned global Melos CLI. Start a release branch from current `origin/main`
and resolve dependencies:

```sh
dart pub get
Expand All @@ -57,13 +59,13 @@ References: [Melos versioning](https://melos.invertase.dev/commands/version),
3. Preview/prepare a coordinated version without creating commits or tags:

```sh
dart run melos version --manual-version=ack:2.0.0-alpha.1 --yes --no-git-commit-version
dart pub global run melos version --manual-version=ack:2.0.0-alpha.1 --yes --no-git-commit-version
```

Use the named flag, not a positional package argument: the positional form
selects a package instead of requesting a coordinated version. Choose the
next SemVer value for later releases. Normal automatic selection is also available with
`dart run melos version --yes --no-git-commit-version` after reviewing commits.
`dart pub global run melos version --yes --no-git-commit-version` after reviewing commits.
Do not pass `--all`: that would include private packages. Melos fetches tags
through Git; a new local branch needs an upstream before this command runs.

Expand All @@ -85,10 +87,10 @@ References: [Melos versioning](https://melos.invertase.dev/commands/version),

```sh
dart scripts/verify_release_tag.dart v2.0.0-alpha.1 --skip-ancestry
dart run melos run ci
dart pub global run melos run ci
dart scripts/api_check.dart 1.6.2
dart scripts/publish_dry_run.dart
dart run melos run validate-jsonschema:batch
dart pub global run melos run validate-jsonschema:batch
```

`--skip-ancestry` is only for preparing a version before the tag exists.
Expand Down
Loading
Loading