You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit df6eac2
Browse filesBrowse the repository at this point in the historyBrowse files
docs(architecture): specify registration race and failure tests
Define the non-throwing publication sequence, shutdown linearization and regression matrix required before implementation of atomic configuration registration.
Copy file name to clipboardExpand all lines: docs/adr/0010-atomic-configuration-registration.md
+34-3Lines changed: 34 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,10 @@ The future registration operation will accept a complete prepared set and an
27
27
explicit registration-options object. It will:
28
28
29
29
1. validate the entire batch before publication;
30
-
2. build all new strategies and registration metadata while holding the
31
-
registry write lock (or before taking it when no live state is inspected);
32
-
3. check `m_shutdown` before preparation and again before publication;
30
+
2. build all new strategies and candidate registry/ID-map snapshots before
31
+
mutating live state;
32
+
3. check `m_shutdown` before preparation and again under the registry write
33
+
lock before publication;
33
34
4. publish one immutable strategy-list snapshot with one release-store;
34
35
5. return a stable mapping from each configuration `id` to its runtime index.
35
36
@@ -47,6 +48,21 @@ registry after the existing strategies. The returned ID/index mapping is the
47
48
only supported way for a configuration caller to address a logger; vector
48
49
order and backend type are not inferred from the ID.
49
50
51
+
All potentially throwing validation, allocation, strategy construction, and
52
+
ID-map work must finish before mutating `m_loggers`. Under its write lock, the
53
+
implementation prepares a complete candidate list and immutable snapshot,
54
+
then uses non-throwing swaps for the mutable registry and ID map before the
55
+
single release-store of the snapshot. No failure may leave the mutable registry
56
+
and published snapshot describing different batches. An empty batch is a
57
+
successful no-op with an empty returned mapping.
58
+
59
+
Shutdown and batch registration must share a linearization boundary. The
60
+
future `shutdown()` path must set `m_shutdown` and capture the registry under
61
+
the same write lock used by registration. If shutdown wins, registration
62
+
fails without publishing. If registration wins, shutdown sees and shuts down
63
+
the entire appended batch. The existing fast-path `m_shutdown` check remains
64
+
an early exit, not the sole race guard.
65
+
50
66
### Ownership boundary
51
67
52
68
The recommended implementation changes `LoggerStrategy`'s internal owners to
@@ -83,6 +99,21 @@ existing `Logger::shutdown()` and strategy lifetime rules.
83
99
- Configuration IDs require a small registry-side metadata map; they are not
84
100
retrofitted onto legacy unnamed registrations.
85
101
102
+
## Regression matrix for implementation
103
+
104
+
| Case | Required result |
105
+
| --- | --- |
106
+
| Two-entry batch succeeds | One snapshot publication; both IDs map to consecutive runtime indices after existing strategies. |
107
+
| Invalid second entry or duplicate ID | No new strategy or ID is visible; existing registry and caller output remain unchanged. |
108
+
| Repeated batch | Duplicate configured IDs fail; no implicit replacement or idempotent success. |
109
+
| Legacy `add_logger()` before and after a batch | Existing API remains valid; unnamed indices remain stable and configured ID mapping remains unambiguous. |
110
+
| Prepared set destroyed after registration | Backend and formatter remain alive through registry ownership. |
111
+
|`single_mode` option and enabled state | Targeted/general routing and default enabled state match ordinary strategy behavior. |
112
+
| Concurrent dispatch during registration | Each dispatch sees either the old or complete new snapshot, never a partial batch. |
113
+
| Registration versus shutdown | Exactly one wins the registry lock; no published backend escapes shutdown. |
114
+
| Factory/formatter failure before registration | No registration call or live mutation occurs. |
115
+
| C++11/C++17 and feature-disabled builds | Public `add_logger()` remains source-compatible; registration uses no newer language features or optional parser dependency. |
0 commit comments