Repository navigation
Conversation
- C14N reports the structure of its canonical form to a monomorphized observer that borrows the document; existing callers pass a no-op observer and write the same octets - a node-set input to the XSLT transform is canonicalized where octet input is decoded, before the engine's workspace lease: its octets are only counted, the XML input policy limits (size, nodes, depth, namespace bindings) apply to the same counts as the preflight of those octets, and its constructs are recorded on a tape in query storage whose growth is admitted against the XSLT workspace before it allocates; text stays borrowed from the document - after the stylesheet compiles the tape is replayed into the engine's new public Document::build_with_budget_reported and DocumentBuilder, which apply the checks, parser-work charges and refusals of a parse of the canonical text in the same order and receive each run of character data whole - no conversion buffer, decode, lexical preflight or second parse remains; equivalence tests compare the built tree with the parse of the canonical octets over sampled node-sets and at every policy limit Closes #375
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
|
| Layer / File(s) | Summary |
|---|---|
Canonicalization observer Cargo.toml, src/c14n/* |
The serializer reports canonical tags, text, comments, processing instructions, and selected axes of omitted elements to an observer. Existing writer and buffer paths supply a no-op observer. The xslt feature now enables memchr. |
Budgeted document builder src/xslt/lib.rs, src/xslt/model.rs, src/xslt/model/builder_tests.rs |
DocumentBuilder accepts XML constructs and builds a document under parse budgets. Shared text handling accounts for text pieces and normalizes line endings across piece boundaries. Tests compare builder results and refusals with parsing. |
Canonical tape recording and replay src/xmldsig/transforms/xslt/source.rs, src/xmldsig/transforms/xslt/source/tests.rs |
The source path records canonical events and accounting data in a tape, then replays the constructs through DocumentBuilder. Tests compare built documents, source bytes, line numbers, and refusals with canonicalize-and-parse results, and cover XML policy limits and workspace accounting. |
Typed XSLT input integration src/xmldsig/transforms.rs, src/xmldsig/transforms/xslt.rs, src/xmldsig/transforms/xslt/tests.rs |
apply_xslt_transform passes octet or node-set input through the typed interface. Node-set input uses the tape-based source path; octet input retains its storage and optional base URI. Tests cover workspace thresholds and update direct execution calls to use typed octet input. |
Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Refactor
Sequence Diagram(s)
sequenceDiagram
participant Transform as XMLDSig XSLT transform
participant Input as Input::prepare
participant Recorder as Tape::record
participant Builder as DocumentBuilder
participant Engine as XSLT source document
Transform->>Input: prepare node-set input
Input->>Recorder: record canonical observer events
Recorder->>Builder: replay tape constructs
Builder->>Engine: build source document under budgets
Merge Risk: 
Low · previous review 82801
-
Node-set XSLT inputs that are refused for being too large can report a workspace-limit error instead of the XML document-size error that parsing the same canonical octets gives. This affects only error classification on inputs that are rejected either way. It is a small fix that can be made before or shortly after merge.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "perf(xslt): build node-set input without a second parse" matches the main change. The PR replaces serializing a node-set to bytes and reparsing them with building the XSLT source document directly from the canonical form's reported constructs. The changeset covers the C14N observer, the new XSLT source tape and builder, the removal of the canonicalize_input path, and the related tests, all of which support the title's claim. The title is concise and specific, and it follows a conventional-commit style.
Full details: Linked Issues check
-
Explanation
Directly linked issue
#375is the only active target. Its coding requirements are met by the reviewed head, based on the code excerpt and the change summaries.(1) Tree equals parse of canonical octets, with line numbers and source size [
#375]:c14n::serializereports start tags, end tags, text, comments, instructions, and omitted-element axes toCanonicalObserver.source::recordconsumes these throughRecorder.CanonicalCountcounts written bytes and\nline breaks, and setstape.source_bytes. Line numbers come fromline_breaks + 1.Document::build_with_budget_reportedandDocumentBuilderreplay the tape. The tests insource/tests.rscompare the built tree, source bytes, retained bytes, line numbers, and refusals against a parse of the canonical octets, including malformed canonical forms (for example\rin comments and PIs as
).(2) XML input policy limits [
#375]:Recorderapplies the node limit (nodes_limit), depth, and namespace bindings.recordapplies the document size limit (max_bytes) to the written count. The summary states that tests verify the four limits at each policy value.(3) Workspace and no conversion buffer [
#375]:Tapeis held in query storage.Recorder::admitrefuses growth beyondlimitand reports it as a workspace error.held_bytesincludes the tape's retained storage. The canonicalization buffer path (canonicalize_input) is removed fromxslt.rs. The node-set test inxslt/tests.rsnow expects the same workspace threshold as borrowed canonical octets.(4) Octet inputs and other C14C callers unchanged [
#375]:Input::Octetskeeps the existing decode and parse path. Existing C14N callers pass a no-op observer()and write the same octets. Thexslt/tests.rschanges wrap octet inputs inInput::Octetsand do not change their expected results.Limits of this assessment: the local test run was not repeated here. I read only part of
source.rs(the truncated read ended inRecorderelement handling). Thebuildand element-projection logic and the full test bodies rest on the change summaries.
Full details: Out of Scope Changes check
-
Explanation
Each changed area supports objectives of
#375.Cargo.toml: addsdep:memchrto thexsltfeature.CanonicalCountusesmemchr::memchr_iterto count line breaks, so the dependency is required for the line-number requirement.src/c14n/serialize.rsandsrc/c14n/mod.rs: addCanonicalObserver,ObservedValue, and the observed writer path.#375requires the observer. Existing callers use a no-op observer, so their output is unchanged.src/xslt/model.rsandbuilder_tests.rs: addDocumentBuilderandbuild_with_budget_reported.#375names this public API. The text representation change and the split of element projection are refactors that the builder needs to share parser behavior. Builder tests check parity with the parser.src/xslt/lib.rs: re-exportsDocumentBuilder. This is the public API that#375requires.src/xmldsig/transforms.rsandtransforms/xslt.rs: route node-set input to the tape path and remove the eager C14N buffer. This is the core of#375.source.rsand its tests: the new tape path and its equivalence tests.xslt/tests.rs: updated call sites and node-set workspace expectations that follow from the new input interface.
No change was found that is unrelated to
#375. Refactors and tests support the stated objectives.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 58.90% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 73 functions across 10 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06e9091b23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Growing a full tape list moves it, so the old allocation and the whole replacement are live together; admit both before reserving, and check what the allocator granted afterwards. Regression test: four events fit a ten-event limit and growing to eight, which peaks at twelve, is refused.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3558de7a7b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The builder assembled an attribute's qualified name by appending, which could reallocate, before charging the owned bytes; it now charges the name and value at their exact sizes first and allocates the name with exactly that capacity. The refusal is the same either way and only the native peak differs, so no test can observe it without an allocation counter; the equivalence tests keep the built tree's retained bytes at or below the parse's.
A full tape now ends the recording but not the canonical walk, which still measures the document and may still fail; the document size and a canonicalization failure are reported before the tape's workspace, as an octet input's size precedes its decoding. Regression test: a document over both the document limit and the tape limit is refused for its size.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b5bd28d3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Superseded by a squashed branch; a new PR follows. |
Summary
Replaces #376.
Changes
c14n::serialize: a monomorphizedCanonicalObserverreceives start and end tags, text, comments, instructions and the selected axes of omitted elements, borrowing the document; existing callers pass()and write the same octets.xslt::Document::build_with_budget_reportedandxslt::DocumentBuilder(public engine API): build a sourceDocumentfrom constructs another reader has read, with the parse's checks, parser-work charges, lexical refusals and element projection for the stated text size.xmldsig::transforms::xslt::source: the canonical walk runs where octet input is decoded, counts the octets, applies the XML input policy limits (size, nodes, depth, namespace bindings) as the preflight would, and records the constructs on a tape in query storage whose growth is admitted against the workspace; after the stylesheet compiles the tape is replayed into the builder.xslt::executetakes the input as octets or a node-set; the separate canonicalization buffer is gone.Testing
Tests, clippy, formatting, doctests and the
xsltfeature profile pass locally on macOS with the xmlsec1 oracle; equivalence tests compare the built tree with the parse of the canonical octets over sampled node-sets and at every policy limit.Closes #375
Summary by CodeRabbit