Skip to content

Conversation

@flyingrobots
Copy link
Owner

Closes #156

  • diff_store: avoid double lookups and expand rustdoc (intent, invariants, semantics, edge cases, perf).
  • TickPatchError: switch to thiserror derive.
  • encode_ops: clarify digest tag bytes vs replay ordering.
  • WarpTickPatchV1::new: dedupe duplicate ops by canonical sort key (last-wins) to prevent replay errors.
  • Alias crate::ident::Hash to ContentHash to avoid confusion with derive(Hash) on SlotId.

Validation:

  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings -D missing_docs

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Warning

Rate limit exceeded

@flyingrobots has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 615b9e9 and e1f5b40.

📒 Files selected for processing (3)
  • crates/warp-core/src/tick_patch.rs
  • docs/decision-log.md
  • docs/execution-plan.md

Walkthrough

This PR performs hygiene improvements to tick_patch.rs by replacing the public Hash type with a ContentHash alias throughout public APIs, introducing thiserror-derived error handling for TickPatchError, deduplicating operations during patch construction, and expanding rustdoc to document invariants and semantics. No core replay logic altered—purely surface-level safety and clarity hardening.

Changes

Cohort / File(s) Summary
Core tick_patch refactoring
crates/warp-core/src/tick_patch.rs
Type alias HashContentHash across public structures (WarpOpKey fields a/b, WarpTickPatchV1 fields rule_pack_id/digest). Public accessor signatures updated to return ContentHash. TickPatchError converted to thiserror derive with annotated error variants. compute_patch_digest_v1 signature and edges_by_id return types updated to use ContentHash. WarpTickPatchV1::new now deduplicates ops via sort-key–based last-wins rule. Expanded rustdoc for diff_store and encode_ops.
Documentation updates
docs/decision-log.md, docs/execution-plan.md
Decision log documents aliasing strategy and hygiene rationale. Execution plan adds "Today's Intent" block itemizing dedup, thiserror, encode_ops documentation, and hash aliasing tasks with exit criteria.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Reasoning: Type signature changes across multiple public entities demand careful verification of consistency across all call sites and trait implementations; deduplication logic in WarpTickPatchV1::new requires scrutiny to ensure sort-key semantics match intent; thiserror integration needs validation for error propagation correctness. Mixed complexity—straightforward aliasing paired with behavioral changes (dedup) and error restructuring—spread across single cohesive file. Documentation changes are supplementary. No dramatic control-flow upheaval, but no trivial refactor either.

Possibly related issues

Possibly related PRs

Poem

🔐 Hash becomes ContentHash, crystal clear,
ops deduplicated, errors appear—thiserror's here!
Double lookups vanquished, rustdoc glows bright,
Tick patch hygiene: squeaky-clean, pedant's delight! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly and concisely identifies the primary change: tick_patch hygiene improvements in warp-core.
Description check ✅ Passed Description comprehensively details all changes including diff_store optimization, thiserror conversion, encode_ops documentation, deduplication logic, and ContentHash aliasing.
Linked Issues check ✅ Passed All five requirements from issue #156 are addressed: double lookup elimination, thiserror adoption, encode_ops documentation, deduplication implementation, and ContentHash aliasing.
Out of Scope Changes check ✅ Passed All changes directly support the stated objectives of tick_patch hygiene; no extraneous modifications detected outside the scope of issue #156.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae61111 and 615b9e9.

📒 Files selected for processing (3)
  • crates/warp-core/src/tick_patch.rs
  • docs/decision-log.md
  • docs/execution-plan.md
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Every public API across crates (warp-core, warp-ffi, warp-wasm, etc.) must carry rustdoc comments that explain intent, invariants, and usage. Treat missing docs as a failing test.
Run cargo clippy --all-targets -- -D missing_docs before every PR; CI will expect a zero-warning, fully documented surface.
Every source file must start with exactly: // SPDX-License-Identifier: Apache-2.0 and // © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots>

Files:

  • crates/warp-core/src/tick_patch.rs
🧠 Learnings (2)
📚 Learning: 2025-12-28T23:14:28.083Z
Learnt from: CR
Repo: flyingrobots/echo PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T23:14:28.083Z
Learning: Start each session by updating *Today's Intent* in `docs/execution-plan.md` and capture milestones, blockers, and decisions in the Decision Log.

Applied to files:

  • docs/execution-plan.md
📚 Learning: 2025-12-28T23:14:28.083Z
Learnt from: CR
Repo: flyingrobots/echo PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T23:14:28.083Z
Learning: When a PR touches non-doc code, update `docs/execution-plan.md` and `docs/decision-log.md` in the same PR.

Applied to files:

  • docs/execution-plan.md
🪛 LanguageTool
docs/execution-plan.md

[style] ~40-~40: To elevate your writing, try using a synonym here.
Context: ...ays deterministic, well-documented, and hard to misuse. - Scope: - diff_store: a...

(HARD_TO)

docs/decision-log.md

[style] ~13-~13: To elevate your writing, try using a synonym here.
Context: ...ode should be clear, deterministic, and hard to misuse. Removing boilerplate and amb...

(HARD_TO)

🔇 Additional comments (13)
docs/execution-plan.md (1)

38-48: Decision-log.md has been properly updated; no action required.

The 2025-12-29 entry in docs/decision-log.md documents the tick_patch hygiene work with full context, rationale, and consequences. Both docs/execution-plan.md and docs/decision-log.md have been updated as required by the project learnings.

Likely an incorrect or invalid review comment.

crates/warp-core/src/tick_patch.rs (12)

16-16: LGTM: thiserror and ContentHash alias introduced.

The addition of thiserror for ergonomic error handling and the ContentHash alias to disambiguate from derive(Hash) on SlotId are both solid hygiene improvements that align with the stated objectives.

Also applies to: 20-20


116-117: LGTM: WarpOpKey fields updated to ContentHash.

Consistent application of the ContentHash alias to internal ordering key fields.


162-162: LGTM: Struct fields consistently use ContentHash.

Private fields correctly updated to use the new alias; public accessors will propagate this type change.

Also applies to: 167-167


181-181: LGTM: Parameter type updated to ContentHash.

Public API signature correctly reflects the ContentHash alias.


230-230: LGTM: Return type updated to ContentHash.

Public getter correctly returns the aliased type.


260-260: LGTM: Return type updated to ContentHash.

Public getter correctly returns the aliased type.


295-295: LGTM: TickPatchError correctly uses thiserror.

The thiserror derive eliminates boilerplate while providing clear error messages. Debug formatting for node/edge IDs is appropriate.

Also applies to: 298-298, 301-301


307-307: LGTM: Function signature updated to ContentHash.

Private helper function consistently uses the alias.

Also applies to: 312-312


346-351: LGTM: Excellent clarification on tag bytes vs. replay ordering.

The documentation clearly disambiguates digest encoding tags from WarpOp::sort_key ordering, preventing future confusion. Well-written maintainer guidance.


399-456: LGTM: Exceptional documentation expansion.

This rustdoc is a masterclass in API documentation:

  • Intent: Clearly explains the "diff" constructor role
  • Invariants: Explicitly documents required GraphStore guarantees
  • Semantics: Precise definitions for each op variant
  • Edge cases: Handles identical stores, migration scenarios
  • Performance: Honest about O(nodes + edges) + O(edges log edges) complexity and allocation costs
  • Rationale: Explains why diff vs. direct recording

Fully satisfies the PR objective to "expand rustdoc covering intent, invariants, semantics, edge cases, and performance."


462-465: LGTM: Idiomatic let-else pattern eliminates redundant lookup.

The refactoring from match after.nodes.get(id) to let-else is more idiomatic (Rust 1.65+) and achieves the stated objective of removing double lookups—previously this likely used contains_key + get, now it's a single get with immediate destructuring.


520-520: LGTM: Return type updated to ContentHash.

Private helper function consistently uses the alias for the BTreeMap key type.

@flyingrobots flyingrobots merged commit c18d9ca into main Dec 29, 2025
12 of 13 checks passed
@flyingrobots flyingrobots deleted the echo/warp-core-tick-patch-nits branch December 29, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

warp-core: tick_patch hygiene (dedup ops, thiserror, docs)

2 participants