Repository navigation
Conversation
insert_missing_extension put a registration before the first
`// --FAT_CLIENT_START--` in the file. The template's main.self.dart and
main.server.dart also bracket imports at the top with those markers, so an
extension package listed in ruflet.yaml (git or path) was registered in the
import block and the entrypoint no longer parsed:
line 5, column 5 of lib/main.server.dart: Functions must have an
explicit list of parameters.
Search for the marker only between `final extensions = <RufletExtension>[`
and its closing `];`, and register first in the list when it has no marker
there. The template's markers are unchanged: published gems rely on them.
The services_app goldens, the only fixture with extension packages, change
accordingly: compat_git_ext and compat_local_ext move from the import block
into the list in main.self.dart and main.server.dart. No other golden changes.
The template's lib/main.dart only calls main.self.dart and has no
`final extensions = <RufletExtension>[` list. insert_missing_extension
appended the registration at the end of such a file, so with an extension
package listed in ruflet.yaml lib/main.dart ended in
Future<void> main() => self_app.main();
compat_git_ext.Extension(),
and failed to parse with the same "Functions must have an explicit list of
parameters" error. `flutter build` targets main.self.dart or
main.server.dart, so builds passed, but `dart format`/`flutter analyze` of
lib/ and anything that compiles lib/main.dart failed.
Without the list there is nowhere to register: insert_missing_extension now
returns the file as is, and sync_external_extension_registrations skips the
file, import included.
The services_app goldens change only in lib/main.dart, which is now
identical to the template.
This was referenced Nov 20, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When a Ruflet app lists its own extension package in
ruflet.yaml:ruflet buildwritesext_pkg.Extension(),into the import block ofbuild/client/lib/main.server.dartandmain.self.dart, not intofinal extensions = <RufletExtension>[ ... ];. The entrypoint stops parsing:so a real
flutter buildfails. This happens with published gems 0.0.21, 0.0.22 and 0.0.23, and with main. It was found while reviewing AdamMusa/ruflet-template#2, and template main e32c873 shows the same thing.Cause
insert_missing_extension(now inpackages/ruflet/lib/ruflet/cli/build/contributors/extensions.rb, after #75 splitbuild_command.rb) puts the registration before the first// --FAT_CLIENT_START--anywhere in the file. The template'smain.server.dartandmain.self.dartalso wrap some imports at the top of the file in FAT_CLIENT markers, so the first match is in the import block.Fix
fix: register extension packages inside the extensions list: look for the marker only between thefinal extensions = <RufletExtension>[line and its closing];. If the list has no marker of its own (or has no closing];), insert the registration right after the list opening.fix: leave an entrypoint without an extensions list unchanged: the template'slib/main.dartonly callsmain.self.dartand has no extensions list. The old fallback appended the registration at the end of that file, so it failed to parse with the same error.flutter buildtargetsmain.self.dart/main.server.dart, so builds still passed, butdart format/flutter analyzeoflib/failed, and so would anything that compileslib/main.dart. A file without the list is now left alone: no registration and no import. This commit stands on its own and can be dropped if you'd rather keep the old fallback.Both callers use the shared helper:
sync_external_extension_registrations(git/path packages) andsync_client_main_extensions(re-adding a bundled extension the template lists).The template's entrypoints are not changed. Published gems rely on the import-block markers.
Released gems
0.0.21, 0.0.22 and 0.0.23 can't be fixed. Any app that lists its own extension package keeps failing to build on those versions, and only a new gem release fixes it. An existing
build/clientleft broken by those gems needs no cleanup: thetemplate_refreshcontributor copieslib/main.dart,main.self.dartandmain.server.dartfresh from the template at the start of every build, so the first build with the fixed gem writes them correctly.Behavior changes (compat goldens)
Only
services_appchanges. It is the one fixture with extension packages (compat_git_extfrom git,compat_local_extfrom a path). Its 25 build goldens that pin those registrations were regenerated. All 234 goldens were checked, and no other golden changed.lib/main.self.dart,lib/main.server.dart:compat_git_ext.Extension(),andcompat_local_ext.Extension(),move from the import block into the extensions list, before its// --FAT_CLIENT_START--. File sizes are unchanged.lib/main.dart: no longer edited. It is now identical to the template, so the "files identical" count goes from 188 to 189.Testing
packages/ruflet/test/build_extension_registration_test.rb. Its entrypoint has the template's shape: FAT_CLIENT blocks in the imports and in the list. It also covers a list with no marker of its own, an unclosed list, a rebuild (no duplicates) and themain.dartwrapper. Three of its tests fail on main, and themain.darttest also fails on the first commit alone.packages/ruflet/test/*_test.rbpasses, includingcompat_goldens_test.rb(242 runs).ruby packages/ruflet/test/compat/compat.rb: before the golden regeneration it reported exactly the 25services_appgoldens and nothing else; afterwards, 234 checked, 0 failing.ruflet newwith a pathext_pkg, template e32c873, Flutter 3.41.2.ruflet build webbuiltbuild/web, anddart format --output=noneparseslib/main.dart,lib/main.self.dartandlib/main.server.dart.