Repository: beeware/briefcase

Issue:
overly aggressive restriction on bundle identifiers restricts my idiom
### Describe the bug

All my apps have bundle IDs of the form `im.glyph.and.this.is.<app name>` but that doesn't work with `briefcase new`, due to this error:

```
Bundle Identifier [com.example]: im.glyph.and.this.is.examplecase

Invalid value; 'im.glyph.and.this.is.examplecase' is not a valid bundle identifier.

The bundle should be a reversed domain name. It must contain at least 2
dot-separated sections; each section may only include letters, numbers,
and hyphens; and each section may not contain any reserved words (like
'switch', or 'while').
```


### Steps to reproduce

Just run `briefcase new` and use the aforementioned bundle id.

### Expected behavior

It accepts the input.

### Screenshots

_No response_

### Environment

- Operating System: ```
ProductName:		macOS
ProductVersion:		13.3.1
BuildVersion:		22E261
```
- Python version: Python 3.11.3
- Software versions:
  - Briefcase: 0.3.14


### Logs

```

```


### Additional context

_No response_


Discussion:
This seems like over-enthusiastic validation catching the `and`, `is`, and `this` keywords. 

We need to confirm the exact validation scheme that is being used on bundle IDs. We added keywords to the list because of complications with Java namespaces on Android (specifically the `switch` keyword, IIRC). 
It seems `io` falls into this as well. where `https://${project}.github.io/` are often used for project github pages, which makes `io.github.${project}` a natural candidate for bundle identifier. It seems to be prohibited because `io` is a python package, but I’m not sure under what circumstances python packages and bundle identifiers could be confused?
@Cimbali Thanks for the heads up on that one - definitely looks like we should relax the validation for the parts the bundle identifier. We're currently doing the same validation on each individual part of the bundle identifier, mostly out of simplicity than out of any specific concern. Clearly we are able to relax the name checks on all but the last token (which is the app name, and is therefore critical that it doesn't collide).


bundle application identifiers restrict ca (Canada) too.
![ca_domain_valiation_bug_2024-05-20 06-34-15](https://github.com/beeware/briefcase/assets/21248222/03eb872a-2cce-4167-9267-50aa86d99adb)



Patch:
diff --git a/changes/1212.bugfix.rst b/changes/1212.bugfix.rst
new file mode 100644
index 000000000..b0ac69af3
--- /dev/null
+++ b/changes/1212.bugfix.rst
@@ -0,0 +1,1 @@
+Validation rules for bundle identifiers have been loosened. App IDs that contain country codes or language reserved words are no longer flagged as invalid.
diff --git a/src/briefcase/config.py b/src/briefcase/config.py
index 34d50800a..39ef2edb4 100644
--- a/src/briefcase/config.py
+++ b/src/briefcase/config.py
@@ -87,15 +87,6 @@ def is_valid_bundle_identifier(bundle):
     if not VALID_BUNDLE_RE.match(bundle):
         return False
 
-    for part in bundle.split("."):
-        # *Some* 2-letter country codes are valid identifiers,
-        # even though they're reserved words; see:
-        #    https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
-        # `.do` *should* be on this list, but as of Apr 2022, `.do` breaks
-        # the Android build tooling.
-        if is_reserved_keyword(part) and part not in {"in", "is"}:
-            return False
-
     return True
 
 


Test patch:
diff --git a/tests/commands/new/test_validate_bundle.py b/tests/commands/new/test_validate_bundle.py
index 0952d34df..5643acf1b 100644
--- a/tests/commands/new/test_validate_bundle.py
+++ b/tests/commands/new/test_validate_bundle.py
@@ -8,6 +8,10 @@
         "com.example.more",
         "com.example42.more",
         "com.example-42.more",
+        "ca.example.issue1212",
+        "au.example.issue1212",
+        "in.example.issue1212",
+        "im.glyph.and.this.is.1212",
     ],
 )
 def test_valid_bundle(new_command, bundle):
@@ -23,7 +27,6 @@ def test_valid_bundle(new_command, bundle):
         "com.hello_world",  # underscore
         "com.hello,world",  # comma
         "com.hello world!",  # exclamation point
-        "com.pass.example",  # Reserved word
     ],
 )
 def test_invalid_bundle(new_command, bundle):
diff --git a/tests/config/test_AppConfig.py b/tests/config/test_AppConfig.py
index bddd122c7..1595857e6 100644
--- a/tests/config/test_AppConfig.py
+++ b/tests/config/test_AppConfig.py
@@ -170,10 +170,6 @@ def test_valid_bundle(bundle):
         "com.hello_world",  # underscore
         "com.hello,world",  # comma
         "com.hello world!",  # exclamation point
-        "com.pass",  # Python reserved word
-        "com.pass.example",  # Python reserved word
-        "com.switch",  # Java reserved word
-        "com.switch.example",  # Java reserved word
     ],
 )
 def test_invalid_bundle_identifier(bundle):
diff --git a/tests/config/test_is_valid_bundle_identifier.py b/tests/config/test_is_valid_bundle_identifier.py
index bdf832628..d83822670 100644
--- a/tests/config/test_is_valid_bundle_identifier.py
+++ b/tests/config/test_is_valid_bundle_identifier.py
@@ -28,12 +28,6 @@ def test_valid_bundle(bundle):
         "com.hello_world",  # underscore
         "com.hello,world",  # comma
         "com.hello world!",  # exclamation point
-        "com.pass",  # Python reserved word
-        "com.pass.example",  # Python reserved word
-        "com.switch",  # Java reserved word
-        "com.switch.example",  # Java reserved word
-        "int.example",  # Valid identifier with a reserved word as the TLD
-        "do.example",  # This *should* be valid by the Java spec, but Android chokes.
     ],
 )
 def test_invalid_bundle(bundle):