Repository navigation
Conversation
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/client/index.ts">
<violation number="1" location="src/client/index.ts:135">
P2: This encoding collides with valid unprefixed array namespaces: an unprefixed aggregate using `namespace: ["byAlbum", "x"]` shares the same tree as the prefixed aggregate `namespacePrefix: "byAlbum"` using `namespace: "x"`. Use a storage encoding that cannot overlap supported unprefixed namespaces, or explicitly reject this collision before enabling prefixes.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| } | ||
| return ns === undefined | ||
| ? [this.namespacePrefix] | ||
| : [this.namespacePrefix, ns]; |
There was a problem hiding this comment.
P2: This encoding collides with valid unprefixed array namespaces: an unprefixed aggregate using namespace: ["byAlbum", "x"] shares the same tree as the prefixed aggregate namespacePrefix: "byAlbum" using namespace: "x". Use a storage encoding that cannot overlap supported unprefixed namespaces, or explicitly reject this collision before enabling prefixes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/client/index.ts, line 135:
<comment>This encoding collides with valid unprefixed array namespaces: an unprefixed aggregate using `namespace: ["byAlbum", "x"]` shares the same tree as the prefixed aggregate `namespacePrefix: "byAlbum"` using `namespace: "x"`. Use a storage encoding that cannot overlap supported unprefixed namespaces, or explicitly reject this collision before enabling prefixes.</comment>
<file context>
@@ -110,13 +110,55 @@ export class Aggregate<
+ }
+ return ns === undefined
+ ? [this.namespacePrefix]
+ : [this.namespacePrefix, ns];
+ }
+
</file context>
|
@ianmacartney thoughts on this approach? this makes it so you can set the "name" of the aggregate when defining the client for the aggregate, and you don't need to pass it in to each aggregate call. |
ianmacartney
left a comment
There was a problem hiding this comment.
I like it! Assuming this can be used all the places users currently use separate aggregates, I think this is a good direction. I'd be interested in what a migration path looks like (could just be a readme explaining how to set up the dual-write setup / backfill process)
afbb318 to
d9c648e
Compare
Adds a
namespacePrefixoption toTableAggregateandDirectAggregateso multiple aggregates can share one component instance, instead of needing anapp.useper aggregate. The client stores namespacensas[prefix, ns]in the existingbtreetable, andpaginateNamespacesrange-scans the existingby_namespaceindex for a prefix, so upgrading needs no schema change or index backfill.Stack
🤖 Generated with Claude Code