fix(sync service): fallback to golden snapshot if no init happens#4200
fix(sync service): fallback to golden snapshot if no init happens#4200404Wolf wants to merge 3 commits into
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe sync-service durable object gains automatic "golden snapshot" seeding: a new 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rust/sync-service/src/durable_object.rs`:
- Around line 725-738: The doc comment "Gets DocumentState, loading it if
needed" is incorrectly placed above the record_first_uninitialized_connection
function when it should document the document_state function. Move this doc
comment from above record_first_uninitialized_connection to its correct position
above the document_state function. Additionally, add appropriate doc comments
for the new functions record_first_uninitialized_connection and
auto_initialize_golden that accurately describe their functionality instead of
leaving them without documentation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 27085cfd-1421-419a-a1ca-4a393029e7b7
📒 Files selected for processing (2)
rust/cloud-storage/documents/src/outbound/markdown_init.rsrust/sync-service/src/durable_object.rs
| /// Gets DocumentState, loading it if needed | ||
| fn record_first_uninitialized_connection(&self) { | ||
| let mut first_uninitialized_connection_at = self | ||
| .first_uninitialized_connection_at | ||
| .lock("record_first_uninitialized_connection"); | ||
| if first_uninitialized_connection_at.is_none() { | ||
| *first_uninitialized_connection_at = Some(web_time::Instant::now()); | ||
| } | ||
| } | ||
|
|
||
| async fn auto_initialize_golden(&self, document_id: &str) -> Result<()> { | ||
| info!(document_id, "auto-init: seeding golden snapshot"); | ||
| self.initialize_from_bytes(document_id, GOLDEN_SNAPSHOT).await | ||
| } |
There was a problem hiding this comment.
Misplaced doc comment.
The doc comment /// Gets DocumentState, loading it if needed on line 725 now incorrectly documents record_first_uninitialized_connection instead of document_state (line 740). This appears to be an artifact of inserting the new functions above document_state without moving the existing doc comment.
📝 Suggested fix
Move the doc comment to its correct position and optionally add comments for the new functions:
Ok(ss)
}
- /// Gets DocumentState, loading it if needed
fn record_first_uninitialized_connection(&self) {
let mut first_uninitialized_connection_at = self
.first_uninitialized_connection_at
.lock("record_first_uninitialized_connection");
if first_uninitialized_connection_at.is_none() {
*first_uninitialized_connection_at = Some(web_time::Instant::now());
}
}
async fn auto_initialize_golden(&self, document_id: &str) -> Result<()> {
info!(document_id, "auto-init: seeding golden snapshot");
self.initialize_from_bytes(document_id, GOLDEN_SNAPSHOT).await
}
+ /// Gets DocumentState, loading it if needed
async fn document_state(&self) -> Result<Arc<DocumentState>> {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rust/sync-service/src/durable_object.rs` around lines 725 - 738, The doc
comment "Gets DocumentState, loading it if needed" is incorrectly placed above
the record_first_uninitialized_connection function when it should document the
document_state function. Move this doc comment from above
record_first_uninitialized_connection to its correct position above the
document_state function. Additionally, add appropriate doc comments for the new
functions record_first_uninitialized_connection and auto_initialize_golden that
accurately describe their functionality instead of leaving them without
documentation.
No description provided.