Fix wrong instruction for agent. - #1031
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the code visibility guidelines in the SKILL.md documentation for the genui-helper skill. The review feedback correctly points out that in Dart, library-private elements (prefixed with an underscore) cannot be accessed by tests even when annotated with @VisibleForTesting, and suggests clarifying that the underscore prefix must be removed.
Note: Security Review has been skipped due to the limited scope of the PR.
| For example, in Dart, keep | ||
| the `_` prefix and annotate with `@visibleForTesting`. | ||
| language's test-visibility mechanism instead of making the element public. | ||
| For example, in Dart, annotate the element with `@visibleForTesting`. |
There was a problem hiding this comment.
In Dart, library-private elements (with a leading _) cannot be accessed by tests even if annotated with @visibleForTesting. To make them accessible, the _ prefix must be removed. Clarifying this explicitly helps avoid confusion.
| For example, in Dart, annotate the element with `@visibleForTesting`. | |
| For example, in Dart, remove the _ prefix and annotate the element with @visibleForTesting. |
There was a problem hiding this comment.
I agree with the bot here. Saying to keep it private but add @visibleForTesting is confusing. You can't do both.
Why not author the API for testability instead? It will be more robust, configurable, etc. For example, using the file package with dependency injection is a great way to make tests not access the filesystem and use a memory filesystem instead.
@visibleForTesting isn't really enforcing anything anyhow: it doesn't actually hide the API, it just annotates it with a warning. It's still part of the public API, and you then have to deprecate it, etc., just like any other public API. If you're OK with compiler warnings, then you can access the API.
Addresses this comment: #1029 (comment)