Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .agent/skills/genui-helper/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ When creating a new UI component in `genui`:
## Code visibility

Make every code element as private as it can be. If tests need access, use the
language's test-visibility mechanism instead of making it public.
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


Loading