-
Notifications
You must be signed in to change notification settings - Fork 156
feat: add API boundary runner, relocate fixtures, and configure CI check #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
reidbaker
merged 5 commits into
flutter:main
from
reidbaker:feat/api-boundary-runner-2026-07-16
Jul 17, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a15d14d
feat: export RuleConfig and RuleConfigPatch in dart_skills_lint.dart
reidbaker f9bda20
docs: enforce diagnostic consumer migration step right inside check-d…
reidbaker b134690
refactor: relocate examples, add API boundary runner and GHA validati…
reidbaker 53bbd82
Merge branch 'feat/export-rule-config-patch-2026-07-16' into feat/api…
reidbaker 3d375fe
refactor: apply PR code review suggestions on API boundary path resol…
reidbaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
tool/dart_skills_lint/example/api_boundary_runner/bin/main.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,69 @@ | ||||||||||||||||||||
| // Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file | ||||||||||||||||||||
| // for details. All rights reserved. Use of this source code is governed by a | ||||||||||||||||||||
| // BSD-style license that can be found in the LICENSE file. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // ignore_for_file: avoid_print | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import 'dart:io'; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import 'package:dart_skills_lint/dart_skills_lint.dart'; | ||||||||||||||||||||
| import 'package:logging/logging.dart'; | ||||||||||||||||||||
| import 'package:path/path.dart' as p; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Future<void> main(List<String> args) async { | ||||||||||||||||||||
| Logger.root.level = Level.ALL; | ||||||||||||||||||||
| Logger.root.onRecord.listen((record) => print(record.message)); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| print('Running API boundary validation runner...'); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| String findPath(String relativeSuffix) { | ||||||||||||||||||||
| final pathsToTry = <String>[ | ||||||||||||||||||||
| p.join('example', 'skills', relativeSuffix), | ||||||||||||||||||||
| p.join('..', 'skills', relativeSuffix), | ||||||||||||||||||||
| if (Platform.script.scheme == 'file') | ||||||||||||||||||||
| p.join(p.dirname(Platform.script.toFilePath()), '..', '..', 'skills', relativeSuffix), | ||||||||||||||||||||
| ]; | ||||||||||||||||||||
| for (final path in pathsToTry) { | ||||||||||||||||||||
| final String absolutePath = p.absolute(path); | ||||||||||||||||||||
| if (Directory(absolutePath).existsSync()) { | ||||||||||||||||||||
| return p.normalize(absolutePath); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| throw StateError('Could not locate skills/$relativeSuffix directory.'); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| final String validSkillPath = findPath('valid'); | ||||||||||||||||||||
| final String invalidSkillPath = findPath('invalid'); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| print('Validating valid skill at: $validSkillPath'); | ||||||||||||||||||||
| final bool validResult = await validateSkills( | ||||||||||||||||||||
| individualSkillPaths: [validSkillPath], | ||||||||||||||||||||
| resolvedRuleConfigs: { | ||||||||||||||||||||
| 'check-absolute-paths': const RuleConfigPatch(severity: AnalysisSeverity.disabled), | ||||||||||||||||||||
| }, | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if (!validResult) { | ||||||||||||||||||||
| print('Error: Valid skill fixture failed validation!'); | ||||||||||||||||||||
| exitCode = 1; | ||||||||||||||||||||
| return; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| print('Success: Valid skill fixture validated cleanly.'); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| print('Validating invalid skill at: $invalidSkillPath'); | ||||||||||||||||||||
| // Since this is invalid, we expect it to fail under standard rules. | ||||||||||||||||||||
| final bool invalidResult = await validateSkills( | ||||||||||||||||||||
| individualSkillPaths: [invalidSkillPath], | ||||||||||||||||||||
| printWarnings: false, | ||||||||||||||||||||
| quiet: true, | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if (invalidResult) { | ||||||||||||||||||||
| print('Error: Invalid skill fixture unexpectedly passed validation!'); | ||||||||||||||||||||
| exitCode = 1; | ||||||||||||||||||||
| return; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+61
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting
Suggested change
|
||||||||||||||||||||
| print('Success: Invalid skill fixture failed validation as expected.'); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| print('API boundary verification completed successfully.'); | ||||||||||||||||||||
| } | ||||||||||||||||||||
9 changes: 9 additions & 0 deletions
9
tool/dart_skills_lint/example/api_boundary_runner/pubspec.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| name: api_boundary_runner | ||
| description: An example code runner that validates the public API boundary. | ||
| environment: | ||
| sdk: ^3.11.0-0 | ||
| dependencies: | ||
| path: ^1.9.0 | ||
| logging: ^1.2.0 | ||
| dart_skills_lint: | ||
| path: ../../ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling
exit(1)immediately terminates the Dart VM, which can truncate pending asynchronous operations or stdout/stderr streams. SettingexitCode = 1and returning frommainallows the VM to flush all event queues and terminate cleanly.