Skip to content

Align html5ever rcdom dependencies (#278) - #279

Merged
leynos merged 6 commits into
mainfrom
issue-278-fix-markup5ever-version-conflict-blocking-html5ever-bump-to-0-39-0
May 26, 2026
Merged

Align html5ever rcdom dependencies (#278)#279
leynos merged 6 commits into
mainfrom
issue-278-fix-markup5ever-version-conflict-blocking-html5ever-bump-to-0-39-0

Conversation

@leynos

@leynos leynos commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

This branch resolves issue #278 by moving html5ever and
markup5ever_rcdom onto the same 0.39 parser stack. That keeps
RcDom implementing the TreeSink trait expected by html5ever
0.39 and removes the duplicate markup5ever trait-bound conflict.

Closes #278.

Review walkthrough

  • Start with Cargo.toml to see the direct dependency alignment.
  • Then review Cargo.lock to confirm the resolved html5ever, markup5ever, markup5ever_rcdom, and xml5ever stack.

Validation

  • make check-fmt: passed.
  • make lint: passed with cargo clippy --all-targets --all-features -- -D warnings.
  • make test: passed with RUSTFLAGS="-D warnings" cargo test --all-targets --all-features.
  • coderabbit review --agent: passed with zero findings.

Summary by Sourcery

Build:

  • Update html5ever dependency to version 0.39.0 and pin markup5ever_rcdom to version 0.39.0 to keep the HTML parser ecosystem consistent.

Upgrade `html5ever` and `markup5ever_rcdom` onto the 0.39 parser
stack so both crates use the same `markup5ever` trait definitions.

Pin `markup5ever_rcdom` to the 0.39 line because the compatible crate
is published as `0.39.0+unofficial`, while Cargo ignores build metadata
in manifest requirements.
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 04bcd1b2-eba9-4fcf-b24b-de1e6150fab4

📥 Commits

Reviewing files that changed from the base of the PR and between cdbd181 and ca083de.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (18)
  • Cargo.toml
  • docs/architecture.md
  • docs/developers-guide.md
  • tests/breaks.rs
  • tests/cli.rs
  • tests/cli_fences.rs
  • tests/code_emphasis.rs
  • tests/compile.rs
  • tests/fences.rs
  • tests/footnotes.rs
  • tests/lists.rs
  • tests/markdownlint.rs
  • tests/parallel.rs
  • tests/prelude/mod.rs
  • tests/table/mod.rs
  • tests/ui/html5ever_rcdom_pass.rs
  • tests/wrap/mod.rs
  • tests/wrap_renumber.rs
💤 Files with no reviewable changes (1)
  • tests/prelude/mod.rs

Resolves version conflict between html5ever and markup5ever_rcdom

This PR resolves issue #278 by aligning html5ever (0.27 → 0.39.0) and markup5ever_rcdom (0.3 → 0.39.0) onto the same markup5ever parser stack. This eliminates the trait-bound mismatch where RcDom did not implement the TreeSink trait required by html5ever 0.39.

Dependencies

  • Cargo.toml: Updated html5ever to 0.39.0 and markup5ever_rcdom to 0.39.0 with inline comments documenting the version coupling requirement
  • Added trybuild 1.0 to dev-dependencies for compile-time regression testing

Documentation

  • docs/developers-guide.md: Added new "HTML parser dependency coupling" section explaining that html5ever and markup5ever_rcdom must share the same markup5ever parser stack version, with guidance that any upgrade to html5ever must be accompanied by a corresponding update to markup5ever_rcdom
  • docs/architecture.md: Clarified HTML-table preprocessing flow via convert_html_tables and the use of html5ever with markup5ever_rcdom

Testing

  • tests/compile.rs: Added compile-time regression test harness using trybuild::TestCases to assert tests/ui/html5ever_rcdom_pass.rs compiles successfully, detecting future trait-bound regressions
  • tests/ui/html5ever_rcdom_pass.rs: New UI test that verifies RcDom compiles with the active html5ever parser stack by parsing a trivial document and accessing the document tree

Test infrastructure refactoring

Replaced the broad prelude-based test imports across 14 test files (breaks.rs, cli.rs, cli_fences.rs, code_emphasis.rs, fences.rs, footnotes.rs, lists.rs, markdownlint.rs, parallel.rs, wrap_renumber.rs and test modules) with direct imports from a common module, eliminating unnecessary re-exports and suppression of unused-import lint warnings. Test logic and assertions remain unchanged.

Validation

All checks passed: format validation, clippy linting with -D warnings, and full test suite with RUSTFLAGS="-D warnings".

Walkthrough

Update two crates so they share the same markup5ever parser stack: html5ever → 0.39.0 and markup5ever_rcdom → 0.39.0. Add trybuild dev-dependency and a compile-time UI test. Rewire integration tests to include tests/common/mod.rs instead of a prelude, and expand docs describing the parser-coupling requirement.

Changes

Parser upgrade, docs, and test harness changes

Layer / File(s) Summary
Cargo.toml dependency pins & dev-test
Cargo.toml
Bump html5ever0.39.0; bump markup5ever_rcdom0.39.0 with inline note about sharing the same markup5ever parser stack; add trybuild = "1" under [dev-dependencies].
Developer and architecture docs
docs/developers-guide.md, docs/architecture.md
Add a section describing the required co-upgrade of html5ever and markup5ever_rcdom and expand the HTML-table support description to show convert_html_tables builds an RcDom with html5ever and traverses it to extract rows/cells.
Integration test harness rewiring & compile-time UI test
tests/*, tests/ui/html5ever_rcdom_pass.rs, tests/compile.rs
Replace prelude-based test wiring with explicit #[path = ".../common/mod.rs"] mod common; imports across many tests; add tests/ui/html5ever_rcdom_pass.rs (UI test exercising html5ever::parse_document with markup5ever_rcdom::RcDom) and tests/compile.rs (trybuild harness checking the UI test compiles).

Suggested labels

Issue

Poem

🦀 Crates aligned, the parser's clear,
Cargo plucks the version near,
Tests now call the common chain,
Docs explain the shared domain,
Build and watch the compile cheer.

🚥 Pre-merge checks | ✅ 20
✅ Passed checks (20 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and directly describes the main objective: aligning html5ever and markup5ever_rcdom dependencies to resolve the version conflict, with the linked issue #278 properly referenced.
Description check ✅ Passed The description thoroughly explains the problem, solution, validation steps, and references issue #278, directly relating to the changeset's core objective of dependency alignment.
Linked Issues check ✅ Passed All code changes directly address issue #278: dependency versions are aligned (html5ever 0.39.0 and markup5ever_rcdom 0.39.0), documentation added for parser stack coupling, and a compile-time test added to prevent trait-bound regressions.
Out of Scope Changes check ✅ Passed All changes are within scope: Cargo.toml updates resolve the core issue, documentation clarifies the coupling requirement, test infrastructure (trybuild, ui tests) validates the fix, and test imports are refactored to support the new common module pattern.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Testing (Overall) ✅ Passed New UI test directly exercises parse_document with RcDom, which fails to compile if markup5ever versions misalign—the exact issue from #278. Trybuild test asserts compilation success.
User-Facing Documentation ✅ Passed PR fixes version conflict enabling existing HTML table feature. No new user-facing functionality introduced; HTML table support already documented in README and architecture guide.
Developer Documentation ✅ Passed Developers-guide.md documents HTML parser dependency coupling with version alignment rationale and compile-time test requirements; architecture.md updated with HTML table preprocessing details.
Module-Level Documentation ✅ Passed All 7 modules carry docstrings explaining purpose, utility, and component relationships; new test files properly document dependency integration and TreeSink trait coupling.
Testing (Unit And Behavioural) ✅ Passed Compile-time test validates the TreeSink trait fix. Unit tests verify HTML parsing; integration tests verify table conversion. All existing tests maintained.
Testing (Property / Proof) ✅ Passed PR contains dependency version alignment and trait bound validation; no new algorithmic invariants, state transitions, or complex logic requiring property or proof-based testing.
Testing (Compile-Time / Ui) ✅ Passed PR adds trybuild test in tests/compile.rs validating tests/ui/html5ever_rcdom_pass.rs compiles, ensuring RcDom satisfies TreeSink trait and detecting future version misalignment.
Unit Architecture ✅ Passed PR documents dependency coupling and adds compile-time regression tests; test refactoring consolidates utilities with clear responsibility boundaries and explicit usage markers.
Domain Architecture ✅ Passed Domain architecture preserved. HTML parser dependencies confined to src/html.rs. Public API exposes domain-shaped operations without framework details leakage.
Observability ✅ Passed PR is a dependency bugfix with no operational code changes in src/. No new behaviour introduced—only compiles previously broken code. Observability check not applicable.
Security And Privacy ✅ Passed No secrets, credentials, injection risks, or sensitive data exposure detected. Changes are legitimate dependency alignment and test infrastructure refactoring only.
Performance And Resource Use ✅ Passed PR updates dependencies and test structure without algorithmic, memory allocation, or I/O performance regressions. New code uses LazyLock regex caching and performs bounded DOM traversals.
Concurrency And State ✅ Passed No concurrency changes; PR only updates dependency versions, refactors test infrastructure, and adds documentation—existing thread-safe patterns unchanged.
Architectural Complexity And Maintainability ✅ Passed PR solves markup5ever version conflict via direct dependency bumps, adds justified compile-time test, documents coupling constraint, and simplifies test code by removing wildcard re-exports.
Rust Compiler Lint Integrity ✅ Passed Prelude eliminated; test files now import specific items. All helpers use #[expect(...)] with reasons and are genuinely used. No broad suppressions hide unused code.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-278-fix-markup5ever-version-conflict-blocking-html5ever-bump-to-0-39-0

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

@sourcery-ai

sourcery-ai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Aligns the crate’s HTML parsing stack by upgrading html5ever to 0.39.0 and pinning markup5ever_rcdom to 0.39.0, with Cargo.lock regenerated to ensure a consistent set of html5ever/markup5ever/xml5ever-related dependencies.

File-Level Changes

Change Details Files
Align html5ever and RcDom (markup5ever_rcdom) versions on the 0.39 parser stack.
  • Bump html5ever dependency from 0.27 to 0.39.0.
  • Pin markup5ever_rcdom dependency explicitly to version 0.39.0 to match html5ever’s parser stack.
  • Regenerate Cargo.lock so that html5ever, markup5ever, markup5ever_rcdom, and xml5ever resolve to a compatible 0.39-based stack and remove trait-bound conflicts.
Cargo.toml
Cargo.lock

Assessment against linked issues

Issue Objective Addressed Explanation
#278 Resolve the markup5ever version conflict by aligning html5ever and markup5ever_rcdom onto compatible versions (html5ever 0.39.0 with a matching markup5ever_rcdom) so that RcDom implements the expected TreeSink trait and the project compiles.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@leynos
leynos marked this pull request as ready for review May 25, 2026 19:38

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider adding a brief comment in Cargo.toml explaining why markup5ever_rcdom is pinned to an exact version (=0.39.0), so future maintainers understand the coupling requirement with html5ever and avoid accidental desynchronization.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding a brief comment in Cargo.toml explaining why markup5ever_rcdom is pinned to an exact version (=0.39.0), so future maintainers understand the coupling requirement with html5ever and avoid accidental desynchronization.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot added the Issue label May 25, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c2063aad6

ℹ️ 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".

Comment thread Cargo.toml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@Cargo.toml`:
- Line 26: Replace the exact version pin for the dependency named
markup5ever_rcdom in Cargo.toml: change the requirement from "=0.39.0" to a
caret requirement "^0.39.0" so Cargo will accept future 0.39.x patches (it still
resolves to 0.39.0+unofficial due to build metadata); if you intentionally must
keep the exact pin, leave it but add an inline comment next to markup5ever_rcdom
explaining the specific reason for the exception to the caret mandate.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1c80ab7c-b8d2-454d-9a22-321624774572

📥 Commits

Reviewing files that changed from the base of the PR and between 421b985 and 5c2063a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • Cargo.toml

Comment thread Cargo.toml Outdated
leynos added 3 commits May 25, 2026 21:50
Remove the module-level `unfulfilled_lint_expectations` allowance from
the integration test prelude.

Use item-level `unused_imports` allowances for the shared re-exports
because each integration test compiles the prelude independently and
consumes a different subset of those utilities.
Add a manifest comment explaining why `markup5ever_rcdom` is pinned to
match the `html5ever` parser stack. This makes the dependency coupling
visible before future updates change either crate independently.
Replace the exact `markup5ever_rcdom` pin with the repository-standard
caret requirement so compatible 0.39 patch updates remain available.

Keep the coupling comment because `RcDom` still needs to track the same
parser stack as `html5ever`.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@tests/prelude/mod.rs`:
- Around line 5-10: Replace the forbidden #[allow(unused_imports)] attributes on
the re-exports in tests/prelude/mod.rs with narrowly scoped
#[expect(unused_imports, reason = "...")] annotations: apply one expect per
re-export line (e.g., for pub use assert_cmd::{Command, prelude::*};, pub use
predicates::prelude::*; and pub use rstest::{fixture, rstest};) and add an
expect on the common module declaration if present; in each reason string state
why the import is intentionally re-exported for test ergonomics (e.g.,
"re-exported for test helpers and macros used across multiple test modules") so
the lint suppression is justified and compliant with the coding guidelines.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3540730b-a877-432c-9238-1268054e071a

📥 Commits

Reviewing files that changed from the base of the PR and between 5c2063a and cdbd181.

📒 Files selected for processing (2)
  • Cargo.toml
  • tests/prelude/mod.rs

Comment thread tests/prelude/mod.rs Outdated
leynos added 2 commits May 25, 2026 23:47
Remove the integration test prelude module and import only the helpers
each consumer actually uses.

Keep shared macros wired through direct `common` module paths so tests no
longer need broad prelude re-exports or unused-import suppression.
Document the `html5ever` and `markup5ever_rcdom` version relationship
in the architecture and developer guides.

Add a trybuild pass test that compiles the `RcDom` parser sink with the
active `html5ever` parser stack so future dependency bumps catch trait
bound regressions at compile time.
@leynos
leynos merged commit 1996010 into main May 26, 2026
3 checks passed
@leynos
leynos deleted the issue-278-fix-markup5ever-version-conflict-blocking-html5ever-bump-to-0-39-0 branch May 26, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix markup5ever version conflict blocking html5ever bump to 0.39.0

1 participant