Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: gopherium/gophenberg/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughGroup and field mutations now pass recheck callbacks to stores. Stores re-evaluate group, field, and backlink relationships after acquiring locks and before applying changes. New tests cover concurrent backlink operations and mutations whose referenced groups, fields, or readers change meanwhile. ChangesContent registry and recheck contract
PostgreSQL mutation checks
Memory store and feature coverage
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to Concurrent requests in the feature-test server could lose a newly written field value. The risk is confined to that test implementation and does not block merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
| return judgedTogether(ctx, | ||
| func() error { return theAdministratorAsksToDeleteTheField(ctx, key, typeKey) }, | ||
| func() error { return theBacklinksFieldReading(ctx, reader, readerType, source, sourceType) }, | ||
| ) |
There was a problem hiding this comment.
Race scenarios run sequentially
These scenarios say requests arrive at the same moment, but the first request finishes before the second begins. They test a stale registry view, not overlapping requests, so they cannot catch failures that require lock contention. Relabel them or add a concurrent case. This coverage gap does not block merging.
Artifacts
- The executed Go test instruments the test server’s HTTP transport and checks request order and the registry view.
Plain sequential control output
- The control run shows DELETE finishing before POST begins, with the deleted field absent from the subsequent listing.
- The PR-path run shows the same non-overlapping request order, but the frozen listing still contains the deleted field.
Backlinks feature-suite output
- The targeted feature-suite run passed all 24 scenarios, including the three described as occurring at the same moment.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/features/steps_backlinks_test.go
Line: 113-116
Comment:
**Race scenarios run sequentially**
These scenarios say requests arrive at the same moment, but the first request finishes before the second begins. They test a stale registry view, not overlapping requests, so they cannot catch failures that require lock contention. Relabel them or add a concurrent case. This coverage gap does not block merging.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| return content.Field{}, fmt.Errorf("postgres: update content field: %w", err) | ||
| } | ||
| return toField(row), nil | ||
| if err := rechecked(ctx, queries, recheck); err != nil { |
There was a problem hiding this comment.
Label edits load every definition
A plain text-field label edit now reads every group, field, and type under the field-groups lock before updating one row. This adds work as definitions grow and lets an unrelated group write delay the edit. Narrow the locked recheck when the edit cannot affect a Linked from source. This performance concern does not block merging.
Artifacts
Authored PostgreSQL label-edit test
- The test runs both label-edit paths against a migrated database and records their SQL and lock behavior, making the comparison reproducible.
Direct label edit before the change
- The baseline command edited a text-field label with one SQL statement and succeeded while another session held the group lock, showing the previous path did not wait on it.
Label edit through the changed store method
- The changed-method command traced seven statements and a lock timeout during the same competing-lock scenario, confirming the added reads and contention.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/postgres/groups.go
Line: 614
Comment:
**Label edits load every definition**
A plain text-field label edit now reads every group, field, and type under the field-groups lock before updating one row. This adds work as definitions grow and lets an unrelated group write delay the edit. Narrow the locked recheck when the edit cannot affect a Linked from source. This performance concern does not block merging.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Closes #249
What
Why
The registry checked a Linked from field and the relation it reads before the store took its lock. Two admins saving at the same moment could both pass that check. One could delete a relation while the other declared a Linked from reading it, and the site kept a Linked from that reads nothing.
Testing Instructions
make cover GOTESTFLAGS=-race. Every package stays at 100%.go test ./test/features/ -run TestBacklinks. Three new scenarios send a delete and a Linked from change at the same moment, and the second request is refused each time.go test ./internal/postgres/ -run 'TestALinkedFrom|TestARelationDeletedAsALinkedFrom|TestTheGroupWritesStoreNothingTheirCheckRefuses'. The race tests queue two real writes on the lock, and the second one is refused with nothing stored.Summary by CodeRabbit