v0.16.0 - #100
Merged
Merged
v0.16.0#100
Conversation
This reverts commit 0601731.
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces substantial new indexing and navigation logic across both JSON and YAML document models, which warrants final human validation despite no obvious functional defects found.
Pull request overview
This PR adds jq-style path generation and path-based navigation to the structured JSON/YAML document widgets, enabling consumers to resolve paths to rows, move selection to a path, and read back the currently-selected path efficiently (including for JSON Lines and multi-document YAML).
Changes:
- Introduces a shared path-formatting utility (
append_string_key,append_bracket) and updates JSON/YAML path iteration to use it (including escaping/quoting behavior changes like["null"]and root arrays using[0]). - Adds per-row path indexing (
PathIndex) and YAML mapping-key kind tracking (PathKeyKind) to supportselected_path(),row_index_for_path(), andmove_to_path(). - Extends benchmarks and tests to cover path formatting and path navigation semantics.
File summaries
| File | Description |
|---|---|
| promkit-widgets/tests/jsonz/get_all_paths.rs | Updates expected JSON path output for reserved string keys (["null"]). |
| promkit-widgets/src/structured/yaml/yamlz.rs | Adds key-kind tracking and shared path formatting to YAML row/path iteration. |
| promkit-widgets/src/structured/yaml/document.rs | Implements YAML selected_path, row_index_for_path, and move_to_path backed by path indices and key-kind data. |
| promkit-widgets/src/structured/yaml/deserializer.rs | Propagates YAML mapping-key kinds through deserialization and returns indexed rows. |
| promkit-widgets/src/structured/path.rs | New shared jq-style path formatting/escaping helpers (dot vs bracket notation). |
| promkit-widgets/src/structured/mod.rs | Adds PathIndex + create_path_indices infrastructure used by JSON/YAML documents. |
| promkit-widgets/src/structured/json/jsonz.rs | Switches JSON path iteration to shared path formatting; minor pretty-render refactor. |
| promkit-widgets/src/structured/json/document.rs | Implements JSON selected_path, row_index_for_path, and move_to_path using path indices. |
| promkit-widgets/benches/structured/yaml.rs | Adds benchmark coverage for selected_path() near the tail. |
| promkit-widgets/benches/structured/json.rs | Adds benchmark coverage for selected_path() near the tail. |
| Cargo.toml | Updates workspace dependency versions. |
Review details
Suppressed comments (1)
promkit-widgets/src/structured/mod.rs:172
PathIndex::document_index()currently just forwards toparent(), which means calling it on a non-root row returns a parent row index, not a document index. That behavior is surprising given the name; please document that this is only meaningful for root rows (depth == 0) so it isn’t accidentally used elsewhere.
pub(crate) fn document_index(self) -> Option<usize> {
self.parent()
}
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+166
to
+168
| pub(crate) fn parent(self) -> Option<usize> { | ||
| (self.parent_or_document != NO_PATH_INDEX).then_some(self.parent_or_document as usize) | ||
| } |
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.
Add path-based navigation to JSON and YAML documents so applications can resolve paths, jump to values, and retrieve the currently selected path.
selected_path(),row_index_for_path(), andmove_to_path(), with zero-based document indexes for JSON Lines and multi-document YAML.Path output changes include root array paths from
.[0]to[0]and reserved string keys from.nullto["null"]. Consumers that compare or persist generated paths should account for these changes.Update workspace dependencies and release versions:
promkit-core: 0.6.0 → 0.6.1promkit-widgets: 0.8.0 → 0.9.0promkit: 0.15.0 → 0.16.0Validation on macOS: workspace tests, example builds, formatting, and Clippy passed. Downstream vy tests also passed. After the version updates, all-target checks passed for both repositories.