Skip to content

fix: let ruflet.yaml's display_name win over the app_name ruflet new writes into services.yaml - #112

Merged
AdamMusa merged 2 commits into
mainfrom
fix/ruflet-yaml-display-name-wins
Nov 20, 2026
Merged

AdamMusa merged 2 commits into
mainfrom
fix/ruflet-yaml-display-name-wins

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Fixes #106

Problem

ruflet new writes app: app_name: <Name> into services.yaml. If the project names the app in ruflet.yaml with app.display_name, that name is ignored. load_ruflet_config merged the two app blocks key by key (service_config["app"].merge(declared)), so services.yaml's app_name stayed next to ruflet.yaml's display_name. build_client_metadata reads app_name first, so the generated name shipped, with no warning.

This contradicts the loader's own comment ("fills gaps rather than overriding what the project states"), the README ("what the project states wins", with app_name and display_name as accepted spellings) and the configuration reference, which calls display_name the user-facing name. The bug is longstanding: gem 0.0.23 behaves the same.

What changed

packages/ruflet/lib/ruflet/cli/build/config_loader.rb: the merge moves into a new merge_declared_app.

  • When ruflet.yaml's app states a non-blank display_name or app_name, services.yaml's display_name and app_name are dropped before the merge. Every other services.yaml app key still fills gaps as before: package_name, organization, version, description, and so on.
  • When neither file states a package_name, the package (and with it the bundle identifiers, binary names and pubspec name) is derived from the name keys. In that case the loader sets the documented top-level fallback package_name to the name the old merge derived it from, so the package stays byte-identical. Only the display name changes.
  • A blank or empty display_name: states nothing, so services.yaml still fills it, as before.
  • ruflet.yaml with only name: is unchanged. name is described as the user-facing name in the README but as the package-safe name in the configuration reference, so whether it should also replace services.yaml's app_name is left to the owner.
  • contributors/app_identity.rb reads the package's name source through the same package_source_name helper, so the loader and the metadata cannot disagree about precedence. This is a refactor with no behavior change.

No app code change, no new config key, no new command or flag.

Behavior changes

This is a clear bug fix (D6). Only one combination of files changes: ruflet.yaml app states display_name (without a non-blank app_name), and services.yaml app has a different app_name. That is every ruflet new project that adds display_name: to its ruflet.yaml.

  • Before: the services.yaml app_name ships as the display name.
  • After: the ruflet.yaml display_name ships.

It is written to:

  • android:label
  • iOS CFBundleDisplayName/CFBundleName and INFOPLIST_KEY_CFBundleDisplayName
  • macOS PRODUCT_NAME (the .app bundle name; ruflet run --desktop globs *.app, so it still finds it)
  • web manifest name/short_name, <title> and apple-mobile-web-app-title
  • Windows FileDescription/ProductName

Package names, application/bundle identifiers, binary names, the mobile identity checks and everything else are unchanged in every case. These cases are byte-identical to before:

  • the same key in both files
  • ruflet.yaml using app_name
  • name:-only
  • no services.yaml app block

How verified

  • Regression tests (packages/ruflet/test/update_command_test.rb):
    • test_ruflet_yaml_display_name_wins_over_the_app_name_ruflet_new_writes uses the real write_default_ruflet_config (what ruflet new writes) plus display_name: Acme Shop. It runs sync_client_metadata and checks the label, plists, pbxproj, macOS xcconfig, web manifest and title. The package (shop), application id and version still come from services.yaml.
    • test_ruflet_yaml_name_spellings_replace_services_yaml_ones_and_blank_ones_leave_the_gap covers display_name, app_name, blank and empty display_name, and no name.
    • test_ruflet_yaml_display_name_keeps_the_package_derived_from_services_yaml: no package_name anywhere. The display name changes, the package and bundle ids stay voice_journal, and the mobile app.package_name error is still reported.
    • test_ruflet_yaml_name_alone_still_lets_services_yaml_app_name_fill: the name:-only case is unchanged.
  • Planting the bug back:
    • Restoring the old merge fails 3 of the 4 new tests. The name:-only test passes either way, by design.
    • Removing only the package preservation fails the package test ("acme_shop" instead of "voice_journal").
  • New H1 golden: build-apk-with-ruflet-yaml-display-name runs ruflet build apk on the generated default_app with ruflet.yaml stating display_name: Acme Shop.
    • It pins Acme Shop in the Android, iOS, macOS, web and Windows outputs, and change_app_package_name com.example.default_app (unchanged).
    • On the unfixed loader the same golden renders Default App everywhere.
  • Full H1 check: ruby test/compat/compat.rb --jobs 4 checked 235 goldens with 0 diffs: all 234 existing goldens are byte-identical, plus the new one at the end of the build section. test/compat_goldens_test.rb passes (243 runs).
  • Unit suites: every packages/ruflet/test/*_test.rb file, one process per file, has 0 failures and 0 errors.
  • End to end: a real ruflet new shop followed by sync_client_metadata on the vendored template (test/compat/fixtures/template/ruflet_flutter_template.tar):
    • app.display_name gives Acme Shop in every file (before: Shop).
    • app.app_name gives Acme Shop (unchanged).
    • app.name gives Shop (unchanged).
    • An untouched project gives Shop (unchanged).

The engine and the template are not touched.

`ruflet new` writes `app: app_name:` into services.yaml. The loader merged
the two app blocks key by key, so a display_name stated in ruflet.yaml sat
next to services.yaml's app_name, and build_client_metadata reads app_name
first: the generated name shipped instead of the one the project states.

When ruflet.yaml's app states a non-blank display_name or app_name,
services.yaml's display_name and app_name no longer fill in. Every other
services.yaml app key still fills gaps. When neither file states a
package_name, the package keeps being derived from the name the old merge
used, so identifiers and binary names do not move. `name:`-only projects
are unchanged.

Fixes #106
@AdamMusa
AdamMusa merged commit bc45ad6 into main Nov 20, 2026
12 checks passed
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.

ruflet.yaml's app.display_name is ignored in projects made by ruflet new: services.yaml's generated app_name ships instead

1 participant