Skip to content

rhivos-tools: Add code snippet inlining and e2e integration tests#93

Open
bburt-rh wants to merge 4 commits intoredhat-documentation:mainfrom
bburt-rh:rhivos-tools-e2e-tests
Open

rhivos-tools: Add code snippet inlining and e2e integration tests#93
bburt-rh wants to merge 4 commits intoredhat-documentation:mainfrom
bburt-rh:rhivos-tools-e2e-tests

Conversation

@bburt-rh
Copy link
Copy Markdown
Collaborator

@bburt-rh bburt-rh commented Apr 17, 2026

md2adoc.py now runs as a pre-processor on raw Markdown before pandoc, rather than as a post-processor on pandoc's AsciiDoc output. This fixes a fundamental pipeline issue where pandoc mangled MkDocs-specific syntax (converting -- to em-dashes, collapsing block structure, stripping frontmatter) before md2adoc could process it.

Key changes to md2adoc.py:

  • All conversion functions wrap injected AsciiDoc in pandoc raw blocks (```{=asciidoc}) so pandoc passes it through verbatim
  • convert_snippets now classifies by file extension: .md files remain as include:: directives, code files (.yml, .container, .sh, etc.) are read from disk and inlined as [source,lang] blocks
  • Supports MkDocs line-range syntax (file:start:end)
  • Missing files fall back to include:: with a // WARNING comment
  • New --base-path CLI argument for resolving snippet source paths

SKILL.md updated to reflect the corrected pipeline order (md2adoc before pandoc) and document --base-path usage.

end-to-end integration tests verify the full pipeline across 4 fixture files with known content markers, validating snippet inlining, prose include resolution, asciidoctor rendering, and absence of residual MkDocs syntax.

Summary by CodeRabbit

  • New Features

    • Added a pre-processing step that converts Markdown fixtures and referenced prose snippets to AsciiDoc before pandoc; supports inlining external code snippets when available.
  • Improvements

    • Enhanced handling of admonitions, figures, tabbed content, frontmatter, links, and code titles; preserves raw AsciiDoc sections and provides safer fallbacks for missing/unsafe snippets.
    • Plugin version bumped.
  • Tests

    • New end-to-end test suite validating the full conversion pipeline.

md2adoc.py now runs as a pre-processor on raw Markdown before pandoc,
rather than as a post-processor on pandoc's AsciiDoc output. This fixes
a fundamental pipeline issue where pandoc mangled MkDocs-specific syntax
(converting -- to em-dashes, collapsing block structure, stripping
frontmatter) before md2adoc could process it.

Key changes to md2adoc.py:
- All conversion functions wrap injected AsciiDoc in pandoc raw blocks
  (```{=asciidoc}) so pandoc passes it through verbatim
- convert_snippets now classifies by file extension: .md files remain
  as include:: directives, code files (.yml, .container, .sh, etc.)
  are read from disk and inlined as [source,lang] blocks
- Supports MkDocs line-range syntax (file:start:end)
- Missing files fall back to include:: with a // WARNING comment
- New --base-path CLI argument for resolving snippet source paths

SKILL.md updated to reflect the corrected pipeline order
(md2adoc before pandoc) and document --base-path usage.

22 end-to-end integration tests verify the full pipeline across
4 fixture files with known content markers, validating snippet
inlining, prose include resolution, asciidoctor rendering, and
absence of residual MkDocs syntax.

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: afedc80a-88b2-4118-ad16-9f7a7345fbeb

📥 Commits

Reviewing files that changed from the base of the PR and between b3ba26c and b1474a3.

📒 Files selected for processing (1)
  • plugins/rhivos-tools/.claude-plugin/plugin.json
✅ Files skipped from review due to trivial changes (1)
  • plugins/rhivos-tools/.claude-plugin/plugin.json

Walkthrough

md2adoc.py is repurposed from a pandoc post-processor to a pre-processor: it now optionally inlines code snippets from a provided base path, wraps generated AsciiDoc fragments in pandoc raw blocks, converts prose snippet references to include::*.adoc[] (producing those .adoc files), and is invoked before pandoc. New fixtures and end-to-end tests validate the pipeline.

Changes

Cohort / File(s) Summary
Pipeline docs
plugins/rhivos-tools/skills/rhivos-fetch-convert/SKILL.md
Docs updated to describe the new preprocessing flow: run md2adoc.py --base-path ... on upstream .md before pandoc; prose snippets require conversion; removed claim that md2adoc modified files in place.
Conversion script
plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py
Reworked from pandoc post-processor to pre-processor. New CLI --base-path, raw-block markers, reordered pipeline (snippets earlier, admonitions/tabs later), expanded handling for admonitions, tabs, figures, frontmatter, fenced/indented code titles, link rewriting (skips raw blocks), and snippet conversion that inlines code files (with line-range support) or emits include::*.adoc[] for prose .md snippets; warnings + fallbacks for missing/out-of-scope files.
Markdown fixtures
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/*.md
Added multiple fixture docs exercising admonitions, snippet directives, figures/tabs, frontmatter, and a full-complexity workflow used by E2E tests.
Code snippet fixtures
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/code_snippets/*
Added snippet fixtures (long_file.yml, sample_config.yml, sample_script.sh, sample_service.container) to exercise inlining and range extraction.
Prose snippet fixtures
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/prose_snippets/*
Added prose snippet (disclaimer.md) used as an include:: target; tests convert these to .adoc so includes resolve.
End-to-end tests
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py
Added pytest E2E suite that runs md2adoc.process_file + pandoc + asciidoctor; includes helpers and assertions for frontmatter, admonitions, figures/tabs, links, snippet inlining and ranges, prose include conversion, missing-snippet fallback, and ensuring no MkDocs syntax remains.
Plugin manifest
plugins/rhivos-tools/.claude-plugin/plugin.json
Bumped plugin manifest version from 1.0.1 to 1.0.2.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    rect rgba(240,248,255,0.5)
    participant User as User/CI
    end
    rect rgba(220,240,220,0.5)
    participant MD2 as md2adoc.py
    end
    rect rgba(255,228,196,0.5)
    participant PAN as pandoc
    end
    rect rgba(255,240,245,0.5)
    participant ASCI as asciidoctor
    end
    rect rgba(245,245,245,0.5)
    participant FS as Filesystem
    end

    User->>MD2: md2adoc.py --base-path=<sig-docs> input.md -> working.md (+ prose `.adoc` files)
    MD2->>FS: read input.md and referenced snippet/prose files under base_path
    MD2-->>FS: write preprocessed working.md and produce prose `.adoc` include files
    MD2->>PAN: hand off working.md for Markdown→AsciiDoc conversion
    PAN->>FS: write output.adoc
    PAN->>ASCI: provide AsciiDoc output for validation
    ASCI->>FS: read output.adoc and included `.adoc` snippets
    ASCI-->>User: return warnings/errors (validation)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Plugin Registry Consistency ❓ Inconclusive The PR modifies plugin.json but the expected marketplace.json at repo root does not exist, making marketplace sync verification impossible. Clarify if .claude-plugin/marketplace.json is required. If so, create it with entries for all plugins matching their plugin.json versions.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding code snippet inlining capability and end-to-end integration tests to md2adoc.py, which aligns with the substantial changes across both the script and test suite.
Docstring Coverage ✅ Passed Docstring coverage is 97.56% which is sufficient. The required threshold is 80.00%.
No Real People Names In Style References ✅ Passed Comprehensive review of all modified files found no references to real people's names in style references, plugin commands, skill documentation, or example prompts.
Git Safety Rules ✅ Passed Pull request contains no git commands, hardcoded remote names, or git push operations. Changes focus solely on Markdown-to-AsciiDoc conversion utilities, documentation, and tests.
No Untrusted Mcp Servers ✅ Passed PR introduces no MCP server installations, npm packages, or external dependencies. Changes are limited to documentation, Python script enhancements, and test fixtures.
Skill And Script Conventions ✅ Passed Pull request correctly adheres to skill and script naming conventions with bare names and relative paths.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py (1)

308-319: Assert that pandoc raw fences do not survive the pipeline.

This suite checks for leftover MkDocs syntax, but not for literal ```{=asciidoc} markers in the generated .adoc. Adding that assertion would catch nested-raw-block regressions in the converters.

Suggested assertion
         assert "/// figure-caption" not in content
         assert re.search(r'```\w+\s+title=', content) is None
         assert re.search(r'\]\([^)]+\.md\)', content) is None
+        assert "```{=asciidoc}" not in content
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py`
around lines 308 - 319, Add an assertion to test_no_mkdocs_syntax_remains in
class TestNoMkDocsSyntaxRemains to ensure Pandoc raw fence markers don't survive
the conversion: after reading content from adoc_path (variable content), assert
that the literal string "```{=asciidoc}" is not present (e.g., assert
"```{=asciidoc}" not in content) to catch nested raw-block regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py`:
- Around line 399-416: The issue is that convert_admonitions() and
convert_tabbed_content() wrap content in raw `{=asciidoc}` fences before
convert_snippets(), convert_code_block_titles(), and convert_figure_captions()
run, causing nested/raw fence leakage; fix it by reordering process_file so
convert_snippets(), convert_code_block_titles(), and convert_figure_captions()
are called before convert_admonitions() and convert_tabbed_content() (or
alternatively make those three transforms raw-block-aware), i.e. move the calls
to convert_snippets, convert_code_block_titles, and convert_figure_captions
earlier in process_file so they emit raw blocks first and then wrap results with
convert_admonitions and convert_tabbed_content.
- Around line 202-210: The code currently trusts file_ref when computing
resolved = base_path / file_ref which allows paths like "../..." or absolute
paths to escape base_path; change this to first resolve both base_path and the
candidate (e.g., resolved_candidate = (base_path / file_ref).resolve()) and
ensure the candidate is contained within base_path.resolve() (using
Path.is_relative_to or comparing commonpath/parents); if the candidate is
outside base_path, treat it as missing and emit the same warning/include lines
and continue instead of calling _read_snippet_lines(resolved, start, end). Use
the existing symbols resolved/base_path/file_ref/_read_snippet_lines to locate
and update the check.

In `@plugins/rhivos-tools/skills/rhivos-fetch-convert/SKILL.md`:
- Around line 65-73: The doc omits that prose snippet files rewritten by
md2adoc.py to include::...adoc[] must themselves be converted from .md to .adoc
(or recreated) so includes resolve; update SKILL.md to add a step after running
pandoc (or before modular cleanup) that runs md2adoc.py (or a per-snippet pandoc
pass) against the snippet files referenced by the main document (e.g., files
referenced by full_complexity.md) so their .md -> .adoc conversion is performed
(mirror what
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py
does) and mention the --base-path usage for locating those snippet files.
- Around line 61-63: The docs use two different sig-docs path tokens
(`<sig-docs-path>` vs `${sig_docs_path}`) which is inconsistent and may leave
--base-path empty; update the snippet so it uses a single consistent token and,
if you prefer the shell variable form, add an explicit assignment from the skill
ARGUMENTS (or show how `$ARGUMENTS` populates `sig_docs_path`) before the
cp/python commands; ensure the copy command and the md2adoc call both reference
the same identifier (either `<sig-docs-path>` everywhere or `${sig_docs_path}`
everywhere) so --base-path is never empty.

---

Nitpick comments:
In
`@plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py`:
- Around line 308-319: Add an assertion to test_no_mkdocs_syntax_remains in
class TestNoMkDocsSyntaxRemains to ensure Pandoc raw fence markers don't survive
the conversion: after reading content from adoc_path (variable content), assert
that the literal string "```{=asciidoc}" is not present (e.g., assert
"```{=asciidoc}" not in content) to catch nested raw-block regressions.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: af3bebb4-0270-4667-a020-adcab09c3461

📥 Commits

Reviewing files that changed from the base of the PR and between 1a214e9 and 5ddf2a4.

📒 Files selected for processing (12)
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/SKILL.md
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/admonitions_and_snippets.md
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/code_snippets/long_file.yml
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/code_snippets/sample_config.yml
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/code_snippets/sample_script.sh
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/code_snippets/sample_service.container
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/figure_and_tabs.md
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/full_complexity.md
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/prose_snippets/disclaimer.md
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/fixtures/simple_frontmatter.md
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py

Comment thread plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py Outdated
Comment thread plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py
Comment thread plugins/rhivos-tools/skills/rhivos-fetch-convert/SKILL.md
Comment thread plugins/rhivos-tools/skills/rhivos-fetch-convert/SKILL.md Outdated
…sted raw block bug

Address CI check failures and CodeRabbit review findings:

- Use relative path scripts/md2adoc.py in SKILL.md instead of
  ${CLAUDE_SKILL_DIR} (skill-and-script-conventions error)
- Unify sig-docs path tokens to <sig-docs-path> throughout SKILL.md
- Add docstrings to all test classes and methods (41% -> 80%+ coverage)
- Add path traversal guard rejecting snippet refs that escape base_path
- Reorder process_file: leaf transforms (snippets, code blocks, figures)
  run before container transforms (admonitions, tabs) to prevent nested
  pandoc raw blocks that leak ```{=asciidoc} markers into final output
- Make convert_snippets and convert_code_block_titles indent-aware so
  content inside admonitions/tabs preserves indentation for collectors
- Add _unwrap_raw_blocks helper stripped by container transforms
- Add raw fence assertion to catch regression in TestNoMkDocsSyntaxRemains
- Document prose snippet conversion step (b1) in SKILL.md

Made-with: Cursor
Copy link
Copy Markdown

@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: 1

🧹 Nitpick comments (4)
plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py (3)

160-165: Consider validating line range bounds.

The function trusts that start and end are valid 1-indexed positive integers with start <= end. Invalid values (e.g., start=0, start > end, or values exceeding file length) could produce unexpected results:

  • start=0 would include an extra line from the end due to Python's slice behavior with negative indices
  • start > end would return an empty list silently

If upstream input is always well-formed, this may be acceptable. Otherwise, consider adding bounds validation.

♻️ Defensive bounds check
 def _read_snippet_lines(file_path: Path, start: int | None, end: int | None) -> list[str]:
     """Read lines from a file, optionally extracting a 1-indexed inclusive range."""
     all_lines = file_path.read_text(encoding="utf-8").splitlines()
     if start is not None and end is not None:
+        if start < 1 or end < start:
+            return all_lines  # fallback to full file on invalid range
         return all_lines[start - 1 : end]
     return all_lines
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py` around
lines 160 - 165, The _read_snippet_lines function should validate the 1-indexed
start/end bounds before slicing: ensure that if start or end are provided they
are positive integers, that start <= end, and that both are within
1..len(all_lines); for out-of-range values either clamp them to the file bounds
or raise a ValueError (be explicit which policy you choose) and handle None as
"no bound", using file_path.read_text(...).splitlines() to compute
len(all_lines) for validation; update the function to perform these checks and
return a clear error message or a clamped slice rather than relying on Python's
negative-index/silent-empty-slice behavior.

377-391: Links inside raw block content may be incorrectly converted.

The current check only skips the raw block delimiter lines (RAW_OPEN/RAW_CLOSE), but content lines between them are still processed. If a raw block contains AsciiDoc that happens to have Markdown-like link syntax (e.g., in a code example), it could be incorrectly transformed.

Consider tracking whether you're inside a raw block and skipping all content within:

♻️ Track raw block state
 def convert_markdown_links(lines: list[str]) -> list[str]:
     ...
     result = []
     link_pattern = re.compile(r"\[([^\]]+)\]\(([^)]+)\)")
+    in_raw_block = False

     for line in lines:
-        if line.startswith(RAW_OPEN) or line == RAW_CLOSE:
+        if line == RAW_OPEN:
+            in_raw_block = True
+            result.append(line)
+            continue
+        if line == RAW_CLOSE:
+            in_raw_block = False
             result.append(line)
             continue
+        if in_raw_block:
+            result.append(line)
+            continue
         ...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py` around
lines 377 - 391, The loop currently only ignores the RAW_OPEN/RAW_CLOSE
delimiter lines but still processes lines between them; modify the logic in the
for loop to maintain a boolean "in_raw" state (flip it when encountering
RAW_OPEN or RAW_CLOSE) and when in_raw is True append lines unchanged (skip
running link_pattern.sub via replace_link). Update references in this block (the
loop over lines, the RAW_OPEN/RAW_CLOSE checks, and the use of
link_pattern.sub/replace_link) so raw block content is preserved verbatim.

40-42: Consider using spread syntax for list construction.

Per static analysis (RUF005), spread syntax is preferred over list concatenation.

♻️ Suggested refactor
 def _raw_block(asciidoc_lines: list[str]) -> list[str]:
     """Wrap AsciiDoc lines in a pandoc raw block for pass-through."""
-    return [RAW_OPEN] + asciidoc_lines + ["", RAW_CLOSE]
+    return [RAW_OPEN, *asciidoc_lines, "", RAW_CLOSE]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py` around
lines 40 - 42, The return currently concatenates lists in _raw_block; replace
that with a list literal using unpacking to construct the result in one
expression: create and return a single list combining RAW_OPEN, the unpacked
asciidoc_lines, the empty-string separator, and RAW_CLOSE (referencing function
_raw_block and symbols RAW_OPEN/RAW_CLOSE).
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py (1)

248-249: Consider documenting the expected ---- count.

The assertion content.count("----") >= 8 relies on knowing how many source blocks the fixture produces. A brief comment explaining this expectation (e.g., "4 code snippets × 2 delimiters each") would help maintainers understand what fixture changes might affect this threshold.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py`
around lines 248 - 249, The test asserts content.count("----") >= 8 without
explanation; add a brief inline comment above the two assertions in
tests/test_e2e_conversion.py describing how the threshold is computed (for
example "expected at least 8 delimiters: 4 code snippets × 2 delimiters each"),
and optionally replace the magic number with a named local (e.g.,
expected_delimiters) so the assertion reads assert content.count("----") >=
expected_delimiters to make the intent clear and easier to update when the
fixture changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py`:
- Around line 27-34: EXTENSION_LANGUAGE_MAP is missing mappings for .container
and .conf so those code blocks render without a language; update the
EXTENSION_LANGUAGE_MAP dict to include entries for ".container": "ini" and
".conf": "ini" (add these keys alongside existing mappings like ".yml" and
".json") so the md2adoc.py conversion emits [source,ini] for those extensions.

---

Nitpick comments:
In `@plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py`:
- Around line 160-165: The _read_snippet_lines function should validate the
1-indexed start/end bounds before slicing: ensure that if start or end are
provided they are positive integers, that start <= end, and that both are within
1..len(all_lines); for out-of-range values either clamp them to the file bounds
or raise a ValueError (be explicit which policy you choose) and handle None as
"no bound", using file_path.read_text(...).splitlines() to compute
len(all_lines) for validation; update the function to perform these checks and
return a clear error message or a clamped slice rather than relying on Python's
negative-index/silent-empty-slice behavior.
- Around line 377-391: The loop currently only ignores the RAW_OPEN/RAW_CLOSE
delimiter lines but still processes lines between them; modify the logic in the
for loop to maintain a boolean "in_raw" state (flip it when encountering
RAW_OPEN or RAW_CLOSE) and when in_raw is True append lines unchanged (skip
running link_pattern.sub via replace_link). Update references in this block (the
loop over lines, the RAW_OPEN/RAW_CLOSE checks, and the use of
link_pattern.sub/replace_link) so raw block content is preserved verbatim.
- Around line 40-42: The return currently concatenates lists in _raw_block;
replace that with a list literal using unpacking to construct the result in one
expression: create and return a single list combining RAW_OPEN, the unpacked
asciidoc_lines, the empty-string separator, and RAW_CLOSE (referencing function
_raw_block and symbols RAW_OPEN/RAW_CLOSE).

In
`@plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py`:
- Around line 248-249: The test asserts content.count("----") >= 8 without
explanation; add a brief inline comment above the two assertions in
tests/test_e2e_conversion.py describing how the threshold is computed (for
example "expected at least 8 delimiters: 4 code snippets × 2 delimiters each"),
and optionally replace the magic number with a named local (e.g.,
expected_delimiters) so the assertion reads assert content.count("----") >=
expected_delimiters to make the intent clear and easier to update when the
fixture changes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bc0c2c0-9d12-4c4a-b9fc-f5b916021017

📥 Commits

Reviewing files that changed from the base of the PR and between 5ddf2a4 and c909fbb.

📒 Files selected for processing (3)
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/SKILL.md
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/SKILL.md

Comment thread plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py
- Add .container and .conf to EXTENSION_LANGUAGE_MAP as ini
- Add defensive bounds validation in _read_snippet_lines for
  invalid line ranges (start < 1 or end < start)
- Track raw block state in convert_markdown_links so content
  inside raw blocks is not incorrectly link-converted
- Use spread syntax in _raw_block (RUF005)
- Update test to assert [source,ini] and document delimiter count

Made-with: Cursor
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py (1)

18-19: Consider a cleaner import approach.

The sys.path.insert pattern works but is fragile if directory structure changes. Consider using pytest-pythonpath or configuring the path in pyproject.toml/conftest.py for a more maintainable solution.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py`
around lines 18 - 19, Replace the fragile sys.path manipulation in the test
(which currently inserts the scripts directory to import md2adoc and use
process_file) with a maintainable test import strategy: remove the
sys.path.insert(...) line and instead configure test discovery to find the
scripts package by adding the scripts directory to the test path via pytest
configuration (use pytest-pythonpath plugin or add pythonpath in
pytest.ini/pyproject.toml) or set up a conftest.py that adjusts PYTHONPATH once
for the test session; then import md2adoc and call process_file normally in
tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py`:
- Around line 18-19: Replace the fragile sys.path manipulation in the test
(which currently inserts the scripts directory to import md2adoc and use
process_file) with a maintainable test import strategy: remove the
sys.path.insert(...) line and instead configure test discovery to find the
scripts package by adding the scripts directory to the test path via pytest
configuration (use pytest-pythonpath plugin or add pythonpath in
pytest.ini/pyproject.toml) or set up a conftest.py that adjusts PYTHONPATH once
for the test session; then import md2adoc and call process_file normally in
tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f9e6872-70e8-4c08-8b8d-f803c862363b

📥 Commits

Reviewing files that changed from the base of the PR and between c909fbb and b3ba26c.

📒 Files selected for processing (2)
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/scripts/md2adoc.py
  • plugins/rhivos-tools/skills/rhivos-fetch-convert/tests/test_e2e_conversion.py

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.

1 participant