Complete SOW-0055 ingest write-model cleanup#63
Open
ktsaou wants to merge 1 commit into
Open
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 140 |
| Duplication | 41 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Reduce ingest write-model complexity with behavior-preserving helper extraction and characterization coverage. Move SOW-0055 to completed and track residual writer file-size debt in SOW-0060.
2e24d94 to
28aac0d
Compare
There was a problem hiding this comment.
1 issue found across 13 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/ingest/sow55_characterization_resolver_test.go">
<violation number="1" location="internal/ingest/sow55_characterization_resolver_test.go:96">
P2: Rollback characterization assertion is too weak: it only rejects `root_session_id == parentID` instead of asserting the child remains self-rooted, so some regressions would pass undetected.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
Comment on lines
+96
to
+98
| if got := scanString(t, db, `SELECT IFNULL(root_session_id,'') FROM sessions WHERE id=?`, childID); got == parentID { | ||
| t.Errorf("child root_session_id = %q (= parent), want still self (linkage rolled back)", got) | ||
| } |
There was a problem hiding this comment.
P2: Rollback characterization assertion is too weak: it only rejects root_session_id == parentID instead of asserting the child remains self-rooted, so some regressions would pass undetected.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/ingest/sow55_characterization_resolver_test.go, line 96:
<comment>Rollback characterization assertion is too weak: it only rejects `root_session_id == parentID` instead of asserting the child remains self-rooted, so some regressions would pass undetected.</comment>
<file context>
@@ -0,0 +1,130 @@
+ if got := scanString(t, db, `SELECT IFNULL(parent_session_id,'') FROM sessions WHERE id=?`, childID); got != "" {
+ t.Errorf("child parent_session_id = %q, want empty (linkage must roll back on notify failure)", got)
+ }
+ if got := scanString(t, db, `SELECT IFNULL(root_session_id,'') FROM sessions WHERE id=?`, childID); got == parentID {
+ t.Errorf("child root_session_id = %q (= parent), want still self (linkage rolled back)", got)
+ }
</file context>
Suggested change
| if got := scanString(t, db, `SELECT IFNULL(root_session_id,'') FROM sessions WHERE id=?`, childID); got == parentID { | |
| t.Errorf("child root_session_id = %q (= parent), want still self (linkage rolled back)", got) | |
| } | |
| if got := scanInt(t, db, `SELECT COUNT(*) FROM sessions WHERE id=? AND root_session_id=id`, childID); got != 1 { | |
| t.Errorf("child root_session_id changed, want still self (linkage rolled back)") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
Summary by cubic
Finish SOW-0055 by reducing ingest write-model complexity across
internal/ingestwhile preserving behavior and data integrity. Add characterization tests for catalog migration, writer re-emits, rollup carry-forward, and resolver atomicity; move SOW-0055 todone/and open SOW-0060 to trackwriter.gofile-size split.internal/ingest/writer.go: extracteddispatchEventwith sub-dispatchers;applyonly tracks max seq; unknown kinds return explicit errors.internal/ingest/catalog_migrate.go: replaced inline UPDATEs with per-table helpers preserving original SQL and sign semantics.internal/ingest/resolver.go: organized link passes into named steps inside one transaction to keep link+notify atomicity.refreshRollupBucketPass; split backfill orchestration into focused helpers.internal/ingest/sow55_*_test.go; moved SOW‑0055 doc todone/; opened SOW‑0060 to split oversizedwriter.go.Written for commit 28aac0d. Summary will update on new commits.