Skip to content

Fix wrong instruction for agent. - #1031

Open
polina-c wants to merge 1 commit into
flutter:mainfrom
polina-c:correction
Open

Fix wrong instruction for agent.#1031
polina-c wants to merge 1 commit into
flutter:mainfrom
polina-c:correction

Conversation

@polina-c

@polina-c polina-c commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Addresses this comment: #1029 (comment)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
For example, in Dart, annotate the element with `@visibleForTesting`.
For example, in Dart, remove the _ prefix and annotate the element with @visibleForTesting.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

For example: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#avoid-using-visiblefortesting

@polina-c polina-c mentioned this pull request Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants