diff --git a/.github/flutter-releases.json b/.github/flutter-releases.json index b68dbb74..ebf49786 100644 --- a/.github/flutter-releases.json +++ b/.github/flutter-releases.json @@ -16,6 +16,10 @@ "3.47.5": { "dart": "3.13.4", "sha256": "2132e990f236f8d22e7c6314b29a191a95b10d7cbcfec9b4e2e303d996652cbb" + }, + "3.50.1": { + "dart": "3.14.0", + "sha256": "4ad17fc8462fbcef2ba19ff4a78c0a16b7147fde1add8578e267ea62cdb92678" } } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d82b2881..cab2ccb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,10 +24,18 @@ jobs: # That reference was mutable and its FVM step piped an unverified installer # into a shell, so every run could execute code that nobody reviewed here. # The checks now live in this repository and pin every dependency. - name: Run tests for all packages + name: ${{ matrix.flutter-version == '' && 'Run tests for all packages' || format('Run tests for all packages ({0})', matrix.sdk) }} if: "github.event_name != 'pull_request' || github.event.pull_request.draft == false" runs-on: ubuntu-24.04 timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + include: + - sdk: pinned Flutter + flutter-version: '' + - sdk: Flutter 3.50.1 + flutter-version: '3.50.1' steps: - name: Checkout repository uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 @@ -36,6 +44,8 @@ jobs: - name: Set up the pinned Flutter SDK uses: ./.github/actions/setup-flutter + with: + flutter-version: ${{ matrix.flutter-version }} - name: Resolve workspace dependencies run: dart pub get @@ -46,22 +56,51 @@ jobs: - name: Analyze and test every package run: dart run melos run ci --no-select - - name: Test numeric parity and JSON Schema imports in Chrome + - name: Test Ack runtime in Chrome + working-directory: packages/ack + run: | + tests=() + for path in test/*_test.dart test/*/*_test.dart test/schemas/extensions/*_test.dart; do + case "$path" in + # JSON Schema suites run separately below. + test/json_schema_*) continue ;; + # These suites read local files or run a Dart subprocess. + test/runtime_dependencies_test.dart|\ + test/schemas/local_date_timezone_test.dart|\ + test/schemas/object_presence_characterization_test.dart|\ + test/documentation/core_concepts_json_serialization_examples_test.dart|\ + test/documentation/documentation_source_integrity_test.dart|\ + test/documentation/getting_started_installation_examples_test.dart|\ + test/documentation/overview_doc_examples_test.dart) continue ;; + esac + tests+=("$path") + done + dart test --platform chrome "${tests[@]}" + + - name: Test JSON Schema imports, conformance, and formats in Chrome working-directory: packages/ack run: | - dart test --platform chrome \ - test/schemas/numeric_platform_parity_test.dart \ - test/schemas/duration_range_test.dart \ - test/schemas/nullability_export_contract_test.dart \ - test/schemas/extensions/numeric_extensions_test.dart \ - test/schemas/extensions/list_schema_extensions_test.dart \ - test/utils/collection_utils_test.dart \ - test/json_schema_idna_decode_failure_test.dart \ - test/json_schema_import_test.dart \ - test/json_schema_bundled_dialect_test.dart \ - test/json_schema_vocabulary_contract_test.dart \ - test/json_schema_import_api_test.dart + tests=() + for path in test/json_schema_*_test.dart; do + case "$path" in + # These suites use the file system or external validators. + test/json_schema_conformance_test.dart|\ + test/json_schema_fixture_corpus_test.dart|\ + test/json_schema_import_a2ui_test.dart|\ + test/json_schema_import_public_api_test.dart) continue ;; + esac + tests+=("$path") + done + dart test --platform chrome "${tests[@]}" - - name: Test JSON Schema import bridge in Chrome + - name: Test the JSON Schema builder adapter in Chrome working-directory: packages/ack_json_schema_builder - run: dart test --platform chrome test/from_json_schema_builder_test.dart + run: dart test --platform chrome test + + - name: Test the MCP adapter in Chrome + working-directory: packages/ack_mcp_dart + run: dart test --platform chrome test + + - name: Test generated models and codec examples in Chrome + working-directory: example + run: dart test --platform chrome test diff --git a/PUBLISHING.md b/PUBLISHING.md index 0c8432e2..7e5234a6 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -38,9 +38,8 @@ 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 from the appropriate release line: current `origin/main` for a stable - release, or the existing `origin/release/.` branch for a - prerelease. Resolve dependencies: +2. Branch from the current `origin/main` for a stable release. For a prerelease, + you can also branch from `origin/release/.`. Resolve dependencies. ```sh dart pub get @@ -49,7 +48,7 @@ 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-beta.3 --yes --no-git-commit-version + dart run melos version --manual-version=ack:2.0.0 --yes --no-git-commit-version ``` Use the named flag, not a positional package argument: the positional form @@ -59,27 +58,31 @@ References: [Melos versioning](https://melos.invertase.dev/commands/version), 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. -4. Review generated changelogs and retain substantive release notes; move only - unreleased notes into the new section, preserving every published section. - Update installation snippets to match each package's version. Under - `plugins/ack`, bump the Claude, Codex, and Cursor `plugin.json` versions, - the baseline constraint in `skills/using-ack/SKILL.md`, and the version-matched - repository links in the skills to the new release tag. -5. Compare against the most recent coordinated stable release in - `API_BASELINE_VERSION` in `.github/workflows/preflight.yml` (currently - `1.7.0`). Keep that stable baseline for prereleases, so a prerelease cannot hide a - breaking change since the last stable version. Raise it after the next - stable release. Record a new - package's actual first release in `ackPackageFirstReleases` in - `scripts/src/workspace_packages.dart`; - checks skip only older baselines. `ack_mcp_dart` first released at 1.3.0. +4. Review generated changelogs and preserve every published section. Write each + package's `## 2.0.0` entry as a net summary of changes since the last stable + release, 1.7.1. Use the Unreleased notes and include changes from prereleases + that still apply to 2.0.0. + + Raise sibling `ack` constraints to the release version. For 2.0.0, set + `ack: ^2.0.0` in the four sibling packages. In `example/pubspec.yaml`, set + `ack: ^2.0.0` and `ack_generator: ^2.0.0`. Update installation snippets to + match each package's version. Under `plugins/ack`, bump the Claude, Codex, + and Cursor `plugin.json` versions, the baseline constraint in + `skills/using-ack/SKILL.md`, and the version-matched repository links in the + skills to the new release tag. +5. Compare against the stable API baseline configured by `API_BASELINE_VERSION` + in `.github/workflows/preflight.yml` (currently `1.7.0`). Keep that baseline + through prereleases to catch breaking changes from the stable API. Raise it + after the next stable release. Record a new package's actual first release + in `ackPackageFirstReleases` in `scripts/src/workspace_packages.dart`. + Checks skip only older baselines. `ack_mcp_dart` first released at 1.3.0. 6. Commit the reviewed version, changelog, and documentation changes locally before the publish dry run. Pub treats modified tracked package files as a warning, and this repository requires zero warnings. 7. Validate the complete release from that clean commit: ```sh - dart scripts/verify_release_tag.dart v2.0.0-beta.3 --skip-ancestry + dart scripts/verify_release_tag.dart v2.0.0 --skip-ancestry dart run melos run ci dart scripts/api_check.dart 1.7.0 dart scripts/publish_dry_run.dart @@ -87,8 +90,9 @@ References: [Melos versioning](https://melos.invertase.dev/commands/version), ``` `--skip-ancestry` is only for preparing a version before the tag exists. - The actual release workflow always enforces ancestry on `origin/main` (or the - matching `origin/release/.` branch for pre-release tags). + The workflow requires stable tags to be reachable from `origin/main`. For + prerelease tags, it also accepts commits on the matching + `origin/release/.` branch. CI also runs minimum Dart/Flutter SDK checks, deterministic generation, and staged hosted-dependency analysis; all must pass on the release merge commit. 8. Review and merge the release PR before creating the tag. @@ -110,17 +114,17 @@ for the original procedure. After the release commit's CI/preflight succeeds: ```sh -git fetch origin main release/2.0 --tags -# Use the exact reviewed release merge commit, not an arbitrary later main head. -git tag -a v2.0.0-beta.3 -m 'Ack 2.0.0 beta 3' -dart scripts/verify_release_tag.dart v2.0.0-beta.3 --main-ref=origin/release/2.0 -git push origin v2.0.0-beta.3 +git fetch origin main --tags +# Substitute the exact reviewed release merge commit. +git tag -a v2.0.0 -m 'Ack 2.0.0' +dart scripts/verify_release_tag.dart v2.0.0 --main-ref=origin/main +git push origin v2.0.0 ``` -These commands target the 2.0 prerelease branch. If the release PR is merged -into `main`, tag that reviewed merge commit after its CI passes and verify -with `--main-ref=origin/main` instead. Stable release tags must also be -reachable from `origin/main`; use the verifier's default main reference for them. +Use the reviewed merge commit on `origin/main` after CI passes. For a prerelease, +substitute the prerelease version and tag in the commands above. If its reviewed +merge commit is on `release/.`, fetch that branch and verify the tag +with `--main-ref=origin/release/.` before pushing it. Pushing the tag triggers `.github/workflows/release.yml`; there is no Melos publish/release script. The workflow verifies the tag, reruns release preflight, @@ -146,7 +150,6 @@ missing version. Rerun failed jobs on the **same tag**; never move a published t or republish different contents under an existing version. After all five exact versions are visible, create the GitHub Release from the -existing tag using the prepared release notes and mark it as a prerelease for -alpha/beta versions. Before the first subsequent code -change, begin a new unreleased changelog section instead of editing the -2.0.0-beta.3 notes (and preserve every earlier published section). +existing tag using the prepared release notes. Mark it as a prerelease for a +prerelease tag. Open a new `## Unreleased` changelog section for the next code +change and preserve all published notes. diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/README.md b/packages/ack/test/fixtures/json_schema_2020_12_full/README.md index 85e1578f..8950509d 100644 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/README.md +++ b/packages/ack/test/fixtures/json_schema_2020_12_full/README.md @@ -1,7 +1,7 @@ # Pinned JSON Schema Test Suite -This directory vendors the **complete** `tests/draft2020-12/` tree and the -suite's `remotes/` fixtures from +This directory vendors all required `tests/draft2020-12/` fixtures, the +optional format cases exercised by Ack, and the suite's `remotes/` fixtures from [JSON-Schema-Test-Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) commit `80c87e8fca8b207a7a7ae944b875f0fcf889f46a` (MIT; see `LICENSE`). The GitHub archive SHA-256 is @@ -14,6 +14,5 @@ for diff hygiene. They are intended for fully offline validation: URLs under subset in `../json_schema_import/` remains a separate regression corpus. Do not count the presence of these files as a conformance pass. The conformance -tests exercise every required group, plus the optional format-assertion groups -in their correct modes, without silent skips. Other optional groups are not -claimed as complete. +tests exercise every required group and the optional format-assertion groups +in their respective modes. diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/anchor.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/anchor.json deleted file mode 100644 index 6d6713be..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/anchor.json +++ /dev/null @@ -1,60 +0,0 @@ -[ - { - "description": "$anchor inside an enum is not a real identifier", - "comment": "the implementation must not be confused by an $anchor buried in the enum", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$defs": { - "anchor_in_enum": { - "enum": [ - { - "$anchor": "my_anchor", - "type": "null" - } - ] - }, - "real_identifier_in_schema": { - "$anchor": "my_anchor", - "type": "string" - }, - "zzz_anchor_in_const": { - "const": { - "$anchor": "my_anchor", - "type": "null" - } - } - }, - "anyOf": [ - { "$ref": "#/$defs/anchor_in_enum" }, - { "$ref": "#my_anchor" } - ] - }, - "tests": [ - { - "description": "exact match to enum, and type matches", - "data": { - "$anchor": "my_anchor", - "type": "null" - }, - "valid": true - }, - { - "description": "in implementations that strip $anchor, this may match either $def", - "data": { - "type": "null" - }, - "valid": false - }, - { - "description": "match $ref to $anchor", - "data": "a string to match #/$defs/anchor_in_enum", - "valid": true - }, - { - "description": "no match on enum or $ref to $anchor", - "data": 1, - "valid": false - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/bignum.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/bignum.json deleted file mode 100644 index d69b29e8..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/bignum.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "description": "integer", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "integer" - }, - "tests": [ - { - "description": "a bignum is an integer", - "data": 12345678910111213141516171819202122232425262728293031, - "valid": true - }, - { - "description": "a negative bignum is an integer", - "data": -12345678910111213141516171819202122232425262728293031, - "valid": true - } - ] - }, - { - "description": "number", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "number" - }, - "tests": [ - { - "description": "a bignum is a number", - "data": 98249283749234923498293171823948729348710298301928331, - "valid": true - }, - { - "description": "a negative bignum is a number", - "data": -98249283749234923498293171823948729348710298301928331, - "valid": true - } - ] - }, - { - "description": "string", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string" - }, - "tests": [ - { - "description": "a bignum is not a string", - "data": 98249283749234923498293171823948729348710298301928331, - "valid": false - } - ] - }, - { - "description": "maximum integer comparison", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "maximum": 18446744073709551615 - }, - "tests": [ - { - "description": "comparison works for high numbers", - "data": 18446744073709551600, - "valid": true - } - ] - }, - { - "description": "float comparison with high precision", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "exclusiveMaximum": 972783798187987123879878123.18878137 - }, - "tests": [ - { - "description": "comparison works for high numbers", - "data": 972783798187987123879878123.188781371, - "valid": false - } - ] - }, - { - "description": "minimum integer comparison", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "minimum": -18446744073709551615 - }, - "tests": [ - { - "description": "comparison works for very negative numbers", - "data": -18446744073709551600, - "valid": true - } - ] - }, - { - "description": "float comparison with high precision on negative numbers", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "exclusiveMinimum": -972783798187987123879878123.18878137 - }, - "tests": [ - { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, - "valid": false - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/cross-draft.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/cross-draft.json deleted file mode 100644 index 5113bd64..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/cross-draft.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "description": "refs to historic drafts are processed as historic drafts", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "array", - "$ref": "http://localhost:1234/draft2019-09/ignore-prefixItems.json" - }, - "tests": [ - { - "description": "first item not a string is valid", - "comment": "if the implementation is not processing the $ref as a 2019-09 schema, this test will fail", - "data": [1, 2, 3], - "valid": true - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/dependencies-compatibility.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/dependencies-compatibility.json deleted file mode 100644 index 47d5bd79..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/dependencies-compatibility.json +++ /dev/null @@ -1,282 +0,0 @@ -[ - { - "description": "single dependency", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "dependencies": {"bar": ["foo"]} - }, - "tests": [ - { - "description": "neither", - "data": {}, - "valid": true - }, - { - "description": "nondependant", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "with dependency", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "missing dependency", - "data": {"bar": 2}, - "valid": false - }, - { - "description": "ignores arrays", - "data": ["bar"], - "valid": true - }, - { - "description": "ignores strings", - "data": "foobar", - "valid": true - }, - { - "description": "ignores other non-objects", - "data": 12, - "valid": true - } - ] - }, - { - "description": "empty dependents", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "dependencies": {"bar": []} - }, - "tests": [ - { - "description": "empty object", - "data": {}, - "valid": true - }, - { - "description": "object with one property", - "data": {"bar": 2}, - "valid": true - }, - { - "description": "non-object is valid", - "data": 1, - "valid": true - } - ] - }, - { - "description": "multiple dependents required", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "dependencies": {"quux": ["foo", "bar"]} - }, - "tests": [ - { - "description": "neither", - "data": {}, - "valid": true - }, - { - "description": "nondependants", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "with dependencies", - "data": {"foo": 1, "bar": 2, "quux": 3}, - "valid": true - }, - { - "description": "missing dependency", - "data": {"foo": 1, "quux": 2}, - "valid": false - }, - { - "description": "missing other dependency", - "data": {"bar": 1, "quux": 2}, - "valid": false - }, - { - "description": "missing both dependencies", - "data": {"quux": 1}, - "valid": false - } - ] - }, - { - "description": "dependencies with escaped characters", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "dependencies": { - "foo\nbar": ["foo\rbar"], - "foo\"bar": ["foo'bar"] - } - }, - "tests": [ - { - "description": "CRLF", - "data": { - "foo\nbar": 1, - "foo\rbar": 2 - }, - "valid": true - }, - { - "description": "quoted quotes", - "data": { - "foo'bar": 1, - "foo\"bar": 2 - }, - "valid": true - }, - { - "description": "CRLF missing dependent", - "data": { - "foo\nbar": 1, - "foo": 2 - }, - "valid": false - }, - { - "description": "quoted quotes missing dependent", - "data": { - "foo\"bar": 2 - }, - "valid": false - } - ] - }, - { - "description": "single schema dependency", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "dependencies": { - "bar": { - "properties": { - "foo": {"type": "integer"}, - "bar": {"type": "integer"} - } - } - } - }, - "tests": [ - { - "description": "valid", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "no dependency", - "data": {"foo": "quux"}, - "valid": true - }, - { - "description": "wrong type", - "data": {"foo": "quux", "bar": 2}, - "valid": false - }, - { - "description": "wrong type other", - "data": {"foo": 2, "bar": "quux"}, - "valid": false - }, - { - "description": "wrong type both", - "data": {"foo": "quux", "bar": "quux"}, - "valid": false - }, - { - "description": "ignores arrays", - "data": ["bar"], - "valid": true - }, - { - "description": "ignores strings", - "data": "foobar", - "valid": true - }, - { - "description": "ignores other non-objects", - "data": 12, - "valid": true - } - ] - }, - { - "description": "boolean subschemas", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "dependencies": { - "foo": true, - "bar": false - } - }, - "tests": [ - { - "description": "object with property having schema true is valid", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "object with property having schema false is invalid", - "data": {"bar": 2}, - "valid": false - }, - { - "description": "object with both properties is invalid", - "data": {"foo": 1, "bar": 2}, - "valid": false - }, - { - "description": "empty object is valid", - "data": {}, - "valid": true - } - ] - }, - { - "description": "schema dependencies with escaped characters", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "dependencies": { - "foo\tbar": {"minProperties": 4}, - "foo'bar": {"required": ["foo\"bar"]} - } - }, - "tests": [ - { - "description": "quoted tab", - "data": { - "foo\tbar": 1, - "a": 2, - "b": 3, - "c": 4 - }, - "valid": true - }, - { - "description": "quoted quote", - "data": { - "foo'bar": {"foo\"bar": 1} - }, - "valid": false - }, - { - "description": "quoted tab invalid under dependent schema", - "data": { - "foo\tbar": 1, - "a": 2 - }, - "valid": false - }, - { - "description": "quoted quote invalid under dependent schema", - "data": {"foo'bar": 1}, - "valid": false - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/dynamicRef.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/dynamicRef.json deleted file mode 100644 index 7e63f209..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/dynamicRef.json +++ /dev/null @@ -1,56 +0,0 @@ -[ - { - "description": "$dynamicRef skips over intermediate resources - pointer reference across resource boundary", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/optional/main", - "type": "object", - "properties": { - "bar-item": { - "$ref": "bar#/$defs/item" - } - }, - "$defs": { - "bar": { - "$id": "bar", - "type": "array", - "items": { - "$ref": "item" - }, - "$defs": { - "item": { - "$id": "item", - "type": "object", - "properties": { - "content": { - "$dynamicRef": "#content" - } - }, - "$defs": { - "defaultContent": { - "$dynamicAnchor": "content", - "type": "integer" - } - } - }, - "content": { - "$dynamicAnchor": "content", - "type": "string" - } - } - } - } - }, - "tests": [ - { - "description": "integer property passes", - "data": { "bar-item": { "content": 42 } }, - "valid": true - }, - { - "description": "string property fails", - "data": { "bar-item": { "content": "value" } }, - "valid": false - } - ] - }] \ No newline at end of file diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/ecmascript-regex.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/ecmascript-regex.json deleted file mode 100644 index a4d62e0c..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/ecmascript-regex.json +++ /dev/null @@ -1,582 +0,0 @@ -[ - { - "description": "ECMA 262 regex $ does not match trailing newline", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^abc$" - }, - "tests": [ - { - "description": "matches in Python, but not in ECMA 262", - "data": "abc\\n", - "valid": false - }, - { - "description": "matches", - "data": "abc", - "valid": true - } - ] - }, - { - "description": "ECMA 262 regex converts \\t to horizontal tab", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\t$" - }, - "tests": [ - { - "description": "does not match", - "data": "\\t", - "valid": false - }, - { - "description": "matches", - "data": "\u0009", - "valid": true - } - ] - }, - { - "description": "ECMA 262 regex escapes control codes with \\c and upper letter", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\cC$" - }, - "tests": [ - { - "description": "does not match", - "data": "\\cC", - "valid": false - }, - { - "description": "matches", - "data": "\u0003", - "valid": true - } - ] - }, - { - "description": "ECMA 262 regex escapes control codes with \\c and lower letter", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\cc$" - }, - "tests": [ - { - "description": "does not match", - "data": "\\cc", - "valid": false - }, - { - "description": "matches", - "data": "\u0003", - "valid": true - } - ] - }, - { - "description": "ECMA 262 \\d matches ascii digits only", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\d$" - }, - "tests": [ - { - "description": "ASCII zero matches", - "data": "0", - "valid": true - }, - { - "description": "NKO DIGIT ZERO does not match (unlike e.g. Python)", - "data": "߀", - "valid": false - }, - { - "description": "NKO DIGIT ZERO (as \\u escape) does not match", - "data": "\u07c0", - "valid": false - } - ] - }, - { - "description": "ECMA 262 \\D matches everything but ascii digits", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\D$" - }, - "tests": [ - { - "description": "ASCII zero does not match", - "data": "0", - "valid": false - }, - { - "description": "NKO DIGIT ZERO matches (unlike e.g. Python)", - "data": "߀", - "valid": true - }, - { - "description": "NKO DIGIT ZERO (as \\u escape) matches", - "data": "\u07c0", - "valid": true - } - ] - }, - { - "description": "ECMA 262 \\w matches ascii letters only", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\w$" - }, - "tests": [ - { - "description": "ASCII 'a' matches", - "data": "a", - "valid": true - }, - { - "description": "latin-1 e-acute does not match (unlike e.g. Python)", - "data": "é", - "valid": false - } - ] - }, - { - "description": "ECMA 262 \\W matches everything but ascii letters", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\W$" - }, - "tests": [ - { - "description": "ASCII 'a' does not match", - "data": "a", - "valid": false - }, - { - "description": "latin-1 e-acute matches (unlike e.g. Python)", - "data": "é", - "valid": true - } - ] - }, - { - "description": "ECMA 262 \\s matches whitespace", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\s$" - }, - "tests": [ - { - "description": "ASCII space matches", - "data": " ", - "valid": true - }, - { - "description": "Character tabulation matches", - "data": "\t", - "valid": true - }, - { - "description": "Line tabulation matches", - "data": "\u000b", - "valid": true - }, - { - "description": "Form feed matches", - "data": "\u000c", - "valid": true - }, - { - "description": "latin-1 non-breaking-space matches", - "data": "\u00a0", - "valid": true - }, - { - "description": "zero-width whitespace matches", - "data": "\ufeff", - "valid": true - }, - { - "description": "line feed matches (line terminator)", - "data": "\u000a", - "valid": true - }, - { - "description": "paragraph separator matches (line terminator)", - "data": "\u2029", - "valid": true - }, - { - "description": "EM SPACE matches (Space_Separator)", - "data": "\u2003", - "valid": true - }, - { - "description": "Non-whitespace control does not match", - "data": "\u0001", - "valid": false - }, - { - "description": "Non-whitespace does not match", - "data": "\u2013", - "valid": false - } - ] - }, - { - "description": "ECMA 262 \\S matches everything but whitespace", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "string", - "pattern": "^\\S$" - }, - "tests": [ - { - "description": "ASCII space does not match", - "data": " ", - "valid": false - }, - { - "description": "Character tabulation does not match", - "data": "\t", - "valid": false - }, - { - "description": "Line tabulation does not match", - "data": "\u000b", - "valid": false - }, - { - "description": "Form feed does not match", - "data": "\u000c", - "valid": false - }, - { - "description": "latin-1 non-breaking-space does not match", - "data": "\u00a0", - "valid": false - }, - { - "description": "zero-width whitespace does not match", - "data": "\ufeff", - "valid": false - }, - { - "description": "line feed does not match (line terminator)", - "data": "\u000a", - "valid": false - }, - { - "description": "paragraph separator does not match (line terminator)", - "data": "\u2029", - "valid": false - }, - { - "description": "EM SPACE does not match (Space_Separator)", - "data": "\u2003", - "valid": false - }, - { - "description": "Non-whitespace control matches", - "data": "\u0001", - "valid": true - }, - { - "description": "Non-whitespace matches", - "data": "\u2013", - "valid": true - } - ] - }, - { - "description": "patterns always use unicode semantics with pattern", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "pattern": "\\p{Letter}cole" - }, - "tests": [ - { - "description": "ascii character in json string", - "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", - "valid": true - }, - { - "description": "literal unicode character in json string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": true - }, - { - "description": "unicode character in hex format in string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": true - }, - { - "description": "unicode matching is case-sensitive", - "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.", - "valid": false - } - ] - }, - { - "description": "\\w in patterns matches [A-Za-z0-9_], not unicode letters", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "pattern": "\\wcole" - }, - "tests": [ - { - "description": "ascii character in json string", - "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", - "valid": true - }, - { - "description": "literal unicode character in json string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": false - }, - { - "description": "unicode character in hex format in string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": false - }, - { - "description": "unicode matching is case-sensitive", - "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.", - "valid": false - } - ] - }, - { - "description": "pattern with ASCII ranges", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "pattern": "[a-z]cole" - }, - "tests": [ - { - "description": "literal unicode character in json string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": false - }, - { - "description": "unicode character in hex format in string", - "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", - "valid": false - }, - { - "description": "ascii characters match", - "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", - "valid": true - } - ] - }, - { - "description": "\\d in pattern matches [0-9], not unicode digits", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "pattern": "^\\d+$" - }, - "tests": [ - { - "description": "ascii digits", - "data": "42", - "valid": true - }, - { - "description": "ascii non-digits", - "data": "-%#", - "valid": false - }, - { - "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", - "data": "৪২", - "valid": false - } - ] - }, - { - "description": "pattern with non-ASCII digits", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "pattern": "^\\p{digit}+$" - }, - "tests": [ - { - "description": "ascii digits", - "data": "42", - "valid": true - }, - { - "description": "ascii non-digits", - "data": "-%#", - "valid": false - }, - { - "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", - "data": "৪২", - "valid": true - } - ] - }, - { - "description": "patterns always use unicode semantics with patternProperties", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "patternProperties": { - "\\p{Letter}cole": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "ascii character in json string", - "data": { "l'ecole": "pas de vraie vie" }, - "valid": true - }, - { - "description": "literal unicode character in json string", - "data": { "l'école": "pas de vraie vie" }, - "valid": true - }, - { - "description": "unicode character in hex format in string", - "data": { "l'\u00e9cole": "pas de vraie vie" }, - "valid": true - }, - { - "description": "unicode matching is case-sensitive", - "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, - "valid": false - } - ] - }, - { - "description": "\\w in patternProperties matches [A-Za-z0-9_], not unicode letters", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "patternProperties": { - "\\wcole": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "ascii character in json string", - "data": { "l'ecole": "pas de vraie vie" }, - "valid": true - }, - { - "description": "literal unicode character in json string", - "data": { "l'école": "pas de vraie vie" }, - "valid": false - }, - { - "description": "unicode character in hex format in string", - "data": { "l'\u00e9cole": "pas de vraie vie" }, - "valid": false - }, - { - "description": "unicode matching is case-sensitive", - "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, - "valid": false - } - ] - }, - { - "description": "patternProperties with ASCII ranges", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "patternProperties": { - "[a-z]cole": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "literal unicode character in json string", - "data": { "l'école": "pas de vraie vie" }, - "valid": false - }, - { - "description": "unicode character in hex format in string", - "data": { "l'\u00e9cole": "pas de vraie vie" }, - "valid": false - }, - { - "description": "ascii characters match", - "data": { "l'ecole": "pas de vraie vie" }, - "valid": true - } - ] - }, - { - "description": "\\d in patternProperties matches [0-9], not unicode digits", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "patternProperties": { - "^\\d+$": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "ascii digits", - "data": { "42": "life, the universe, and everything" }, - "valid": true - }, - { - "description": "ascii non-digits", - "data": { "-%#": "spending the year dead for tax reasons" }, - "valid": false - }, - { - "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", - "data": { "৪২": "khajit has wares if you have coin" }, - "valid": false - } - ] - }, - { - "description": "patternProperties with non-ASCII digits", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "patternProperties": { - "^\\p{digit}+$": true - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "ascii digits", - "data": { "42": "life, the universe, and everything" }, - "valid": true - }, - { - "description": "ascii non-digits", - "data": { "-%#": "spending the year dead for tax reasons" }, - "valid": false - }, - { - "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", - "data": { "৪২": "khajit has wares if you have coin" }, - "valid": true - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/float-overflow.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/float-overflow.json deleted file mode 100644 index f5ae8b18..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/float-overflow.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "description": "all integers are multiples of 0.5, if overflow is handled", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "integer", - "multipleOf": 0.5 - }, - "tests": [ - { - "description": "valid if optional overflow handling is implemented", - "data": 1e308, - "valid": true - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/id.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/id.json deleted file mode 100644 index 0b7df4e8..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/id.json +++ /dev/null @@ -1,53 +0,0 @@ -[ - { - "description": "$id inside an enum is not a real identifier", - "comment": "the implementation must not be confused by an $id buried in the enum", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$defs": { - "id_in_enum": { - "enum": [ - { - "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json", - "type": "null" - } - ] - }, - "real_id_in_schema": { - "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json", - "type": "string" - }, - "zzz_id_in_const": { - "const": { - "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json", - "type": "null" - } - } - }, - "anyOf": [ - { "$ref": "#/$defs/id_in_enum" }, - { "$ref": "https://localhost:1234/draft2020-12/id/my_identifier.json" } - ] - }, - "tests": [ - { - "description": "exact match to enum, and type matches", - "data": { - "$id": "https://localhost:1234/draft2020-12/id/my_identifier.json", - "type": "null" - }, - "valid": true - }, - { - "description": "match $ref to $id", - "data": "a string to match #/$defs/id_in_enum", - "valid": true - }, - { - "description": "no match on enum or $ref to $id", - "data": 1, - "valid": false - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/no-schema.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/no-schema.json deleted file mode 100644 index 676e6b53..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/no-schema.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "description": "validation without $schema", - "comment": "minLength is the same across all drafts", - "schema": { - "minLength": 2 - }, - "tests": [ - { - "description": "a 3-character string is valid", - "data": "foo", - "valid": true - }, - { - "description": "a 1-character string is not valid", - "data": "a", - "valid": false - }, - { - "description": "a non-string is valid", - "data": 5, - "valid": true - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/non-bmp-regex.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/non-bmp-regex.json deleted file mode 100644 index d2efb3ef..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/non-bmp-regex.json +++ /dev/null @@ -1,86 +0,0 @@ -[ - { - "description": "Proper UTF-16 surrogate pair handling: pattern", - "comment": "Optional because .Net doesn't correctly handle 32-bit Unicode characters", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "pattern": "^🐲*$" - }, - "tests": [ - { - "description": "matches empty", - "data": "", - "valid": true - }, - { - "description": "matches single", - "data": "🐲", - "valid": true - }, - { - "description": "matches two", - "data": "🐲🐲", - "valid": true - }, - { - "description": "doesn't match one", - "data": "🐉", - "valid": false - }, - { - "description": "doesn't match two", - "data": "🐉🐉", - "valid": false - }, - { - "description": "doesn't match one ASCII", - "data": "D", - "valid": false - }, - { - "description": "doesn't match two ASCII", - "data": "DD", - "valid": false - } - ] - }, - { - "description": "Proper UTF-16 surrogate pair handling: patternProperties", - "comment": "Optional because .Net doesn't correctly handle 32-bit Unicode characters", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "patternProperties": { - "^🐲*$": { - "type": "integer" - } - } - }, - "tests": [ - { - "description": "matches empty", - "data": { "": 1 }, - "valid": true - }, - { - "description": "matches single", - "data": { "🐲": 1 }, - "valid": true - }, - { - "description": "matches two", - "data": { "🐲🐲": 1 }, - "valid": true - }, - { - "description": "doesn't match one", - "data": { "🐲": "hello" }, - "valid": false - }, - { - "description": "doesn't match two", - "data": { "🐲🐲": "hello" }, - "valid": false - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/refOfUnknownKeyword.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/refOfUnknownKeyword.json deleted file mode 100644 index ab1510da..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/refOfUnknownKeyword.json +++ /dev/null @@ -1,112 +0,0 @@ -[ - { - "description": "reference of a root arbitrary keyword ", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "unknown-keyword": {"type": "integer"}, - "properties": { - "bar": {"$ref": "#/unknown-keyword"} - } - }, - "tests": [ - { - "description": "match", - "data": {"bar": 3}, - "valid": true - }, - { - "description": "mismatch", - "data": {"bar": true}, - "valid": false - } - ] - }, - { - "description": "reference of a root arbitrary keyword with encoded ref", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "unknown/keyword": {"type": "integer"}, - "properties": { - "bar": {"$ref": "#/unknown~1keyword"} - } - }, - "tests": [ - { - "description": "match", - "data": {"bar": 3}, - "valid": true - }, - { - "description": "mismatch", - "data": {"bar": true}, - "valid": false - } - ] - }, - { - "description": "reference of an arbitrary keyword of a sub-schema", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "foo": {"unknown-keyword": {"type": "integer"}}, - "bar": {"$ref": "#/properties/foo/unknown-keyword"} - } - }, - "tests": [ - { - "description": "match", - "data": {"bar": 3}, - "valid": true - }, - { - "description": "mismatch", - "data": {"bar": true}, - "valid": false - } - ] - }, - { - "description": "reference internals of known non-applicator", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "examples": [ - { "type": "string" } - ], - "$ref": "#/examples/0" - }, - "tests": [ - { - "description": "match", - "data": "a string", - "valid": true - }, - { - "description": "mismatch", - "data": 42, - "valid": false - } - ] - }, - { - "description": "reference of an arbitrary keyword of a sub-schema with encoded ref", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "foo": {"unknown/keyword": {"type": "integer"}}, - "bar": {"$ref": "#/properties/foo/unknown~1keyword"} - } - }, - "tests": [ - { - "description": "match", - "data": {"bar": 3}, - "valid": true - }, - { - "description": "mismatch", - "data": {"bar": true}, - "valid": false - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/unknownKeyword.json b/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/unknownKeyword.json deleted file mode 100644 index 28b0c4ce..00000000 --- a/packages/ack/test/fixtures/json_schema_2020_12_full/draft2020-12/optional/unknownKeyword.json +++ /dev/null @@ -1,57 +0,0 @@ -[ - { - "description": "$id inside an unknown keyword is not a real identifier", - "comment": "the implementation must not be confused by an $id in locations we do not know how to parse", - "schema": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$defs": { - "id_in_unknown0": { - "not": { - "array_of_schemas": [ - { - "$id": "https://localhost:1234/draft2020-12/unknownKeyword/my_identifier.json", - "type": "null" - } - ] - } - }, - "real_id_in_schema": { - "$id": "https://localhost:1234/draft2020-12/unknownKeyword/my_identifier.json", - "type": "string" - }, - "id_in_unknown1": { - "not": { - "object_of_schemas": { - "foo": { - "$id": "https://localhost:1234/draft2020-12/unknownKeyword/my_identifier.json", - "type": "integer" - } - } - } - } - }, - "anyOf": [ - { "$ref": "#/$defs/id_in_unknown0" }, - { "$ref": "#/$defs/id_in_unknown1" }, - { "$ref": "https://localhost:1234/draft2020-12/unknownKeyword/my_identifier.json" } - ] - }, - "tests": [ - { - "description": "type matches second anyOf, which has a real schema in it", - "data": "a string", - "valid": true - }, - { - "description": "type matches non-schema in first anyOf", - "data": null, - "valid": false - }, - { - "description": "type matches non-schema in third anyOf", - "data": 1, - "valid": false - } - ] - } -] diff --git a/packages/ack/test/fixtures/json_schema_2020_12_full/index.json b/packages/ack/test/fixtures/json_schema_2020_12_full/index.json new file mode 100644 index 00000000..59123d9b --- /dev/null +++ b/packages/ack/test/fixtures/json_schema_2020_12_full/index.json @@ -0,0 +1,97 @@ +{ + "required": [ + "draft2020-12/additionalProperties.json", + "draft2020-12/allOf.json", + "draft2020-12/anchor.json", + "draft2020-12/anyOf.json", + "draft2020-12/boolean_schema.json", + "draft2020-12/const.json", + "draft2020-12/contains.json", + "draft2020-12/content.json", + "draft2020-12/default.json", + "draft2020-12/defs.json", + "draft2020-12/dependentRequired.json", + "draft2020-12/dependentSchemas.json", + "draft2020-12/dynamicRef.json", + "draft2020-12/enum.json", + "draft2020-12/exclusiveMaximum.json", + "draft2020-12/exclusiveMinimum.json", + "draft2020-12/format.json", + "draft2020-12/if-then-else.json", + "draft2020-12/infinite-loop-detection.json", + "draft2020-12/items.json", + "draft2020-12/maxContains.json", + "draft2020-12/maxItems.json", + "draft2020-12/maxLength.json", + "draft2020-12/maxProperties.json", + "draft2020-12/maximum.json", + "draft2020-12/minContains.json", + "draft2020-12/minItems.json", + "draft2020-12/minLength.json", + "draft2020-12/minProperties.json", + "draft2020-12/minimum.json", + "draft2020-12/multipleOf.json", + "draft2020-12/not.json", + "draft2020-12/oneOf.json", + "draft2020-12/pattern.json", + "draft2020-12/patternProperties.json", + "draft2020-12/prefixItems.json", + "draft2020-12/properties.json", + "draft2020-12/propertyNames.json", + "draft2020-12/ref.json", + "draft2020-12/refRemote.json", + "draft2020-12/required.json", + "draft2020-12/type.json", + "draft2020-12/unevaluatedItems.json", + "draft2020-12/unevaluatedProperties.json", + "draft2020-12/uniqueItems.json", + "draft2020-12/vocabulary.json" + ], + "format": [ + "draft2020-12/optional/format/date-time.json", + "draft2020-12/optional/format/date.json", + "draft2020-12/optional/format/duration.json", + "draft2020-12/optional/format/ecmascript-regex.json", + "draft2020-12/optional/format/email.json", + "draft2020-12/optional/format/hostname.json", + "draft2020-12/optional/format/idn-email.json", + "draft2020-12/optional/format/idn-hostname.json", + "draft2020-12/optional/format/ipv4.json", + "draft2020-12/optional/format/ipv6.json", + "draft2020-12/optional/format/iri-reference.json", + "draft2020-12/optional/format/iri.json", + "draft2020-12/optional/format/json-pointer.json", + "draft2020-12/optional/format/regex.json", + "draft2020-12/optional/format/relative-json-pointer.json", + "draft2020-12/optional/format/time.json", + "draft2020-12/optional/format/unknown.json", + "draft2020-12/optional/format/uri-reference.json", + "draft2020-12/optional/format/uri-template.json", + "draft2020-12/optional/format/uri.json", + "draft2020-12/optional/format/uuid.json" + ], + "remotes": [ + "remotes/draft2020-12/baseUriChange/folderInteger.json", + "remotes/draft2020-12/baseUriChangeFolder/folderInteger.json", + "remotes/draft2020-12/baseUriChangeFolderInSubschema/folderInteger.json", + "remotes/draft2020-12/detached-dynamicref.json", + "remotes/draft2020-12/detached-ref.json", + "remotes/draft2020-12/different-id-ref-string.json", + "remotes/draft2020-12/extendible-dynamic-ref.json", + "remotes/draft2020-12/format-assertion-false.json", + "remotes/draft2020-12/format-assertion-true.json", + "remotes/draft2020-12/integer.json", + "remotes/draft2020-12/locationIndependentIdentifier.json", + "remotes/draft2020-12/metaschema-no-validation.json", + "remotes/draft2020-12/metaschema-optional-vocabulary.json", + "remotes/draft2020-12/name-defs.json", + "remotes/draft2020-12/nested/foo-ref-string.json", + "remotes/draft2020-12/nested/string.json", + "remotes/draft2020-12/nested-absolute-ref-to-string.json", + "remotes/draft2020-12/prefixItems.json", + "remotes/draft2020-12/ref-and-defs.json", + "remotes/draft2020-12/subSchemas.json", + "remotes/draft2020-12/tree.json", + "remotes/draft2020-12/urn-ref-string.json" + ] +} diff --git a/packages/ack/test/json_schema_2020_12_full_conformance_test.dart b/packages/ack/test/json_schema_2020_12_full_conformance_test.dart index 2c1e1d16..12e22d66 100644 --- a/packages/ack/test/json_schema_2020_12_full_conformance_test.dart +++ b/packages/ack/test/json_schema_2020_12_full_conformance_test.dart @@ -1,31 +1,14 @@ -import 'dart:convert'; -import 'dart:io'; - import 'package:ack/ack.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; -void main() { - const fixtureRoot = 'test/fixtures/json_schema_2020_12_full'; - final remoteRoot = Directory('$fixtureRoot/remotes/draft2020-12'); - final documents = { - for (final file in remoteRoot.listSync(recursive: true).whereType()) - if (file.path.endsWith('.json')) - Uri.parse( - 'http://localhost:1234/draft2020-12/' - '${p.relative(file.path, from: remoteRoot.path).replaceAll('\\', '/')}', - ): jsonDecode( - file.readAsStringSync(), - )!, - }; - final corpus = Directory('$fixtureRoot/draft2020-12'); +import 'support/draft_2020_12_fixtures.dart'; + +Future main() async { + final documents = await readDraft2020Remotes(); + final required = await readDraft2020Cases('required'); group('official draft 2020-12 complete required suite', () { - for (final file in corpus.listSync().whereType()) { - if (!file.path.endsWith('.json')) continue; - final filename = p.basename(file.path); - final groups = (jsonDecode(file.readAsStringSync()) as List) - .cast>(); + for (final MapEntry(key: filename, value: groups) in required.entries) { for (final group in groups) { test('$filename: ${group['description']}', () { final schema = Ack.fromJsonSchema( diff --git a/packages/ack/test/json_schema_dynamic_ref_conformance_test.dart b/packages/ack/test/json_schema_dynamic_ref_conformance_test.dart index b5687601..59aa0ca7 100644 --- a/packages/ack/test/json_schema_dynamic_ref_conformance_test.dart +++ b/packages/ack/test/json_schema_dynamic_ref_conformance_test.dart @@ -1,36 +1,22 @@ -import 'dart:convert'; -import 'dart:io'; - import 'package:ack/ack.dart'; -import 'package:path/path.dart' as p; import 'package:test/test.dart'; -void main() { - const fixtureRoot = 'test/fixtures/json_schema_2020_12_full'; +import 'support/draft_2020_12_fixtures.dart'; + +Future main() async { + final required = await readDraft2020Cases('required'); final groups = >[ for (final filename in [ 'dynamicRef.json', 'unevaluatedProperties.json', 'unevaluatedItems.json', ]) - for (final group in (jsonDecode( - File('$fixtureRoot/draft2020-12/$filename').readAsStringSync(), - ) as List).cast>()) + for (final group in required[filename]!) if (filename == 'dynamicRef.json' || (group['description'] as String).contains(r'$dynamicRef')) {...group, 'description': '$filename: ${group['description']}'}, ]; - final remotes = Directory('$fixtureRoot/remotes/draft2020-12'); - final documents = { - for (final file in remotes.listSync(recursive: true).whereType()) - if (file.path.endsWith('.json')) - Uri.parse( - 'http://localhost:1234/draft2020-12/' - '${p.relative(file.path, from: remotes.path).replaceAll('\\', '/')}', - ): jsonDecode( - file.readAsStringSync(), - )!, - }; + final documents = await readDraft2020Remotes(); group('official 2020-12 dynamicRef validation', () { for (final group in groups) { diff --git a/packages/ack/test/json_schema_fixture_corpus_test.dart b/packages/ack/test/json_schema_fixture_corpus_test.dart index 7cc3b8d0..af5bb7b1 100644 --- a/packages/ack/test/json_schema_fixture_corpus_test.dart +++ b/packages/ack/test/json_schema_fixture_corpus_test.dart @@ -12,9 +12,13 @@ void main() { final jsonFiles = root .listSync(recursive: true) .whereType() - .where((file) => file.path.endsWith('.json')) + .where( + (file) => + file.path.endsWith('.json') && + p.basename(file.path) != 'index.json', + ) .toList(); - expect(jsonFiles, hasLength(159)); + expect(jsonFiles, hasLength(147)); for (final file in jsonFiles) { expect( @@ -35,6 +39,29 @@ void main() { ); }); + test('the browser index covers the fixtures used by conformance tests', () { + final manifest = jsonDecode( + File(p.join(fixtureRoot, 'index.json')).readAsStringSync(), + ) as Map; + for (final (name, directory, recursive) in [ + ('required', 'draft2020-12', false), + ('format', 'draft2020-12/optional/format', false), + ('remotes', 'remotes/draft2020-12', true), + ]) { + final expectedPaths = Directory(p.join(fixtureRoot, directory)) + .listSync(recursive: recursive) + .whereType() + .where((file) => file.path.endsWith('.json')) + .map( + (file) => p.posix.joinAll( + p.split(p.relative(file.path, from: fixtureRoot)), + ), + ) + .toList(); + expect(manifest[name], unorderedEquals(expectedPaths)); + } + }); + test('all required 2020-12 groups have executable case data', () { final directory = Directory(p.join(fixtureRoot, 'draft2020-12')); final files = directory diff --git a/packages/ack/test/json_schema_format_conformance_test.dart b/packages/ack/test/json_schema_format_conformance_test.dart index 2a2896e6..7882ce33 100644 --- a/packages/ack/test/json_schema_format_conformance_test.dart +++ b/packages/ack/test/json_schema_format_conformance_test.dart @@ -1,13 +1,12 @@ -import 'dart:convert'; -import 'dart:io'; - import 'package:ack/ack.dart'; -import 'package:path/path.dart' as p; import 'package:punycoder/punycoder.dart' as punycoder; import 'package:test/test.dart'; import 'package:unorm_dart/unorm_dart.dart' as unorm; -void main() { +import 'support/draft_2020_12_fixtures.dart'; +import 'support/read_json_fixture.dart'; + +Future main() async { for (final format in ['hostname', 'email']) { test( '$format checks the A-label length before processing the decoded label', @@ -142,15 +141,10 @@ void main() { } }); - const root = 'test/fixtures/json_schema_2020_12_full/draft2020-12'; - final formatDirectory = Directory('$root/optional/format'); + final formats = await readDraft2020Cases('format'); group('official 2020-12 optional format assertion', () { - for (final file in formatDirectory.listSync().whereType()) { - if (!file.path.endsWith('.json')) continue; - final filename = p.basename(file.path); - final groups = (jsonDecode(file.readAsStringSync()) as List) - .cast>(); + for (final MapEntry(key: filename, value: groups) in formats.entries) { for (final group in groups) { test('$filename: ${group['description']}', () { if (filename == 'unknown.json') { @@ -273,19 +267,11 @@ void main() { }); }); + final groups = (await readJsonFixture( + '$draft2020FixtureRoot/draft2020-12/optional/format-assertion.json', + ) as List).cast>(); + final documents = await readDraft2020Remotes(); group('official 2020-12 format-assertion vocabulary', () { - final groups = (jsonDecode( - File('$root/optional/format-assertion.json').readAsStringSync(), - ) as List).cast>(); - final documents = { - for (final value in ['true', 'false']) - Uri.parse( - 'http://localhost:1234/draft2020-12/format-assertion-$value.json', - ): jsonDecode( - File('$root/../remotes/draft2020-12/format-assertion-$value.json') - .readAsStringSync(), - )!, - }; for (final group in groups) { test(group['description']! as String, () { final schema = Ack.fromJsonSchema( diff --git a/packages/ack/test/json_schema_import_conformance_test.dart b/packages/ack/test/json_schema_import_conformance_test.dart index abc571a0..c440f4f2 100644 --- a/packages/ack/test/json_schema_import_conformance_test.dart +++ b/packages/ack/test/json_schema_import_conformance_test.dart @@ -1,14 +1,12 @@ -import 'dart:convert'; -import 'dart:io'; - import 'package:ack/ack.dart'; import 'package:test/test.dart'; -void main() { - final groups = jsonDecode( - File('test/fixtures/json_schema_import/draft2020-12.json') - .readAsStringSync(), - ) as List; +import 'support/read_json_fixture.dart'; + +Future main() async { + final groups = (await readJsonFixture( + 'test/fixtures/json_schema_import/draft2020-12.json', + )) as List; group('official draft 2020-12 supported subset', () { for (final group in groups.cast>()) { diff --git a/packages/ack/test/support/draft_2020_12_fixtures.dart b/packages/ack/test/support/draft_2020_12_fixtures.dart new file mode 100644 index 00000000..13c2b042 --- /dev/null +++ b/packages/ack/test/support/draft_2020_12_fixtures.dart @@ -0,0 +1,32 @@ +import 'read_json_fixture.dart'; + +const draft2020FixtureRoot = 'test/fixtures/json_schema_2020_12_full'; + +Future> _readCollection(String name) async { + final manifest = (await readJsonFixture( + '$draft2020FixtureRoot/index.json', + )) as Map; + final paths = (manifest[name]! as List).cast(); + final entries = await Future.wait( + paths.map((path) async { + final document = await readJsonFixture('$draft2020FixtureRoot/$path'); + return MapEntry(path, document!); + }), + ); + return Map.fromEntries(entries); +} + +Future>>> readDraft2020Cases( + String collection, +) async => { + for (final entry in (await _readCollection(collection)).entries) + entry.key.split('/').last: (entry.value! as List) + .cast>(), +}; + +Future> readDraft2020Remotes() async => { + for (final entry in (await _readCollection('remotes')).entries) + Uri.parse( + 'http://localhost:1234/${entry.key.substring('remotes/'.length)}', + ): entry.value!, +}; diff --git a/packages/ack/test/support/read_fixture_text_browser.dart b/packages/ack/test/support/read_fixture_text_browser.dart new file mode 100644 index 00000000..755654b6 --- /dev/null +++ b/packages/ack/test/support/read_fixture_text_browser.dart @@ -0,0 +1,20 @@ +import 'dart:js_interop'; + +@JS('fetch') +external JSPromise<_Response> _fetch(JSString url); + +extension type _Response(JSObject _) implements JSObject { + external bool get ok; + external int get status; + external JSPromise text(); +} + +Future readFixtureText(String path) async { + // package:test serves the repository under a unique leading URL segment. + final url = Uri.base.resolve('/${Uri.base.pathSegments.first}/$path'); + final response = await _fetch(url.toString().toJS).toDart; + if (!response.ok) { + throw StateError('Could not load $path (HTTP ${response.status}).'); + } + return (await response.text().toDart).toDart; +} diff --git a/packages/ack/test/support/read_fixture_text_vm.dart b/packages/ack/test/support/read_fixture_text_vm.dart new file mode 100644 index 00000000..d1f1a96b --- /dev/null +++ b/packages/ack/test/support/read_fixture_text_vm.dart @@ -0,0 +1,3 @@ +import 'dart:io'; + +Future readFixtureText(String path) => File(path).readAsString(); diff --git a/packages/ack/test/support/read_json_fixture.dart b/packages/ack/test/support/read_json_fixture.dart new file mode 100644 index 00000000..c0357901 --- /dev/null +++ b/packages/ack/test/support/read_json_fixture.dart @@ -0,0 +1,8 @@ +import 'dart:convert'; + +import 'read_fixture_text_vm.dart' + if (dart.library.js_interop) 'read_fixture_text_browser.dart'; + +/// Reads an existing fixture by path relative to the package root. +Future readJsonFixture(String path) async => + jsonDecode(await readFixtureText(path)); diff --git a/packages/ack_mcp_dart/test/mcp_server_integration_test.dart b/packages/ack_mcp_dart/test/mcp_server_integration_test.dart index 8e85d96e..b1aa8e75 100644 --- a/packages/ack_mcp_dart/test/mcp_server_integration_test.dart +++ b/packages/ack_mcp_dart/test/mcp_server_integration_test.dart @@ -204,7 +204,8 @@ void main() { 'number', input: AckModelAdapter( schema: () => Ack.object({'value': Ack.string()}), - fromRuntime: (args) => int.parse(args['value'] as String), + fromRuntime: (args) => + throw FormatException('Invalid integer', args['value']), toRuntime: (value) => {'value': '$value'}, ).modelSchema, onInvalidArguments: (error) { diff --git a/scripts/src/release_changelog.dart b/scripts/src/release_changelog.dart index 68a38b4a..495b6be0 100644 --- a/scripts/src/release_changelog.dart +++ b/scripts/src/release_changelog.dart @@ -1,49 +1,3 @@ -typedef ChangelogUpdate = ({String content, bool found, bool changed}); - -/// Replaces the exact [version] section with a release-notes link and removes -/// duplicate headings for that same version. -/// -/// Prerelease headings such as `1.0.0-beta.1` do not match version `1.0.0`. -ChangelogUpdate updateReleaseChangelog( - String content, { - required String version, - required String releaseUrl, -}) { - final lines = content.split('\n'); - final headingIndex = lines.indexWhere( - (line) => _isVersionHeading(line, version), - ); - if (headingIndex == -1) { - return (content: content, found: false, changed: false); - } - - final bracketed = lines[headingIndex].trimLeft().startsWith('## ['); - lines[headingIndex] = bracketed ? '## [$version]' : '## $version'; - - var sectionEnd = _nextHeadingIndex(lines, headingIndex + 1); - lines.replaceRange(headingIndex + 1, sectionEnd, [ - '', - '* See [release notes]($releaseUrl) for details.', - '', - ]); - - var duplicateIndex = lines.indexWhere( - (line) => _isVersionHeading(line, version), - headingIndex + 1, - ); - while (duplicateIndex != -1) { - sectionEnd = _nextHeadingIndex(lines, duplicateIndex + 1); - lines.removeRange(duplicateIndex, sectionEnd); - duplicateIndex = lines.indexWhere( - (line) => _isVersionHeading(line, version), - headingIndex + 1, - ); - } - - final updated = lines.join('\n'); - return (content: updated, found: true, changed: updated != content); -} - /// Reports whether [content] declares a release heading for [version]. /// /// Prerelease headings such as `1.0.0-beta.1` do not match version `1.0.0`. @@ -57,8 +11,3 @@ bool _isVersionHeading(String line, String version) { ); return pattern.hasMatch(line); } - -int _nextHeadingIndex(List lines, int start) { - final index = lines.indexWhere((line) => line.startsWith('## '), start); - return index == -1 ? lines.length : index; -} diff --git a/scripts/update_release_changelog.dart b/scripts/update_release_changelog.dart deleted file mode 100644 index 6dac3920..00000000 --- a/scripts/update_release_changelog.dart +++ /dev/null @@ -1,92 +0,0 @@ -import 'dart:io'; - -import 'src/release_changelog.dart'; -import 'src/workspace_packages.dart'; - -/// Updates package changelog entries for the latest release so they contain -/// only a link to the GitHub release notes. -/// -/// Usage: -/// dart scripts/update_release_changelog.dart [version] [tag] -/// -/// If args are omitted: -/// * version defaults to the value in packages/ack/pubspec.yaml -/// * tag defaults to `v` -void main(List args) { - final version = args.isNotEmpty - ? args[0].trim() - : _readVersionFromPubspec('packages/ack/pubspec.yaml'); - if (version == null || version.isEmpty) { - stderr.writeln( - 'Unable to determine version. Provide it explicitly or ensure packages/ack/pubspec.yaml has a version.', - ); - exitCode = 64; - return; - } - - final tag = (args.length >= 3 && args[2].trim().isNotEmpty) - // Backward compatible: if the historical [version] [date] [tag] form - // is used, the third argument still wins as tag. - ? args[2].trim() - : (args.length >= 2 && args[1].trim().isNotEmpty) - ? args[1].trim() - : 'v$version'; - - final releaseUrl = 'https://github.com/btwld/ack/releases/tag/$tag'; - final changelogPaths = publishableAckPackages - .map((p) => 'packages/$p/CHANGELOG.md') - .toList(); - var hasErrors = false; - final updates = <({File file, ChangelogUpdate update})>[]; - - for (final path in changelogPaths) { - final file = File(path); - if (!file.existsSync()) { - stderr.writeln('Could not update $path (file not found)'); - hasErrors = true; - continue; - } - - final original = file.readAsStringSync(); - final update = updateReleaseChangelog( - original, - version: version, - releaseUrl: releaseUrl, - ); - if (!update.found) { - stderr.writeln('Warning: Could not find version $version in $path'); - hasErrors = true; - continue; - } - - updates.add((file: file, update: update)); - } - if (hasErrors) { - exitCode = 1; - return; - } - - for (final entry in updates) { - if (entry.update.changed) { - entry.file.writeAsStringSync(entry.update.content); - stdout.writeln('Updated changelog entry in ${entry.file.path}'); - } else { - stdout.writeln('No changes required for ${entry.file.path}'); - } - } -} - -String? _readVersionFromPubspec(String path) { - final file = File(path); - if (!file.existsSync()) { - return null; - } - - for (final line in file.readAsLinesSync()) { - final trimmed = line.trim(); - if (trimmed.startsWith('version:')) { - return trimmed.split(':').last.trim(); - } - } - return null; -} diff --git a/test/scripts/release_changelog_test.dart b/test/scripts/release_changelog_test.dart index c8585722..585749e1 100644 --- a/test/scripts/release_changelog_test.dart +++ b/test/scripts/release_changelog_test.dart @@ -1,141 +1,26 @@ -import 'dart:io'; - import 'package:test/test.dart'; import '../../scripts/src/release_changelog.dart'; void main() { - group('updateReleaseChangelog', () { - test('matches stable headings exactly and preserves prereleases', () { - const input = ''' -## 1.0.0 - -Old stable notes. - -## 1.0.0-beta.2 - -Keep beta two. - -## 1.0.0-beta.1 - -Keep beta one. - -## 1.0.0 - -Duplicate stable notes. -'''; - - final result = updateReleaseChangelog( - input, - version: '1.0.0', - releaseUrl: 'https://example.test/v1.0.0', - ); - - expect(result.found, isTrue); - expect(result.changed, isTrue); - expect(result.content, contains('## 1.0.0-beta.2')); - expect(result.content, contains('Keep beta two.')); - expect(result.content, contains('## 1.0.0-beta.1')); - expect(result.content, contains('Keep beta one.')); - expect( - RegExp(r'^## 1\.0\.0$', multiLine: true).allMatches(result.content), - hasLength(1), - ); - expect( - result.content, - contains( - '* See [release notes](https://example.test/v1.0.0) for details.', - ), - ); + group('hasVersionHeading', () { + test('matches a plain version heading', () { + expect(hasVersionHeading('## 1.0.0', version: '1.0.0'), isTrue); }); - test('preserves bracket heading style', () { - const input = '## [2.0.0] - 2026-01-01\n\nNotes.\n'; - - final result = updateReleaseChangelog( - input, - version: '2.0.0', - releaseUrl: 'https://example.test/v2.0.0', + test('matches a bracketed version heading with a date', () { + expect( + hasVersionHeading('## [2.0.0] - 2026-01-01', version: '2.0.0'), + isTrue, ); - - expect(result.content, startsWith('## [2.0.0]\n')); }); - test('reports a missing exact version without modifying content', () { - const input = '## 1.0.0-beta.1\n\nNotes.\n'; - - final result = updateReleaseChangelog( - input, - version: '1.0.0', - releaseUrl: 'https://example.test/v1.0.0', - ); - - expect(result.found, isFalse); - expect(result.changed, isFalse); - expect(result.content, input); + test('rejects a prerelease heading for a stable version', () { + expect(hasVersionHeading('## 1.0.0-beta.1', version: '1.0.0'), isFalse); }); - test('is idempotent after the release link is installed', () { - const input = '## 3.0.0\n\nOriginal notes.\n'; - const releaseUrl = 'https://example.test/v3.0.0'; - - final first = updateReleaseChangelog( - input, - version: '3.0.0', - releaseUrl: releaseUrl, - ); - final second = updateReleaseChangelog( - first.content, - version: '3.0.0', - releaseUrl: releaseUrl, - ); - - expect(first.changed, isTrue); - expect(second.found, isTrue); - expect(second.changed, isFalse); - expect(second.content, first.content); + test('rejects a changelog without the requested version', () { + expect(hasVersionHeading('## 1.0.1', version: '1.0.0'), isFalse); }); }); - - test('failed batches leave every changelog unchanged', () async { - final scriptPath = File('scripts/update_release_changelog.dart') - .absolute - .path; - final workingDirectory = Directory.systemTemp.createTempSync( - 'ack-release-changelog-', - ); - addTearDown(() => workingDirectory.deleteSync(recursive: true)); - - const paths = [ - 'packages/ack/CHANGELOG.md', - 'packages/ack_generator/CHANGELOG.md', - 'packages/ack_firebase_ai/CHANGELOG.md', - 'packages/ack_json_schema_builder/CHANGELOG.md', - 'packages/ack_mcp_dart/CHANGELOG.md', - ]; - final originals = {}; - for (final path in paths) { - final content = path.contains('ack_mcp_dart') - ? '## 0.9.0\n\nOlder notes.\n' - : '## 1.0.0\n\nRelease notes.\n'; - originals[path] = content; - File('${workingDirectory.path}/$path') - ..createSync(recursive: true) - ..writeAsStringSync(content); - } - - final result = await Process.run(Platform.resolvedExecutable, [ - scriptPath, - '1.0.0', - ], workingDirectory: workingDirectory.path); - - expect(result.exitCode, 1); - for (final path in paths) { - expect( - File('${workingDirectory.path}/$path').readAsStringSync(), - originals[path], - reason: '$path should not change when batch validation fails', - ); - } - }); } diff --git a/test/scripts/release_documentation_test.dart b/test/scripts/release_documentation_test.dart index d31ffab3..76a05d4a 100644 --- a/test/scripts/release_documentation_test.dart +++ b/test/scripts/release_documentation_test.dart @@ -51,4 +51,40 @@ void main() { expect(publishing, contains('PUB_TOKEN')); expect(publishing, isNot(contains('by itself'))); }); + + group('the publishing guide', () { + late String publishing; + setUp(() { + publishing = File('PUBLISHING.md') + .readAsStringSync() + .replaceAll(RegExp(r'\s+'), ' '); + }); + + test('summarizes stable 2.0.0 changes since 1.7.1', () { + expect( + publishing, + contains( + '`## 2.0.0` entry as a net summary of changes since the last stable ' + 'release, 1.7.1', + ), + ); + }); + + test('updates both example dependencies for 2.0.0', () { + expect( + publishing, + contains( + '`example/pubspec.yaml`, set `ack: ^2.0.0` and ' + '`ack_generator: ^2.0.0`', + ), + ); + }); + + test('documents verifying a tag from the matching prerelease branch', () { + expect( + publishing, + contains('`--main-ref=origin/release/.`'), + ); + }); + }); } diff --git a/test/scripts/release_workflow_security_test.dart b/test/scripts/release_workflow_security_test.dart index 6704b8ca..cd7278d2 100644 --- a/test/scripts/release_workflow_security_test.dart +++ b/test/scripts/release_workflow_security_test.dart @@ -86,6 +86,28 @@ void main() { }); }); + group('CI', () { + test('uses the required check name for the pinned Flutter lane', () { + final job = _jobs('.github/workflows/ci.yml')['test'] as Map; + + expect( + job['name'], + startsWith( + "\${{ matrix.flutter-version == '' && 'Run tests for all packages' || ", + ), + ); + }); + + test('does not rerun datetime validation with a time zone override', () { + final job = _jobs('.github/workflows/ci.yml')['test'] as Map; + final steps = (job['steps'] as List).cast(); + final commands = steps.map((step) => step['run']).whereType(); + final rerun = RegExp(r'\bTZ=[^\n]*datetime_validation_test\.dart'); + + expect(commands, isNot(anyElement(matches(rerun)))); + }); + }); + group('the Flutter SDK', () { test('is installed only through the checksum-verified action', () { final sources = _automationSources() @@ -126,6 +148,21 @@ void main() { } }); + test('CI tests the pinned Flutter SDK and uses manifest releases', () { + final job = _jobs('.github/workflows/ci.yml')['test'] as Map; + final strategy = job['strategy'] as Map; + final matrix = strategy['matrix'] as Map; + final lanes = (matrix['include'] as List).cast(); + final versions = lanes.map((lane) => lane['flutter-version']); + + // An empty version selects the repository default, which is tested below. + expect(versions, contains('')); + expect( + versions.where((version) => version != ''), + everyElement(isIn(_flutterReleases.keys)), + ); + }); + test('pins the repository default to an exact manifest entry', () { final pinned = (jsonDecode(File('.fvmrc').readAsStringSync()) as Map)['flutter'];