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 7bb69d3
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(counter): keep domain as the sequence name
## Summary
### Why?
Queue-prefixed resource IDs contain URL separators and duplicate scope already carried by the queue, route, and typed field. Resource IDs should remain flexible string contracts rather than forcing Go, protobuf, or SQL resource fields to integer types.
### What?
- Store canonical positive decimal strings such as "42" for SubmitQueue request IDs, SubmitQueue batch IDs, and Stovepipe request IDs while keeping resource and reference fields as strings and VARCHAR columns.
- Keep the existing counter schema and (queue, domain) key unchanged; domain names the sequence (request or batch), not an application. SubmitQueue and Stovepipe have separate storage backends, so no ownerDomain dimension is introduced. Stovepipe uses the durable MySQL counter.
- Put the shared formatting, validation, and numeric comparison helpers in platform/base/id. Keep domain naming consistent across the counter contract, implementation, callers, mocks, tests, and docs.
- Validate direct resource-ID inputs and retain the queue-scoped test fixes and cross-queue ID regression coverage from the prior review pass. Provider IDs, URIs, hashes, and derived event IDs keep their contracts.
## Test Plan
- ✅ make build
- ✅ make test (127 targets passed)
- ✅ make check-gazelle, make check-mocks, make check-tidy, and make lint
- ✅ git diff --check
- ✅ git diff --quiet 343875c -- ':(glob)**/schema/*.sql' (no schema differences from the RFC branch)
- ✅ Fresh MySQL counter integration run with test-result caching disabled.
- ✅ The preceding comment pass also ran SubmitQueue gateway integration, Stovepipe integration, and Stovepipe e2e successfully (4/4 targets including the counter suite).
- ⚠️ The prior full Docker run passed all 9 integration targets and Runway/Stovepipe e2e; SubmitQueue real-Git e2e remains blocked by the mounted sandbox repository's dubious-ownership check. That unrelated Git configuration was not changed or rerun for this naming-only update.
- ⚠️ aifx verify could not complete its monorepo coverage, generic Go lint, and UReview API checks; repository-native checks above passed.
Copy file name to clipboardExpand all lines: doc/rfc/scoped-resource-ids.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,23 @@ Proposed.
6
6
7
7
## Decision
8
8
9
-
A generated resource ID is the canonical decimal string for a positive value returned by a durable counter scoped to `(queue, resource type)` within an application's storage.
9
+
A generated resource ID is the canonical decimal string for a positive value returned by a durable counter scoped to `(queue, domain)` within an application's storage.
10
10
11
-
SubmitQueue and Stovepipe use separate storage backends. Resource type is `request` or `batch`; there is no additional application-domain key or schema change.
11
+
The counter domain names the sequence (`request` or `batch`), not the application. SubmitQueue and Stovepipe use separate storage backends; there is no additional application-domain key or schema change.
12
12
13
13
| Resource | Current ID | Proposed ID | Identity within the application |
The decimal ID is unique only within its scope. The same value may appear in another queue, resource type, or application. APIs and messages therefore carry the queue separately; their typed field or message type supplies the resource type.
19
+
The decimal ID is unique only within its scope. The same value may appear in another queue, counter domain, or application. APIs and messages therefore carry the queue separately; their typed field or message type supplies the counter domain.
20
20
21
21
Do not embed scope into the ID. Forms such as `demo-queue/42`, `demo-queue/batch/7`, `request.42`, and ARN-like resource names are not stored or accepted as IDs.
22
22
23
23
## Counter
24
24
25
-
The counter backend persists one high-water mark per `(queue, resource type)`. MySQL keeps its existing `(queue, domain)` primary key; `domain` stores the resource type. For example:
25
+
The counter backend persists one high-water mark per `(queue, domain)`. MySQL keeps its existing schema and primary key. For example:
26
26
27
27
```text
28
28
(demo-queue, request) -> 42
@@ -61,13 +61,13 @@ The decimal ID is used directly as one path segment:
61
61
/batches/7
62
62
```
63
63
64
-
The route supplies the resource type; the request context supplies the queue. Queue URL design is separate.
64
+
The route supplies the counter domain; the request context supplies the queue. Queue URL design is separate.
65
65
66
66
A UI may display `request.42`, `batch.7`, or `#42`, but those are derived labels, not identities.
67
67
68
68
## Rejected alternatives
69
69
70
-
-**Queue or resource-type prefixes:** duplicate explicit context, lengthen keys, require parsing, and introduce URL separators.
70
+
-**Queue or domain prefixes:** duplicate explicit context, lengthen keys, require parsing, and introduce URL separators.
71
71
-**ARN-like names:** solve global lookup, which current APIs neither provide nor require.
72
72
-**UUIDs or a global counter:** provide global uniqueness at the cost of unnecessary encoding or coordination.
73
73
-**Integer resource fields:** couple the persisted and wire contracts to the current counter representation without adding identity semantics.
Copy file name to clipboardExpand all lines: platform/extension/counter/README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Counter
2
2
3
-
Vendor-agnostic interface for atomic sequential number generation, scoped by queue and resource type.
3
+
Vendor-agnostic interface for atomic sequential number generation, scoped by queue and domain.
4
4
5
-
SubmitQueue and Stovepipe use separate storage backends. The existing MySQL `domain` column names the resource type (`request` or `batch`); the schema and `(queue, domain)` key remain unchanged.
5
+
The domainnames a counter sequence (`request` or `batch`), not an application. SubmitQueue and Stovepipe use separate storage backends; the existing MySQL schema and `(queue, domain)` key remain unchanged.
6
6
7
7
## Interface
8
8
@@ -12,12 +12,12 @@ Resolves the Counter bound to one queue. The host wiring decides which backend s
12
12
13
13
### Counter
14
14
15
-
Generates unique, sequential values scoped to a resource type within the bound queue.
15
+
Generates unique, sequential values scoped to a domain within the bound queue.
16
16
17
-
-**resource type**: A string key naming a sequence within the queue (max 255 characters). Each `(queue, resource type)` pair maintains its own independent sequence.
18
-
-**Next**: Atomically increments and returns the next value. The first call for a new resource type returns 1. Safe for concurrent use; values are unique but ordering is not guaranteed.
17
+
-**domain**: A string key naming a sequence within the queue (max 255 characters). Each `(queue, domain)` pair maintains its own independent sequence.
18
+
-**Next**: Atomically increments and returns the next value. The first call for a new domain returns 1. Safe for concurrent use; values are unique but ordering is not guaranteed.
19
19
20
-
The resource type is a sequence name, not an ID prefix. Callers pass `"request"` or `"batch"`; the returned number is formatted as a decimal string without embedding any scope.
20
+
The domain is not an ID prefix. Callers pass `"request"` or `"batch"`; the returned number is formatted as a decimal string without embedding any scope.
0 commit comments