GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(mcpx): event store skeleton — tables, writer API, calls dimension as a query (#1850 slice 1) by dezren39 · Pull Request #2449 · developing-today/code Conversation
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 33 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: d0e0b163fc
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if inserted == 1 { | ||
| for _, m := range members { | ||
| if _, err := s.db.Exec(`INSERT INTO idset_member(idset_id, key, value) VALUES (?, ?, ?)`, id, m[0], m[1]); err != nil { | ||
| return 0, err |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Commit each interned set and its members atomically
If a member insert fails or the process exits while inserting members, the fingerprint and any preceding members remain committed. Retrying InternIDs then encounters the existing fingerprint, gets zero affected rows, and skips all member inserts, permanently returning an incomplete identifier set. Subsequent events can therefore silently lose their session or parent associations even after the original failure is resolved. Insert the fingerprint and all members in one transaction so an interrupted operation can be retried safely.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 22e0f3f: InternIDs now inserts the idset row and all members in a single transaction (deferred rollback on any error), so an interrupted/failed insert persists nothing and a retry re-runs the member inserts. Regression test TestInterningIsAtomicOnMemberFailure forces a member-insert failure via a trigger, asserts zero idset/member rows remain, and verifies the retry returns the complete set.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| canon.WriteString(m[0]) | ||
| canon.WriteByte(0) | ||
| canon.WriteString(m[1]) | ||
| canon.WriteByte(0) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use an unambiguous encoding for identifier fingerprints
Identifier strings are not restricted from containing NUL characters, so NUL-separated concatenation does not uniquely encode a member list. For example, [["session", "a\u0000b"]] and [["session\u0000a", "b"]] produce identical canonical bytes and fingerprints despite containing different members. Interning the second set consequently returns the first set's ID and silently attaches the wrong identifiers to events. Use length-prefixed components or a structured encoding such as JSON before hashing.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 22e0f3f: the fingerprint now hashes a JSON encoding of the canonical (sorted) member list instead of NUL-joined concatenation, so member strings containing the separator cannot collide. Regression test TestInterningFingerprintIsUnambiguous interns exactly the colliding pair from this finding (["session","a\u0000b"] vs ["session\u0000a","b"]) and asserts distinct idsets with correct members.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| res, err := s.db.Exec(`INSERT INTO kind(name, unit, schema) VALUES (?, ?, ?)`, name, unit, schema) | ||
| if err != nil { | ||
| return 0, err |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Handle concurrent kind registration across store instances
When two Store instances sharing a database register the same new kind concurrently, both can complete the preceding lookup before either inserts, because s.mu only protects one instance. The second insert then returns a raw UNIQUE constraint error even when the definitions are identical, violating the promised idempotent registration; differing definitions likewise bypass ErrKindConflict. Sharing a database across stores is explicitly anticipated by Write's schema-loading path. Use a conflict-tolerant insert followed by reading and comparing the persisted definition so concurrent registration preserves the API's success and conflict semantics.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 22e0f3f: RegisterKind now uses INSERT ... ON CONFLICT(name) DO NOTHING, then re-reads the persisted definition and compares it — identical definitions succeed idempotently across instances, differing ones return ErrKindConflict, never a raw UNIQUE error. Open also adopts logstore's discipline (busy_timeout(5000)+WAL DSN, serialised open) so cross-instance writers wait instead of surfacing SQLITE_BUSY. Regression test TestRegisterKindConcurrentAcrossStores races two Store instances over one file database: identical registrations all succeed with one id; raced differing definitions yield exactly one success and one ErrKindConflict (also run under -race).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…oncurrent kind registration Dispositions the three Codex P2 findings on PR #2449: (1) InternIDs now inserts the idset row and its members in one transaction, so a failed insert cannot leave a fingerprint whose members a retry would skip; (2) fingerprints hash a JSON encoding of the canonical member list instead of a NUL-joined string, which distinct sets could collide on; (3) RegisterKind uses a conflict-tolerant insert and re-reads/compares the persisted definition, and Open adopts logstore's busy_timeout/WAL DSN + serialised open, so concurrent registration across Store instances sharing one database keeps its idempotent/conflict semantics instead of surfacing UNIQUE or SQLITE_BUSY errors. Regression tests cover all three.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.