Repository navigation
refactor: omit the project name in WriteConfig's copy, not in app.Name (#9029) [skip ci] - #9029
Conversation
|
Download this PR's build for your OS and architecture with: ddev utility download-ddev --pr 9029Or download the artifact for your OS and architecture directly:
See Testing a PR. |
With omit_project_name_by_default, both `ddev config` paths cleared app.Name, called WriteConfig, then restored it. While it was empty, WriteConfig registered the project under "". WriteConfigOmittingName clears the name only on the copy it marshals, as WriteConfig already does for defaults, so app.Name stays real throughout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
863d218 to
2250561
Compare
stasadev
left a comment
There was a problem hiding this comment.
Works, approving. Two small things, neither blocks merge.
Claude Code compared the PR build with main at e907890, with omit_project_name_by_default: true. It ran ddev config interactively, with flags, with --auto, with --project-name, with an interactive custom name, and with a name in config.local.yaml. Both builds wrote the same name and registered the same projects in project_list.yaml, and no "" entry appeared.
- One behavior change isn't in the description.
writeConfignow passes the real name toPopulateExamplesCommandsHomeadditions(), which returned early for"". So with the omit setting,ddev confignow fills.ddev/commands, examples and homeadditions right away, the same as without it. Before, they appeared only onddev start. That's an improvement, maybe add a line about it. - The two call sites choose the writer in different ways:
if omitName { ... } else { ... }inrunConfigandwriteConfig := app.WriteConfiginhandleMainConfigArgs. Maybe use the same pattern in both?
The flag path still drops a custom name whenever --project-name isn't given, which this PR keeps on purpose. On v1.25.5 that already breaks ddev restart and leaves the project on an empty database, see #9047.
🤖 Reviewed with assistance from Claude Code
Short Summary (TL;DR)
With
omit_project_name_by_default,ddev configno longer blanksapp.Nameto keep the name out of config.yaml.WriteConfigleaves it out of its own copy instead, so the project is always registered under its real name.The Issue
Both
ddev configpaths setapp.Name = "", calledWriteConfig, then restored the name. While the name was empty,WriteConfigregistered the project under"", which caused #9017. #9020 refuses the empty name and registers the real one afterward. This PR removes the empty name at its source.How This PR Solves The Issue
DdevApp.WriteConfigOmittingNameclearsnameonly on the copy thatWriteConfigmarshals. This is the same wayWriteConfigalready drops defaults likeproject_tldand a name set byconfig.*.yaml.ddev configpaths call it instead of clearing and restoringapp.Name. Each path keeps its current rule for when to omit the name.UpdateGlobalProjectListno longer skips an empty name, so an empty name now fails with the error from fix: lock and reread project_list.yaml on every change, never register an empty project name, fixes #9004, fixes #9017 #9020.omit_project_name_by_default,ddev confignow populates.ddev/commands, examples and homeadditions right away, as it does without the setting. Before,PopulateExamplesCommandsHomeadditionsgot the blanked name and returned early, so they appeared only onddev start. The Composer v1 warning also names the project instead of printing''.Manual Testing Instructions
Automated Testing Overview
TestOmitProjectNameByDefaultnow also checks that each case registers the project under its runtime name with the right approot, and never under"".🤖 Developed with assistance from Claude Code