From 1982f2c2fcb17e7e1c039025b959e504a35a9357 Mon Sep 17 00:00:00 2001 From: leehack Date: Thu, 19 Nov 2026 04:32:42 -0500 Subject: [PATCH] Close CI selection and release tooling coverage gaps --- .github/workflows/ci.yml | 5 +- doc/ci_selection.md | 9 +- doc/high_risk_pre_merge_readiness.md | 11 +- test/ci/test_select_jobs.py | 14 +- test/unit/hook/native_release_pins_test.dart | 20 +- ...heck_released_changelog_sections_test.dart | 33 +- .../tooling/check_webgpu_bridge_tag_test.dart | 8 +- .../tooling/ci_workflow_selection_test.dart | 24 +- .../tooling/docs_changelog_drift_test.dart | 32 +- .../tooling/high_risk_readiness_test.dart | 8 + .../tooling/high_risk_review_policy_test.dart | 8 + ...cos_litert_lm_prepare_app_script_test.dart | 7 +- .../tooling/markdown_test_suites_test.dart | 18 ++ ..._consumer_qualification_workflow_test.dart | 29 +- .../support/markdown_reader_exemptions.dart | 13 +- ...rify_release_docs_companion_pins_test.dart | 100 ++++++ tool/ci/markdown_test_suites.txt | 1 + tool/ci/select_jobs.py | 4 +- .../check_released_changelog_sections.dart | 49 ++- .../testing/verify_release_docs_versions.dart | 295 ++++++++++-------- website/docs/maintainers/release-workflow.md | 6 +- 21 files changed, 506 insertions(+), 188 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db21393a4..05c3c5db5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -543,6 +543,9 @@ jobs: shard: [1, 2, 3] steps: - uses: actions/checkout@v7 + with: + # The native pin suite reads the manifests at published companion tags. + fetch-depth: 0 - name: Setup Flutter uses: subosito/flutter-action@v2 @@ -619,6 +622,7 @@ jobs: LLAMADART_TEST_MODELS_DIR: ${{ github.workspace }}/.dart_tool/test_models LLAMA_CPP_TEMPLATES_DIR: ${{ github.workspace }}/.dart_tool/llama_cpp_templates REQUIRE_LLAMA_CPP_TEMPLATES: '1' + LLAMADART_REQUIRE_PUBLISHED_COMPANION_TAGS: '1' run: dart test -p vm -j 1 --exclude-tags local-only ${{ needs.changes.outputs.coverage == 'true' && '--coverage=coverage' || '' }} --file-reporter=json:.dart_tool/test_events.jsonl ${{ steps.shard.outputs.files }} - name: Check the LiteRT-LM cache canary @@ -1250,7 +1254,6 @@ jobs: flutter-version: 3.47.1 channel: stable cache: true - - run: dart pub get - run: flutter pub get working-directory: example/chat_app - run: flutter test test/validation_controller_test.dart test/validation_app_test.dart diff --git a/doc/ci_selection.md b/doc/ci_selection.md index da15fd278..5b9988f56 100644 --- a/doc/ci_selection.md +++ b/doc/ci_selection.md @@ -10,6 +10,7 @@ PR. A path filter must not prevent a required workflow from reporting. |---|---|---| | Documentation, website, docs tooling | Docs build/tool tests plus version and bridge-pin checks | None | | Any path | Adds `Markdown Tests`, unless the Linux VM tests are selected | None | +| Genkit or Model Store package | Affected package checks and root Linux VM tests | None | | Studio core or UI package (`web/`, `windows/`, `linux/` packaging vs shared/macOS) | Studio core and Flutter UI format, analysis and VM tests; `studio-macos` for non-exempt inputs; Web files also run version and bridge-pin checks | None | | One companion package | Root static checks, affected package's Flutter/SwiftPM/publish checks, Apple cache check, root Linux coverage and full macOS/Windows VM checks, Studio + `studio-macos`, Web Chat consumer | Android, Web, iOS inputs | | Validation package tests/schemas or unbundled assets (`process_memory_test.dart` / `process_memory_probe.dart` also run Mac memory) | Root static checks, Linux VM tests, private suite and Flutter consumer contracts | None | @@ -23,7 +24,7 @@ PR. A path filter must not prevent a required workflow from reporting. | Root `test/**` (extant Linux-only leaf suite on PR vs host-sensitive suite, helper/fixture, deleted/unknown, or push) | Static, all Linux VM tests, Chrome and Windows host tests; Mac native shards only when `test_shards.dart hosts-json` reports host-relevant or on helper/fixture/push/probe-failure; shared fixtures/helpers also run Studio, `studio-macos` and Apple cache | None | | Browser backend trees (`lib/src/backends/web/**`, `lib/src/backends/webgpu/**`) | Non-Mac full graph (Linux, Chrome, Windows native, Ubuntu Studio, Web Chat, Genkit, Model Store, examples) with zero Mac allocations | Linux, Windows desktops; apps (PR defers Android) | | Root runtime/hooks/dependencies, other example packages, conditional backend entrypoints | Full behavioral graph | All targets; a PR defers macOS desktop and Android unless it changes their build inputs (`.flutter-version` included for `macos-15`) | -| Workflow/selector or unclassified paths | Full graph including synthetic artifact transport (workflows/selector) | All targets; a PR defers `macos-15` and `android` unless it changes their build inputs (`validation_bundles.yml`, `select_jobs.py`, `hook/`, `lib/src/hook/`, `pubspec.*`, `.flutter-version`, `tool/testing/validation*`, or compiled `packages/llamadart_validation/` for `macos-15`) | +| Workflow/selector or unclassified paths | Full graph including synthetic artifact transport (workflows/selector) | All targets; a PR defers `macos-15` and `android` unless it changes their build inputs (`validation_bundles.yml`, `select_jobs.py`, `hook/`, `lib/src/hook/`, `pubspec.*`, `.flutter-version` for `macos-15`, `tool/testing/validation*`, or compiled `packages/llamadart_validation/`) | | Missing, empty or invalid diff; explicit manual bundle run | Full fallback | All targets (`macos-15` retained) | Selections combine for mixed changes. Version checks already executed by the @@ -57,8 +58,10 @@ This is executable job accounting, not a new repository protection setting. `tool/ci/markdown_test_suites.txt`, for every change that selects no Linux VM tests. It carries no coverage, so a Markdown-only commit uploads none to Codecov. Every path selects it, not only Markdown: any file a root suite -reaches can start reading Markdown without a test changing, and the website, -Genkit and Model Store lanes run no other root test. +reaches can start reading Markdown without a test changing. Website changes +run the site build script's root suite here. Genkit and Model Store package +changes select the Linux VM tests because root tooling also reads their +package files. `markdown_test_suites_test.dart` keeps the inventory complete. Every root suite whose static reach shows Markdown evidence must be listed in the inventory or diff --git a/doc/high_risk_pre_merge_readiness.md b/doc/high_risk_pre_merge_readiness.md index 98764c19f..cebd9eb7f 100644 --- a/doc/high_risk_pre_merge_readiness.md +++ b/doc/high_risk_pre_merge_readiness.md @@ -121,12 +121,13 @@ snippet must occur in its exact candidate blob, like any source reference. This does not admit other harness assets or arbitrary package paths, or relax compiled-grammar, independent-audit or external-authentication requirements. -Studio admits production references only under +The evaluator admits Studio production references under `packages/llamadart_studio_core/lib/` and `packages/llamadart_studio/lib/`. -Its tests are the corresponding `test/**/*_test.dart` trees and the Flutter -app's `integration_test/**/*_test.dart` tree. These paths retain exact-blob, -complete changed-production coverage, snippet and observed causal-control -requirements; they do not admit arbitrary packages or platform assets. +It admits tests from both packages' `test/**/*_test.dart` trees and the Flutter +app's `integration_test/**/*_test.dart` tree. It does not require package-local pairing. +The independent reviewer verifies each test reaches the cited production code. +Exact-blob, complete changed-production coverage, snippet and observed +causal-control requirements apply. Studio inference, message/settings, MCP schema, and Chat/Coding boundaries are conservative structured-output surfaces with all three minimum impacts. An unchanged root grammar does not establish that adapter-produced schemas, diff --git a/test/ci/test_select_jobs.py b/test/ci/test_select_jobs.py index daa00695d..ffbf8b2c6 100644 --- a/test/ci/test_select_jobs.py +++ b/test/ci/test_select_jobs.py @@ -89,7 +89,7 @@ def test_every_path_runs_the_markdown_reader_guard(self): jobs = ci.select([path], pull_request=pull_request)['jobs'] self.assertNotEqual(jobs['markdown-tests'], jobs['test-linux-coverage']) for path in ('tool/docs/build_site.sh', 'website/lib/src/site/site_model.dart', - 'packages/genkit_llamadart/lib/a.dart', 'LICENSE'): + 'LICENSE'): with self.subTest(path=path): plan = ci.select([path]) self.assertTrue(plan['jobs']['markdown-tests']) @@ -101,8 +101,10 @@ def test_deleted_and_renamed_markdown_keep_tooling_and_specialized_jobs(self): for raw in (b'D\0website/docs/integrations/genkit.md\0', b'R100\0packages/genkit_llamadart/README.md\0website/docs/new.md\0'): plan = ci.select(ci.inventory(raw)) - self.assertTrue(plan['jobs']['markdown-tests']) self.assertTrue(plan['jobs']['genkit']) + source_is_package = raw.startswith(b'R') + self.assertEqual(plan['jobs']['test-linux-coverage'], source_is_package) + self.assertEqual(plan['jobs']['markdown-tests'], not source_is_package) self.assertEqual(plan['apps'], []) self.assertEqual(plan['desktops'], []) @@ -136,12 +138,12 @@ def test_genkit_gateway_runs_package_snippet_compilation_with_docs(self): self.assertEqual(plan['companions'], []) self.assertEqual(plan['apps'], []) - def test_genkit_is_independent_but_core_and_shared_changes_test_the_adapter(self): + def test_genkit_package_changes_run_root_readers_and_the_adapter(self): for path in ('lib/genkit_llamadart.dart', 'README.md', 'pubspec.yaml', '.github/check_docs.py', 'test/contract_test.dart'): plan = ci.select(['packages/genkit_llamadart/' + path]) self.assertEqual({j for j, v in plan['jobs'].items() if v}, - {'genkit', 'markdown-tests'}) + {'genkit', 'test-linux-coverage'}) self.assertEqual(plan['companions'], []) self.assertEqual(plan['apps'], []) self.assertEqual(plan['desktops'], []) @@ -206,12 +208,12 @@ def test_root_test_fixtures_studio_reads_run_the_studio_lanes(self): self.assertTrue(plan['jobs']['studio'], path) self.assertTrue(ci.expected_jobs(plan)['studio-macos'], path) - def test_model_store_is_independent_but_core_changes_test_it(self): + def test_model_store_package_changes_run_root_readers_and_package_tests(self): for path in ('lib/llamadart_model_store.dart', 'README.md', 'pubspec.yaml', 'test/model_store_test.dart'): plan = ci.select(['packages/llamadart_model_store/' + path]) self.assertEqual({j for j, v in plan['jobs'].items() if v}, - {'model-store', 'markdown-tests'}) + {'model-store', 'test-linux-coverage'}) self.assertEqual(plan['companions'], []) self.assertEqual(plan['apps'], []) self.assertEqual(plan['desktops'], []) diff --git a/test/unit/hook/native_release_pins_test.dart b/test/unit/hook/native_release_pins_test.dart index fd764c406..3786ae176 100644 --- a/test/unit/hook/native_release_pins_test.dart +++ b/test/unit/hook/native_release_pins_test.dart @@ -71,14 +71,26 @@ void main() { expect(published, isNotEmpty); for (final MapEntry(key: tag, value: checksum) in published.entries) { expect(checksum, llamaCppCompatibleAppleCompanionChecksums[previous]); - // Release tags are absent from shallow CI checkouts; the recorded - // value is checked against the tag wherever it is present. + final ref = 'refs/tags/$tag'; + final tagExists = + Process.runSync('git', [ + 'show-ref', + '--verify', + '--quiet', + ref, + ]).exitCode == + 0; + if (!tagExists && + Platform.environment['LLAMADART_REQUIRE_PUBLISHED_COMPANION_TAGS'] != + '1') { + continue; + } final shown = Process.runSync('git', [ 'show', - '$tag:packages/llamadart_llama_cpp_flutter/darwin/' + '$ref:packages/llamadart_llama_cpp_flutter/darwin/' 'llamadart_llama_cpp_flutter/Package.swift', ]); - if (shown.exitCode != 0) continue; + expect(shown.exitCode, 0, reason: '$ref: ${shown.stderr}'); final manifest = shown.stdout as String; expect( manifest, diff --git a/test/unit/tooling/check_released_changelog_sections_test.dart b/test/unit/tooling/check_released_changelog_sections_test.dart index 4bb8533ae..e2ec1ca36 100644 --- a/test/unit/tooling/check_released_changelog_sections_test.dart +++ b/test/unit/tooling/check_released_changelog_sections_test.dart @@ -558,8 +558,12 @@ void main() { expect(run().exitCode, 0); }); - test('exempts release prep', () { - repo.commit({'CHANGELOG.md': '## 1.2.0\n\n- Pending.\n\n$_released'}); + test('exempts release prep from the released-text comparison', () { + const promoted = '## 1.2.0\n\n- Pending.\n\n$_released'; + repo.commit({ + 'CHANGELOG.md': promoted, + _docsChangelog: '$_docsIntro$promoted', + }); expect(run().exitCode, 1); for (final result in [ @@ -571,6 +575,31 @@ void main() { } }); + test( + 'rejects a stray Unreleased heading in either release-prep changelog', + () { + const promoted = '## 1.2.0\n\n- Pending.\n\n$_released'; + for (final path in ['CHANGELOG.md', _docsChangelog]) { + repo.commit({ + 'CHANGELOG.md': + "${path == 'CHANGELOG.md' ? '## Unreleased\n\n' : ''}$promoted", + _docsChangelog: + "$_docsIntro${path == _docsChangelog ? '## Unreleased \n\n' : ''}$promoted", + }); + for (final result in [ + run(labels: ['release-prep']), + run(headRef: 'release/prep-1.2.0'), + ]) { + expect(result.exitCode, 1, reason: '${result.stdout}'); + expect( + result.stderr, + contains('$path must not keep `## Unreleased` when publishing.'), + ); + } + } + }, + ); + test('fails closed when the base branch is not fetched', () { final result = run(baseRef: 'release-branch'); expect(result.exitCode, 1); diff --git a/test/unit/tooling/check_webgpu_bridge_tag_test.dart b/test/unit/tooling/check_webgpu_bridge_tag_test.dart index 68c895bfa..018377a2e 100644 --- a/test/unit/tooling/check_webgpu_bridge_tag_test.dart +++ b/test/unit/tooling/check_webgpu_bridge_tag_test.dart @@ -1042,10 +1042,12 @@ void main() { expect(findRuntimeBaselineDrift(root), hasLength(4)); }); - test('frozen sections keep their own tags', () { + test('a frozen top section keeps the tags it shipped with', () { + final released = paragraph(liteRt: 'v0.18.0', sd: 'v0.2.0'); final root = baselineRepo( - changelog: '## 1.0.0\n\n${paragraph(liteRt: 'v0.18.0', sd: 'v0.2.0')}', - docs: paragraph(), + heading: '1.0.0', + changelog: released, + docs: released, ); expect(findRuntimeBaselineDrift(root), isEmpty); }); diff --git a/test/unit/tooling/ci_workflow_selection_test.dart b/test/unit/tooling/ci_workflow_selection_test.dart index 72afdb6d4..6d1a93abb 100644 --- a/test/unit/tooling/ci_workflow_selection_test.dart +++ b/test/unit/tooling/ci_workflow_selection_test.dart @@ -568,7 +568,7 @@ for event,mode,oldflag,owner,attempt,cancel,good,main in itertools.product(('pus (plan['jobs'] as Map).entries .where((e) => e.value == true) .map((e) => e.key), - unorderedEquals(['model-store', 'markdown-tests']), + unorderedEquals(['model-store', 'test-linux-coverage']), ); final job = readWorkflow('ci')['jobs']['model-store'] as Map; @@ -1422,6 +1422,27 @@ for event,flag,native,cancel,good,main in itertools.product(('push','pull_reques }, ); + test('Linux VM tests have published companion tags and require them', () { + final steps = readWorkflow('ci')['jobs']['test-linux-vm']['steps'] as List; + final checkout = steps.singleWhere( + (step) => '${step['uses']}'.startsWith('actions/checkout@'), + ); + expect(checkout['with']?['fetch-depth'], 0); + final tests = steps.singleWhere((step) => step['name'] == 'Run VM tests'); + expect(tests['env']['LLAMADART_REQUIRE_PUBLISHED_COMPANION_TAGS'], '1'); + }); + + test('validation consumer resolves dependencies only in the chat app', () { + final steps = + readWorkflow('ci')['jobs']['validation-integration']['steps'] as List; + final resolution = steps.where( + (step) => '${step['run']}'.contains('pub get'), + ); + expect(resolution, [ + {'run': 'flutter pub get', 'working-directory': 'example/chat_app'}, + ]); + }); + test('selection uses complete checkout and safe event metadata boundary', () { for (final name in ['ci', 'validation_bundles']) { final job = readWorkflow(name)['jobs']['changes']; @@ -1476,7 +1497,6 @@ for event,flag,native,cancel,good,main in itertools.product(('push','pull_reques 'tool/docs/build_site.sh', 'tool/docs/new_reader.dart', 'website/tool/finalize_site.dart', - 'packages/genkit_llamadart/lib/genkit_llamadart.dart', ]) { final jobs = (await selected([path]))['jobs'] as Map; expect(jobs['markdown-tests'], isTrue, reason: path); diff --git a/test/unit/tooling/docs_changelog_drift_test.dart b/test/unit/tooling/docs_changelog_drift_test.dart index e01ead329..8c3830ea3 100644 --- a/test/unit/tooling/docs_changelog_drift_test.dart +++ b/test/unit/tooling/docs_changelog_drift_test.dart @@ -46,14 +46,22 @@ void main() { ); }); - test('ignores Unreleased and sections only one file has', () { - expect( - docsChangelogDriftProblems( - {'Unreleased': '- A.\n', '0.1.0': '- Old.\n'}, - {'Unreleased': '- B.\n'}, - ), - isEmpty, - ); + test('rejects missing or changed Unreleased bullets on either side', () { + const pending = {'Unreleased': '- Pending.\n'}; + for (final (core, docs) in [ + (pending, {'Unreleased': '- Different.\n'}), + (pending, {'Unreleased': ''}), + (pending, {}), + ({}, pending), + ]) { + expect(docsChangelogDriftProblems(core, docs), [ + contains('section "## Unreleased" differs from CHANGELOG.md'), + ]); + } + expect(docsChangelogDriftProblems({'Unreleased': '\n'}, {}), isEmpty); + }); + + test('ignores released sections that are present in only one file', () { expect( docsChangelogDriftProblems({'0.1.0': '- Old.\n'}, {'0.2.0': '- New.\n'}), isEmpty, @@ -149,6 +157,12 @@ void main() { expect(problems.single, contains('bridge line must read')); } expect(docsChangelogDriftProblems({}, {'0.2.0': bridgeCore}), hasLength(1)); - expect(docsChangelogDriftProblems({}, {'Unreleased': bridgeCore}), isEmpty); + expect( + docsChangelogDriftProblems( + {'Unreleased': bridgeCore}, + {'Unreleased': bridgeDocs}, + ), + isEmpty, + ); }); } diff --git a/test/unit/tooling/high_risk_readiness_test.dart b/test/unit/tooling/high_risk_readiness_test.dart index 291e265cd..63ca115c5 100644 --- a/test/unit/tooling/high_risk_readiness_test.dart +++ b/test/unit/tooling/high_risk_readiness_test.dart @@ -4300,6 +4300,14 @@ final segment = '${Object()}ImageEditingRequest${Object()}'; 'packages/llamadart_studio/lib/src/services/runtime_factory.dart', 'packages/llamadart_studio/test/runtime_factory_test.dart', ), + ( + 'packages/llamadart_studio_core/lib/src/services/lifecycle_coordinator.dart', + 'packages/llamadart_studio/test/lifecycle_integration_test.dart', + ), + ( + 'packages/llamadart_studio/lib/src/services/runtime_factory.dart', + 'packages/llamadart_studio_core/test/runtime_integration_test.dart', + ), ( 'packages/llamadart_studio/lib/src/services/runtime_factory.dart', 'packages/llamadart_studio/integration_test/local_workflows_acceptance_test.dart', diff --git a/test/unit/tooling/high_risk_review_policy_test.dart b/test/unit/tooling/high_risk_review_policy_test.dart index 3e50a6669..f7b6b2e5e 100644 --- a/test/unit/tooling/high_risk_review_policy_test.dart +++ b/test/unit/tooling/high_risk_review_policy_test.dart @@ -57,6 +57,14 @@ void main() { expect(runbook, contains('reviewed as a change in its own right')); }); + test( + 'the runbook states the evaluator uses no package-local Studio pairing', + () { + final runbook = read('doc/high_risk_pre_merge_readiness.md'); + expect(runbook, contains('does not require package-local pairing')); + }, + ); + test('classifier help preserves rename and deletion visibility', () { final classifier = read('tool/testing/classify_high_risk_changes.dart'); diff --git a/test/unit/tooling/macos_litert_lm_prepare_app_script_test.dart b/test/unit/tooling/macos_litert_lm_prepare_app_script_test.dart index 31d0b4a96..0697851d3 100644 --- a/test/unit/tooling/macos_litert_lm_prepare_app_script_test.dart +++ b/test/unit/tooling/macos_litert_lm_prepare_app_script_test.dart @@ -25,7 +25,12 @@ void main() { expect(project, isNot(contains('macos_litert_lm_prepare_app.sh'))); }); - for (final docs in _installationDocs) { + final versions = + jsonDecode(File('website/versions.json').readAsStringSync()) as List; + for (final docs in [ + ..._installationDocs, + 'website/versioned_docs/version-${versions.first}/platforms/apple-setup.md', + ]) { // Only macOS can run the documented script, so its text may change only // together with this fixture, which selects the macOS tests. test('$docs build phase is the reviewed script', () { diff --git a/test/unit/tooling/markdown_test_suites_test.dart b/test/unit/tooling/markdown_test_suites_test.dart index 50bbcab52..d135018ce 100644 --- a/test/unit/tooling/markdown_test_suites_test.dart +++ b/test/unit/tooling/markdown_test_suites_test.dart @@ -109,6 +109,24 @@ void main() { ); }); + test('the Markdown lane covers the site build script', () { + expect( + inventory, + contains('test/unit/tooling/build_site_script_test.dart'), + ); + }); + + test('the workflow row attributes the macOS SDK input correctly', () { + final row = File('doc/ci_selection.md').readAsLinesSync().singleWhere( + (line) => line.startsWith('| Workflow/selector or unclassified paths |'), + ); + expect(row, contains('`.flutter-version` for `macos-15`')); + expect( + row, + isNot(contains('`packages/llamadart_validation/` for `macos-15`')), + ); + }); + test('the Markdown Tests job runs the inventory on Linux', () { final workflow = loadYaml(File('.github/workflows/ci.yml').readAsStringSync()) diff --git a/test/unit/tooling/native_default_consumer_qualification_workflow_test.dart b/test/unit/tooling/native_default_consumer_qualification_workflow_test.dart index ebd60e2ea..50bbcade2 100644 --- a/test/unit/tooling/native_default_consumer_qualification_workflow_test.dart +++ b/test/unit/tooling/native_default_consumer_qualification_workflow_test.dart @@ -376,8 +376,12 @@ void main() { final pin = File('${root.path}/lib/src/hook/native_release_pins.dart'); pin.parent.createSync(recursive: true); const historicalTag = 'v0.8.0-2'; - const currentTag = 'v1.0.0'; + const stableTag = 'v1.0.0'; const rebuildTag = 'v1.0.0-1'; + final dispatchTags = + (workflow()['on']['workflow_dispatch']['inputs']['expected_native_tag']['options'] + as YamlList) + .cast(); const sha = '1111111111111111111111111111111111111111'; const child = r''' import os @@ -434,20 +438,20 @@ exec(sys.argv[1], {}) ), ( 'current-tag-pin-drift', - currentTag, + stableTag, {'LLAMADART_DEFAULT_AOT_EXPECTED_NATIVE_TAG': historicalTag}, false, ), ( 'rebuild-request-pin-drift', - currentTag, + stableTag, {'LLAMADART_DEFAULT_AOT_EXPECTED_NATIVE_TAG': rebuildTag}, false, ), ( 'rebuild-source-pin-drift', rebuildTag, - {'LLAMADART_DEFAULT_AOT_EXPECTED_NATIVE_TAG': currentTag}, + {'LLAMADART_DEFAULT_AOT_EXPECTED_NATIVE_TAG': stableTag}, false, ), ('wrong-platform', historicalTag, {'TEST_PLATFORM': 'win32'}, false), @@ -458,12 +462,11 @@ exec(sys.argv[1], {}) {'QUALIFICATION_ARCH': 'x64', 'TEST_MACHINE': 'amd64'}, false, ), - ('valid-macos-historical', historicalTag, {}, true), - ('valid-windows-historical', historicalTag, windows, true), - ('valid-macos-current', currentTag, {}, true), - ('valid-windows-current', currentTag, windows, true), - ('valid-macos-rebuild', rebuildTag, {}, true), - ('valid-windows-rebuild', rebuildTag, windows, true), + ('unlisted-tag', 'v99.0.0', {}, false), + for (final tag in dispatchTags) ...[ + ('valid-macos-$tag', tag, {}, true), + ('valid-windows-$tag', tag, windows, true), + ], ]; for (final (label, sourceTag, overrides, requestsModel) in cases) { pin.writeAsStringSync("const llamaCppTag = '$sourceTag';\n"); @@ -493,6 +496,12 @@ exec(sys.argv[1], {}) contains('qualification checkout or source pin mismatch'), ); } + if (label == 'unlisted-tag') { + expect( + result.stderr, + contains('qualification input identity rejected'), + ); + } if (marker.existsSync()) expect(marker.readAsLinesSync(), ['attempt']); final receipt = jsonDecode( diff --git a/test/unit/tooling/support/markdown_reader_exemptions.dart b/test/unit/tooling/support/markdown_reader_exemptions.dart index 6ffe02277..a1f631941 100644 --- a/test/unit/tooling/support/markdown_reader_exemptions.dart +++ b/test/unit/tooling/support/markdown_reader_exemptions.dart @@ -103,7 +103,7 @@ const Map _ciToolFiles = { 'tool/testing/validation/internal_diagnostic.dart': 'ls-files', 'tool/testing/validation/remote.dart': 'listSync', 'tool/testing/verify_release_docs_versions.dart': - '.md | CHANGELOG | README | git show | website/', + '.md | CHANGELOG | README | SKILL | git show | skills/ | website/', 'website/lib/src/site/sidebar.dart': 'doc/', 'website/lib/src/site/site_model.dart': '.md', }; @@ -121,7 +121,7 @@ const Map _releaseToolFiles = { 'tool/testing/check_released_changelog_sections.dart': '.md | CHANGELOG | doc/ | find | git cat-file | git show | website/', 'tool/testing/verify_release_docs_versions.dart': - '.md | CHANGELOG | README | git show | website/', + '.md | CHANGELOG | README | SKILL | git show | skills/ | website/', }; const Map _pinTableFiles = { @@ -366,15 +366,6 @@ const Map suiteExemptions = { }, gate: null, ), - 'test/unit/tooling/build_site_script_test.dart': ( - reason: _tempTree, - evidence: { - 'test/unit/tooling/build_site_script_test.dart': 'website/', - 'website/lib/src/site/sidebar.dart': 'doc/', - 'website/lib/src/site/site_model.dart': '.md', - }, - gate: null, - ), 'test/unit/tooling/check_native_release_digests_test.dart': ( reason: _pinTables, evidence: {..._pinTableFiles}, diff --git a/test/unit/tooling/verify_release_docs_companion_pins_test.dart b/test/unit/tooling/verify_release_docs_companion_pins_test.dart index 85cdc6550..4bb7bcecf 100644 --- a/test/unit/tooling/verify_release_docs_companion_pins_test.dart +++ b/test/unit/tooling/verify_release_docs_companion_pins_test.dart @@ -323,6 +323,106 @@ void main() { } }); + group('current runtime docs', () { + late Directory root; + const pinSource = 'lib/src/hook/native_release_pins.dart'; + const installation = 'website/docs/getting-started/installation.md'; + const matrix = 'website/docs/platforms/support-matrix.md'; + const maintainer = 'website/docs/maintainers/native-and-web-sync.md'; + const skill = 'skills/llamadart-getting-started/SKILL.md'; + const companion = 'packages/llamadart_llama_cpp_flutter'; + const fixture = 'test/fixtures/native/litert_lm_v0_19_1_5_manifest.json'; + + setUp(() { + root = Directory.systemTemp.createTempSync('sw2-runtime-docs-'); + for (final path in [ + pinSource, + installation, + matrix, + maintainer, + skill, + fixture, + 'README.md', + '$companion/README.md', + '$companion/darwin/llamadart_llama_cpp_flutter/Package.swift', + ]) { + final target = File('${root.path}/$path'); + target.parent.createSync(recursive: true); + File(path).copySync(target.path); + } + }); + tearDown(() => root.deleteSync(recursive: true)); + + void replace(String path, Pattern before, String after) { + final file = File('${root.path}/$path'); + final original = file.readAsStringSync(); + final changed = original.replaceFirst(before, after); + expect(changed, isNot(original), reason: path); + file.writeAsStringSync(changed); + } + + test( + 'the current checkout agrees with the maintained pins and manifest', + () { + final errors = []; + expect(checkCurrentNativePins(root, errors), isNotNull); + checkLiteRtLmDocs(root, errors); + expect(errors, isEmpty); + }, + ); + + for (final (path, pattern, replacement) in [ + ( + matrix, + RegExp(r'(?<=\| llama\.cpp native \| `leehack/llamadart-native@)[^`]+'), + 'v0.0.1', + ), + ( + installation, + RegExp( + r'(?<=ABI-compatible with the default `leehack/llamadart-native@)[^`]+', + ), + 'v0.0.1', + ), + ]) { + test( + '$path rejects a stale llama.cpp claim with other claims current', + () { + replace(path, pattern, replacement); + final errors = []; + checkCurrentNativePins(root, errors); + expect(errors, [startsWith('$path pins native tag v0.0.1')]); + }, + ); + } + + test('a stale LiteRT-LM README pin is rejected', () { + replace( + 'README.md', + RegExp( + r'(?<=\| Native LiteRT-LM / `\.litertlm` \| `leehack/litert-lm-native@)[^`]+', + ), + 'v0.0.1', + ); + final errors = []; + checkLiteRtLmDocs(root, errors); + expect(errors, [startsWith('README.md pins LiteRT-LM v0.0.1')]); + }); + + for (final path in ['README.md', matrix, maintainer, skill]) { + test('$path rejects a stale LiteRT-LM owner commit', () { + replace( + path, + RegExp(r'owner(?: source)? `[0-9a-f]{8}`'), + 'owner `11111111`', + ); + final errors = []; + checkLiteRtLmDocs(root, errors); + expect(errors, [startsWith('$path names LiteRT-LM owner 11111111')]); + }); + } + }); + test('checked-in SwiftPM pins are recorded in released or pending notes', () { final errors = []; // Pin adoption precedes companion release preparation. The CLI enforces diff --git a/tool/ci/markdown_test_suites.txt b/tool/ci/markdown_test_suites.txt index f3d5bc9f2..47dfb744c 100644 --- a/tool/ci/markdown_test_suites.txt +++ b/tool/ci/markdown_test_suites.txt @@ -1,4 +1,5 @@ test/unit/hook/native_release_pins_test.dart +test/unit/tooling/build_site_script_test.dart test/unit/tooling/check_released_changelog_sections_test.dart test/unit/tooling/check_webgpu_bridge_tag_test.dart test/unit/tooling/companion_inventory_test.dart diff --git a/tool/ci/select_jobs.py b/tool/ci/select_jobs.py index 9c6e655c6..6c77b38c6 100644 --- a/tool/ci/select_jobs.py +++ b/tool/ci/select_jobs.py @@ -129,7 +129,7 @@ def full(reason): elif path == 'website/docs/integrations/genkit.md': jobs.update(('docs-check', 'docs-versions', 'genkit')) elif path.startswith('packages/genkit_llamadart/'): - jobs.add('genkit') + jobs.update(('genkit', 'test-linux-coverage')) elif path.startswith(('packages/llamadart_studio/', 'packages/llamadart_studio_core/')): jobs.add('studio') @@ -142,7 +142,7 @@ def full(reason): elif path == 'website/docs/guides/model-store.md': jobs.update(('docs-check', 'docs-versions', 'model-store')) elif path.startswith('packages/llamadart_model_store/'): - jobs.add('model-store') + jobs.update(('model-store', 'test-linux-coverage')) elif (path in ('README.md', 'CHANGELOG.md', 'CONTRIBUTING.md', 'AGENTS.md', 'LICENSE') or path.startswith(('doc/', 'website/', 'tool/docs/')) or (path.startswith(('packages/', 'example/')) and path.endswith('.md'))): diff --git a/tool/testing/check_released_changelog_sections.dart b/tool/testing/check_released_changelog_sections.dart index 21d636793..4473fc009 100644 --- a/tool/testing/check_released_changelog_sections.dart +++ b/tool/testing/check_released_changelog_sections.dart @@ -8,7 +8,7 @@ /// into the new `## X.Y.Z` section. Everything from the first `## ` /// heading down must therefore match the merge base with the PR's base branch /// byte-for-byte. Release-prep PRs, detected as `release_on_prep_merge.yml` -/// detects them, are exempt because they create the new section. +/// detects them, may change these sections and must remove `## Unreleased`. /// /// The docs changelog keeps only the current and previous minor, so it may /// also lose its oldest sections: its tail may be cut at a `## ` @@ -35,6 +35,34 @@ const releasedChangelogs = [ 'website/docs/changelog/recent-releases.md', ]; +final RegExp _unreleasedHeading = RegExp(r'^##\s+Unreleased\s*$'); + +/// Problems with `## Unreleased` among [changelog]'s level-two [headings]. +/// +/// `main` keeps exactly one `## Unreleased`, above every released section, +/// and release prep removes it. Union merges of the changelogs never conflict, +/// so a rebase across a release can leave a stray copy without any warning. +List unreleasedHeadingProblems( + String changelog, + List headings, { + required bool releasePrep, +}) { + final positions = [ + for (final (index, heading) in headings.indexed) + if (_unreleasedHeading.hasMatch(heading)) index, + ]; + if (positions.isEmpty) return const []; + if (!releasePrep) { + return positions.length == 1 && positions.single == 0 + ? const [] + : [ + '$changelog must have at most one `## Unreleased`, above every ' + 'released section.', + ]; + } + return ['$changelog must not keep `## Unreleased` when publishing.']; +} + /// Changelogs that may lose their oldest released sections. const truncatableChangelogs = { 'website/docs/changelog/recent-releases.md', @@ -274,7 +302,22 @@ List checkReleasedChangelogSections( repository: repository, )) { log?.call('Release-prep PR: released changelog sections may change.'); - return const []; + final problems = []; + for (final path in releasedChangelogs) { + final file = File('${repoRoot.path}/$path'); + if (!file.existsSync()) { + problems.add('$path is missing.'); + continue; + } + problems.addAll( + unreleasedHeadingProblems( + path, + file.readAsLinesSync(), + releasePrep: true, + ), + ); + } + return problems; } final mergeBase = _git(repoRoot, ['merge-base', 'HEAD', 'origin/$baseRef']); @@ -375,7 +418,7 @@ void main(List arguments) { log: stdout.writeln, ); if (problems.isNotEmpty) { - stderr.writeln('Released changelog sections changed:'); + stderr.writeln('Changelog check failed:'); for (final problem in problems) { stderr.writeln('- $problem'); } diff --git a/tool/testing/verify_release_docs_versions.dart b/tool/testing/verify_release_docs_versions.dart index b0971e24a..51d07293b 100644 --- a/tool/testing/verify_release_docs_versions.dart +++ b/tool/testing/verify_release_docs_versions.dart @@ -68,27 +68,47 @@ const Map> _currentDocDependencies = ], }; -final Map _currentNativePins = { - 'lib/src/hook/native_release_pins.dart': RegExp( - r"const llamaCppTag = '([^']+)';", +const _nativePinSource = 'lib/src/hook/native_release_pins.dart'; +const _installation = 'website/docs/getting-started/installation.md'; +const _supportMatrix = 'website/docs/platforms/support-matrix.md'; + +final List<(String, RegExp)> _currentNativePins = [ + (_nativePinSource, RegExp(r"const llamaCppTag = '([^']+)';")), + ( + 'packages/llamadart_llama_cpp_flutter/darwin/' + 'llamadart_llama_cpp_flutter/Package.swift', + RegExp(r'let llamaCppTag = "([^"]+)"'), ), - 'packages/llamadart_llama_cpp_flutter/darwin/' - 'llamadart_llama_cpp_flutter/Package.swift': RegExp( - r'let llamaCppTag = "([^"]+)"', + ( + 'packages/llamadart_llama_cpp_flutter/README.md', + RegExp( + r'The Apple SwiftPM manifest pins\s+`leehack/llamadart-native@([^`]+)`\.', + ), ), - 'packages/llamadart_llama_cpp_flutter/README.md': RegExp( - r'The Apple SwiftPM manifest pins\s+`leehack/llamadart-native@([^`]+)`\.', + ( + 'README.md', + RegExp( + r'\| Native llama\.cpp / GGUF \| `leehack/llamadart-native@([^`]+)` \|', + ), ), - 'README.md': RegExp( - r'\| Native llama\.cpp / GGUF \| `leehack/llamadart-native@([^`]+)` \|', + (_installation, RegExp(r'llamadart_native_tag:\s*([^\s#]+)')), + ( + _installation, + RegExp( + r'ABI-compatible with the default\s+`leehack/llamadart-native@([^`]+)`', + ), ), - 'website/docs/getting-started/installation.md': RegExp( - r'llamadart_native_tag:\s*([^\s#]+)', + ( + _supportMatrix, + RegExp( + r'The native-assets hook currently pins `llamadart-native` tag\s+`([^`]+)`', + ), ), - 'website/docs/platforms/support-matrix.md': RegExp( - r'The native-assets hook currently pins `llamadart-native` tag\s+`([^`]+)`', + ( + _supportMatrix, + RegExp(r'\| llama\.cpp native \| `leehack/llamadart-native@([^`]+)` \|'), ), -}; +]; /// Current docs whose prose calls a specific native tag the default runtime. /// @@ -96,16 +116,10 @@ final Map _currentNativePins = { /// describe the pin that was current when they were written. The WebGPU pages /// are excluded too: bridge assets deliberately trail the native pin, and /// `tool/testing/check_webgpu_bridge_tag.dart` owns that divergence. -/// `README.md` and `website/docs/getting-started/installation.md` are excluded -/// as well, but their coverage differs by site. [_currentNativePins] checks -/// `README.md`'s pin table row and `installation.md`'s `llamadart_native_tag:` -/// override, so scanning those here would duplicate that contract. -/// `installation.md`'s prose `leehack/llamadart-native@` claim is not in -/// [_currentNativePins]; `tool/native/sync_native_release_pins.py` rewrites -/// every `leehack/llamadart-native@` occurrence in these docs and owns -/// keeping it current. +/// [_currentNativePins] checks the README pin table and the installation +/// guide's override tag and ABI note. const List defaultRuntimeClaimDocs = [ - 'website/docs/platforms/support-matrix.md', + _supportMatrix, 'website/docs/guides/performance-tuning.md', ]; @@ -905,41 +919,6 @@ Map installDocVersions( return result; } -/// Changelogs whose first release heading must name the version being -/// published. -const _releasePrepChangelogs = [ - 'CHANGELOG.md', - 'website/docs/changelog/recent-releases.md', -]; - -final RegExp _unreleasedHeading = RegExp(r'^##\s+Unreleased\s*$'); - -/// Problems with `## Unreleased` among [changelog]'s level-two [headings]. -/// -/// `main` keeps exactly one `## Unreleased`, above every released section, -/// and release prep removes it. Union merges of the changelogs never conflict, -/// so a rebase across a release can leave a stray copy without any warning. -List unreleasedHeadingProblems( - String changelog, - List headings, { - required bool releasePrep, -}) { - final positions = [ - for (final (index, heading) in headings.indexed) - if (_unreleasedHeading.hasMatch(heading)) index, - ]; - if (positions.isEmpty) return const []; - if (!releasePrep) { - return positions.length == 1 && positions.single == 0 - ? const [] - : [ - '$changelog must have at most one `## Unreleased`, above every ' - 'released section.', - ]; - } - return ['$changelog must not keep `## Unreleased` when publishing.']; -} - /// Docs changelog whose releases stop at the previous minor; `CHANGELOG.md` /// keeps the rest. const _docsChangelog = 'website/docs/changelog/recent-releases.md'; @@ -1017,35 +996,47 @@ String _firstDifference(String core, String docs) { 'page ${line(docsLines)}'; } -/// Released sections that [docs] keeps from [core] but words differently. +/// Drift between the Unreleased notes and the retained releases in both files. /// -/// Both changelogs are edited by hand and union-merge, so nothing else keeps -/// a retained release's bullets identical. The docs page must use its -/// prescribed bridge wording (`- ` marker, no "the"), which normalising both -/// sides would otherwise let a `*` or "the default" through. +/// The docs page must use its prescribed bridge wording (`- ` marker, no +/// "the"), which normalizing both sides would otherwise let through. List docsChangelogDriftProblems( Map core, Map docs, ) { - final normalized = _normalizedBridgeLines; - return [ - for (final MapEntry(key: heading, value: body) in docs.entries) - if (heading != 'Unreleased') ...[ - for (final line in body.split('\n')) - if (_bridgeBulletLine.hasMatch(line) && - (line.startsWith('* ') || - line.contains('the default WebGPU bridge assets'))) - '$_docsChangelog section "## $heading": bridge line must read ' - '"- ... default WebGPU bridge assets ..." (a "-" marker, no ' - '"the"); got ${jsonEncode(line)}', - if (core.containsKey(heading) && - normalized(core[heading]!) != normalized(body)) - '$_docsChangelog section "## $heading" differs from CHANGELOG.md ' - '${_firstDifference(normalized(core[heading]!), normalized(body))}' - '; keep the bullets of every retained release identical (apart ' - 'from the bullet marker and "the" on the WebGPU bridge line).', - ], - ]; + final headings = { + ...docs.keys, + if (core.containsKey('Unreleased')) 'Unreleased', + }; + final problems = []; + for (final heading in headings) { + final docsBody = docs[heading] ?? ''; + for (final line in docsBody.split('\n')) { + if (_bridgeBulletLine.hasMatch(line) && + (line.startsWith('* ') || + line.contains('the default WebGPU bridge assets'))) { + problems.add( + '$_docsChangelog section "## $heading": bridge line must read ' + '"- ... default WebGPU bridge assets ..." (a "-" marker, no ' + '"the"); got ${jsonEncode(line)}', + ); + } + } + final coreBody = heading == 'Unreleased' + ? core[heading] ?? '' + : core[heading]; + if (coreBody == null) continue; + final normalizedCore = _normalizedBridgeLines(coreBody); + final normalizedDocs = _normalizedBridgeLines(docsBody); + if (normalizedCore != normalizedDocs) { + problems.add( + '$_docsChangelog section "## $heading" differs from CHANGELOG.md ' + '${_firstDifference(normalizedCore, normalizedDocs)}' + '; keep the bullets identical apart from the prescribed WebGPU bridge wording.', + ); + } + } + return problems; } void main(List arguments) { @@ -1096,7 +1087,8 @@ void main(List arguments) { errors: errors, ); } - nativePin = _checkCurrentNativePins(errors); + nativePin = checkCurrentNativePins(Directory.current, errors); + checkLiteRtLmDocs(Directory.current, errors); if (nativePin != null) { for (final path in defaultRuntimeClaimDocs) { final lines = _readLines(path, errors); @@ -1114,7 +1106,7 @@ void main(List arguments) { } if (releasePrep) { final expected = '## ${versions['llamadart']}'; - for (final changelog in _releasePrepChangelogs) { + for (final changelog in releasedChangelogs) { final heading = _matchInFile( Directory.current, changelog, @@ -1127,7 +1119,7 @@ void main(List arguments) { } } } - for (final changelog in _releasePrepChangelogs) { + for (final changelog in releasedChangelogs) { final lines = _readLines(changelog, errors); if (lines != null) { final headings = lines.where(RegExp(r'^##\s').hasMatch).toList(); @@ -1203,32 +1195,21 @@ void main(List arguments) { } } -String? _checkCurrentNativePins(List errors) { - final pins = {}; - for (final entry in _currentNativePins.entries) { - final file = File(entry.key); - if (!file.existsSync()) { - errors.add('${entry.key} does not exist.'); - continue; - } - - String text; - try { - text = file.readAsStringSync(); - } on FileSystemException catch (error) { - errors.add('Could not read ${entry.key}: ${error.message}.'); - continue; - } - - final match = entry.value.firstMatch(text); - if (match == null) { - errors.add('${entry.key} does not contain its current native pin.'); - continue; - } - final pin = match.group(1)!; +/// Checks each current llama.cpp pin claim against the hook's source pin. +String? checkCurrentNativePins(Directory repoRoot, List errors) { + String? expectedPin; + for (final (path, pattern) in _currentNativePins) { + final pin = _matchInFile( + repoRoot, + path, + pattern, + 'current native pin', + errors, + ); + if (pin == null) continue; if (!isValidNativeReleaseTag(pin)) { errors.add( - '${entry.key} uses unsupported native tag $pin; expected stable ' + '$path uses unsupported native tag $pin; expected stable ' 'vMAJOR.MINOR.PATCH, stable wrapper rebuild ' 'vMAJOR.MINOR.PATCH-N, canonical historical/nightly bNNNN without ' 'leading zeros, nightly wrapper ' @@ -1236,25 +1217,87 @@ String? _checkCurrentNativePins(List errors) { ); continue; } - pins[entry.key] = pin; - } - - if (pins.isEmpty) { - return null; - } - final expectedPin = - pins['lib/src/hook/native_release_pins.dart'] ?? pins.values.first; - for (final entry in pins.entries) { - if (entry.value != expectedPin) { + if (path == _nativePinSource) { + expectedPin = pin; + } else if (expectedPin != null && pin != expectedPin) { errors.add( - '${entry.key} pins native tag ${entry.value}, but ' - 'lib/src/hook/native_release_pins.dart pins $expectedPin.', + '$path pins native tag $pin, but $_nativePinSource pins $expectedPin.', ); } } return expectedPin; } +/// Checks the README's LiteRT-LM tag and the current source claims against the +/// archived owner manifest used to validate the companion's SwiftPM pins. +void checkLiteRtLmDocs(Directory repoRoot, List errors) { + const readme = 'README.md'; + final pin = _matchInFile( + repoRoot, + readme, + RegExp( + r'\| Native LiteRT-LM / `\.litertlm` \| `leehack/litert-lm-native@([^`]+)` \|', + ), + 'current LiteRT-LM pin', + errors, + ); + if (pin != null && pin != liteRtLmReleaseTag) { + errors.add( + '$readme pins LiteRT-LM $pin, but $_nativePinSource pins $liteRtLmReleaseTag.', + ); + } + + final fixtureTag = liteRtLmReleaseTag.replaceAll(RegExp(r'[.-]'), '_'); + final fixture = 'test/fixtures/native/litert_lm_${fixtureTag}_manifest.json'; + final Object? manifest; + try { + manifest = jsonDecode(File('${repoRoot.path}/$fixture').readAsStringSync()); + } on IOException catch (error) { + errors.add('$fixture could not be read: $error'); + return; + } on FormatException { + errors.add('$fixture is not valid JSON.'); + return; + } + final commit = RegExp(r'^[0-9a-f]{40}$'); + if (manifest case { + 'release': {'tag': liteRtLmReleaseTag}, + 'native': {'commit': final String owner}, + 'upstream': {'commit': final String upstream}, + } when commit.hasMatch(owner) && commit.hasMatch(upstream)) { + final expected = (owner.substring(0, 8), upstream.substring(0, 8)); + final claim = RegExp( + r'published(?: native)?\s+' + r'(?:\[[^\]]+\]\(https://github\.com/leehack/litert-lm-native/releases/tag/[^)]+\),?|v[^\s`]+)' + r'\s+\(?owner(?: source)? `([0-9a-f]{8})`(?: /|,) upstream\s+`([0-9a-f]{8})`', + ); + for (final path in [ + readme, + _supportMatrix, + 'website/docs/maintainers/native-and-web-sync.md', + 'skills/llamadart-getting-started/SKILL.md', + ]) { + final lines = _readLines(path, errors, repoRoot: repoRoot); + if (lines == null) continue; + final match = claim.firstMatch(lines.join('\n')); + if (match == null) { + errors.add( + '$path does not contain its current LiteRT-LM source claim.', + ); + } else if ((match[1], match[2]) != expected) { + errors.add( + '$path names LiteRT-LM owner ${match[1]} / upstream ${match[2]}, ' + 'but $fixture records ${expected.$1} / ${expected.$2}.', + ); + } + } + } else { + errors.add( + '$fixture must record $liteRtLmReleaseTag and its full source commits.', + ); + } +} + Version? _parseCoreVersion(String version, List errors) { try { return Version.parse(version); @@ -1346,8 +1389,12 @@ void _checkCurrentDoc({ } } -List? _readLines(String path, List errors) { - final file = File(path); +List? _readLines( + String path, + List errors, { + Directory? repoRoot, +}) { + final file = File(repoRoot == null ? path : '${repoRoot.path}/$path'); if (!file.existsSync()) { errors.add('$path does not exist.'); return null; diff --git a/website/docs/maintainers/release-workflow.md b/website/docs/maintainers/release-workflow.md index 388dc6bed..65ae66db1 100644 --- a/website/docs/maintainers/release-workflow.md +++ b/website/docs/maintainers/release-workflow.md @@ -460,8 +460,10 @@ jobs) fails such a PR: everything from the first `## ` heading down must match the merge base with the PR's base branch byte-for-byte, and the error names the file and first differing line. Move the bullet back under `## Unreleased`. Release-prep PRs, detected by the same label and branch rules -as `release_on_prep_merge.yml`, are exempt. CI reads labels from the event -that started the run, so push again after adding the `release-prep` label. +as `release_on_prep_merge.yml`, can edit released sections. The PR check +requires both changelogs to drop the `## Unreleased` heading. CI reads labels +from the event that started the run, so push again after adding the +`release-prep` label. One change to a released section is allowed outside release prep: the docs changelog may lose its oldest sections. It passes when what remains is an