Commit e9aa73c
fix: PR #4039 review item E4 — tighten Identifiers.AssertSafe to reject leading underscore
Identifiers.AssertSafe accepted `^[A-Za-z_][A-Za-z0-9_]*$`, allowing
identifiers that start with `_`. Spanner rejects `_`-prefixed names as
reserved (which is why SpannerBoxMigrationRunner's internal history
table is `BrighterMigrationHistory`, not `_BrighterMigrationHistory`).
A user-configured `OutBoxTableName = "_my_outbox"` would therefore pass
the framework chokepoint and fail at Spanner's DDL with a less
actionable "reserved identifier" error.
Tighten the regex to `^[A-Za-z][A-Za-z0-9_]*$` so the strictest
supported backend's rule applies to the framework-level identifier
validation. Underscores remain legal in non-leading positions; only
the leading character is now restricted to `[A-Za-z]`. No internal
caller passes a `_`-prefixed name through AssertSafe — verified via
grep of all AssertSafe call sites and all *MigrationCatalog
constants — so this is a tightening, not a breaking change for
downstream consumers using the standard configuration shape.
TDD: flipped the existing `_underscore_leading` test case from the
"safe inputs" Theory to the "unsafe inputs" Theory. RED before regex
tightening (AssertSafe accepted `_underscore_leading`, no exception
thrown), GREEN after. All 11 AssertSafe tests and 65 BoxProvisioning
core tests pass on net9.0 and net10.0; 6 SQLite unsafe-name rejection
tests pass on net9.0 (no regression in per-backend chokepoints).
Updated the Identifiers <remarks> xmldoc and the exception-message
regex hint so contributors and operators see the tightened rule.
Review comment: #4039 (comment)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f2f9299 commit e9aa73c
2 files changed
Lines changed: 16 additions & 13 deletions
File tree
- src/Paramore.Brighter.BoxProvisioning
- tests/Paramore.Brighter.BoxProvisioning.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
0 commit comments