Separate finalization from runtime concerns and introduce FinalizedAppConfig.#2756
Merged
freakboy3742 merged 1 commit intobeeware:mainfrom Mar 24, 2026
Merged
Conversation
1bce12f to
a21ec6e
Compare
This was referenced Mar 19, 2026
a21ec6e to
f9defcf
Compare
finalize_app_config() now returns a FinalizedAppConfig constructed from the original AppConfig. Runtime attributes (test_mode, debugger, debugger_host, debugger_port) are constructor parameters, guaranteed to exist at construction time. Platform overrides forward **kwargs to super() which constructs the object. AppConfig gains __eq__ and __hash__ based on app_name so that caches keyed by app objects (like _briefcase_toml and app_tools) work correctly across the identity change from AppConfig to FinalizedAppConfig. Replaces the __draft__ attribute with an isinstance check. Refs beeware#2739.
f9defcf to
529b9de
Compare
Comment on lines
788
to
+789
| finalized[app.app_name] = app | ||
| self.apps.update(finalized) |
Member
There was a problem hiding this comment.
Do we actually need finalized at all here? Can we cache finalized apps directly into self.apps?
Member
There was a problem hiding this comment.
Answered on the upstream discussion - this is needed to avoid modification during iteration. This likely isn't a big problem as we're not adding new keys, but better to be safe.
freakboy3742
approved these changes
Mar 24, 2026
Member
freakboy3742
left a comment
There was a problem hiding this comment.
👍 This all makes sense; thanks!
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.
finalize()previously mixed two concerns: platform configuration (finalize_app_config) and runtime mode setup (test_mode,debugger). This change moves runtime attributes to callers, sofinalize()only handles host/tool verification and app config finalization.With that separation in place, the
__draft__magic attribute is replaced by a real class:FinalizedAppConfig. Unfinalized apps areAppConfig, finalized ones becomeFinalizedAppConfig. This would give the type checker a concrete type to track finalization state, replacinghasattr/delattrwithisinstance.Groundwork for typing app finalization (Refs #2739).
PR Checklist: