Conversation
📝 WalkthroughWalkthroughExtracts identifier logic into a new Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
haya_ser/src/hex.rs (1)
44-46: 🧹 Nitpick | 🔵 TrivialNote: This
Integertrait is distinct from the one ininteger.rs.The
Integertrait here returns(Self, usize)while the one ininteger.rsreturns(Self, &[u8]). This is fine as they serve different purposes (hex vs decimal parsing), but the naming overlap could cause confusion for maintainers.Consider renaming to
HexIntegeror similar to distinguish it from the decimal parsing trait ininteger.rs.
🤖 Fix all issues with AI agents
In `@haya_ident/src/lib.rs`:
- Around line 120-163: Add Debug and Hash implementations for the Identifier and
Inner types so Identifier can be logged and used in hashed collections: update
the declarations of Identifier and Inner to derive Debug and Hash (i.e.,
#[derive(Clone, PartialEq, Eq, Debug, Hash)]) and ensure any contained types
(HayaStr and Box<str>) implement Debug and Hash or adapt the impls accordingly;
no changes to Identifier::new, path(), or namespace() logic are needed.
In `@haya_nbt/src/stringify.rs`:
- Around line 58-59: In dec_arr_peek remove the redundant tmp.clear() call at
the start of the function; dec_num already clears tmp before use, so delete the
tmp.clear() in dec_arr_peek to avoid unnecessary work and unintended clearing
when the match falls through to the error case (refer to functions dec_arr_peek
and dec_num to locate the change).
In `@haya_ser/src/lib.rs`:
- Around line 74-103: The Write impl for ByteArray currently casts self.0.len()
to u32 without validating constraints; add a defensive guard in ByteArray::write
that computes let len = self.0.len(); if len > MAX || len > u32::MAX as usize {
panic!("ByteArray length exceeds MAX or u32::MAX"); } then use V21(len as
u32).write(w) and w.write(self.0); also add the same validation at the start of
len_s() (compute len, validate against MAX and u32::MAX, then return V21(len as
u32).len_s() + len) so serialization enforces the same bounds as Read and avoids
silent truncation.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
haya_nbt/src/stringify.rs (1)
58-143:⚠️ Potential issue | 🟡 MinorAdd tests documenting byte/long array parsing behavior with unsuffixed decimals.
dec_numreturnsTagPrimitive::Intfor unsuffixed decimal literals, which means[B;1]and[L;1]will fail to parse (the pattern match indec_arr_peekexpectsTagPrimitive::ByteandTagPrimitive::Longrespectively). This is intentional per the SNBT format, but the behavior lacks test coverage. Add test cases demonstrating that unsuffixed decimals require explicit suffixes in byte and long arrays, or update the parser to coerceInttoByte/Longif backwards compatibility is needed.
🤖 Fix all issues with AI agents
In `@haya_ident/src/lib.rs`:
- Around line 26-68: The parser currently accepts empty paths (e.g.,
"minecraft:" or ""), so update parse_ident_ascii (and code paths in parse_ident
that call it) to reject empty path segments: before returning Some(...,
from_utf8_unchecked(path)) ensure path is non-empty (path.len() > 0) in the
"minecraft:" branch, in the split_once branch (the path from split_once) and in
the final branch where ident is treated as the path; keep the existing
is_valid_path checks but add the non-empty check so empty slices are treated as
invalid.
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @hayanesuru. * #37 (comment) The following files were modified: * `haya_ident/src/lib.rs` * `haya_nbt/src/byte_array.rs` * `haya_nbt/src/int_array.rs` * `haya_nbt/src/long_array.rs` * `haya_nbt/src/stringify.rs` * `haya_protocol/src/lib.rs` * `haya_ser/src/hex.rs` * `haya_ser/src/lib.rs` * `haya_str/src/lib.rs`
Summary by CodeRabbit
New Features
Refactor
Style