Skip to content

fix: refactor annotation retrieval - #207

Merged
petercinibulk merged 1 commit into
mainfrom
fix/tests
Sep 13, 2026
Merged

petercinibulk merged 1 commit into
mainfrom
fix/tests

Conversation

@techouse

@techouse techouse commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The test suite started failing when dependency resolution selected analyzer 14.4.0 (see CI run 34732754518). The EnviedGenerator was still invoked, but generateForAnnotatedElement then re-scanned element.metadata.annotations and identified Envied annotations with:

annotation.element?.displayName == 'Envied'

With Analyzer 14.4.0, that secondary lookup no longer matched the @Envied annotations. The resulting annotation list was empty, so generation produced only the standard header with an empty generated_from: value. This caused generated output, workspace asset tracking, and hidden-env-file tests to fail. The same code passed with Analyzer 14.3.0; the previous successful run (32518422640) resolved Analyzer 14.1.0.

Change

Collect annotations through source_gen's type checker instead:

final List<ConstantReader> enviedAnnotations = _typeChecker(
  Envied,
  inPackage: 'envied',
).annotationsOf(element).map(ConstantReader.new).toList(growable: false);

This matches annotations by their resolved type and package rather than depending on Analyzer's annotation element display name. It also preserves support for multiple @Envied annotations.

This fixes the compatibility issue without narrowing the existing dependency constraint (analyzer: ">=8.0.0 <15.0.0"). No build_runner, build_test, or Melos changes are required.

Verification

  • Analyzer 14.4.0 resolves successfully.
  • melos test passes for both packages.
  • melos run validate passes.
  • Existing tests covering multiple annotations and hidden environment files pass.

@techouse techouse added this to the 1.3.9 milestone Sep 13, 2026
@techouse techouse added bug Something isn't working dependencies Pull requests that update a dependency file labels Sep 13, 2026
@techouse

Copy link
Copy Markdown
Collaborator Author

@petercinibulk Please throw an eye on this, once you get a minute 🙏 It's a blocker for 1.3.9.

@petercinibulk
petercinibulk merged commit 8627700 into main Sep 13, 2026
7 checks passed
@techouse
techouse deleted the fix/tests branch September 13, 2026 09:50
@techouse techouse mentioned this pull request Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump analyzer dependency in envied_generator to support ^14.x.x (Dart 3.14)

2 participants