Markdown region-kind golden fixture coverage (2.1.2) - #31
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughUpdate the Markdown IR vocabulary, emission, validation, tests, and Python bridge so region kinds stay stable, emit consistently, and surface through Rust and Python APIs. Align CI, fixture access, and docs with the same contracts. ChangesMarkdown IR rollout
Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (18 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. crates/stilyagi-markdown/src/tests/coverage.rs Comment on file //! Coverage tests for the promised Markdown IR region vocabulary.
❌ New issue: String Heavy Function Arguments |
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. crates/stilyagi-markdown/src/tests.rs Comment on file //! snapshots remain anchored to `src/snapshots/`. Other test categories live
//! in focused sibling modules to keep each file within the size budget.
macro_rules! must_ok {❌ New issue: String Heavy Function Arguments |
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. crates/stilyagi-markdown/src/tests/ir_consistency.rs Comment on file .regions
.first_mut()
.unwrap_or_else(|| panic!("expected at least one Markdown IR region"));
.expect("expected at least one Markdown IR region");❌ New issue: Code Duplication |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Large Assertion Blockscrates/stilyagi-markdown/src/tests/coverage.rs: What lead to degradation?The test suite contains 4 assertion blocks with at least 4 assertions, threshold = 4 Why does this problem occur?Measures the number of lines with consecutive assert statements in a unit test. The more consecutive assert statements, the lower the code health. The threshold for the Rust language is 4 consecutive lines of assert statements. How to fix it?Consider to encapsulate the assertions (i.e. test criteria) in a custom assert statement. This simplifies the test by letting you communicate the test criteria in the language of your domain. We also recommend to consider the granularity of the tests; sometimes a single test tests too many things; extracting smaller tests often help to simplify the test criteria. Finally, large assertion blocks can also signal missing functionality in the code under test: instead of fetching and comparing individual properties of an object, maybe that class should encapsulate what equality means in an Equals() method? Helpful refactoring examplesTo get a general understanding of what this code health issue looks like - and how it might be addressed - we have prepared some diffs for illustrative purposes. SAMPLE# large_assertion_block_example.js
test('T-1000 automatically repairs when damaged', () => {
robT1000.heal();
- assert.equal(100, robT1000.cpuCapacity);
- assert.isOk(robT1000.ramCheckPasses;
- assert.isOK(robT1000.diskAccessible);
- assert.equal(100, robT1000.vision);
- assert.equal(CONSTANTS.FUNCTIONAL, robT1000.equipment);
+ // Replace the low-level assertions with a custom assert that lets
+ // us communicate in the language of our domain. Also encapsulates
+ // the criteria so that we only have one place to change if/when
+ // more properties are added.
+ // Most test frameworks and assertion libraries have support for
+ // custom asserts.
+ assert.fullyOperational(robT1000);
} |
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Overall Code Complexitypython/stilyagi/engine/extraction.py: What lead to degradation?This module has a mean cyclomatic complexity of 4.11 across 9 functions. The mean complexity threshold is 4 Why does this problem occur?Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better. How to fix it?You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples: |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Sorry @leynos, your pull request is larger than the review limit of 150000 diff characters
Validate full PyO3 syntax tuples, assert unknown syntax maps to `PyValueError`, and strengthen the bridge BDD source-backed heading contract. Make Python region-kind lookup lazy, align the extension stub with positional runtime arguments, and document the canonical IR warn-and-preserve policy.
Extract the shared tuple assertion used by the supported syntax and region vocabulary tests so each test only defines the vocabulary it verifies. Keep the helper lint-clean by accepting the expected values by slice and using explicit error handling in the shared test helper.
Extract shared bridge-state setup, Python attachment, region payload traversal, and first-heading checks from the PyO3 bridge BDD assertions. Keep the stronger canonical source-backed assertions only on the scenario that requires a single source-backed region.
Require the empty-link-title coverage test to prove the fixture still emits at least one non-empty `link_title` region while rejecting empty emitted titles. Update the developer guide lint prose to describe Stilyagi's own Rust lint contract and use the Makefile's all-targets, all-features wording.
Describe the Rust lint tiers as owned by this repository and align the nearby scope wording with the requested all-targets, all-feature phrasing.
Move unknown IR region warning emission out of the low-level extraction adapter and into the public engine command boundary, preserving unknown regions while logging operation, index, and kind context. Add direct tests for fixture ordering and Makefile lint, typecheck, and test recipes. Refresh the wheel snapshot for the new engine API module and update user documentation for the current Markdown region contract.
Expand the public engine API documentation for `extract_document`, trim the users guide back to package-facing behaviour, and collapse the duplicated unknown IR region tests into one parametrized boundary check.
Strengthen the fixture ordering test so it cannot pass on vacuous output, make the unknown IR warning helper package-internal, and collapse the Makefile recipe tests into one parameterized contract check. Limit the developer-guide Clippy wording to the Clippy-enforced commands that actually consume the repository thresholds.
Assert the sorted fixture listing contains a known shared fixture and add direct text and byte fixture reader coverage, so the ordering test cannot pass on empty or singleton output. Guard syntax vocabulary validation with a lock, document the process-wide cache model, and add a reset hook with tests for bridge-patching scenarios.
Reset extraction adapter caches before and after every package skeleton test so bridge-patching failures cannot leak process-wide state into later tests. Add a concurrent syntax validation check and narrow the developer-guide Clippy rationale to the Makefile-driven `cargo clippy` invocation.
Record that the Python extraction adapter lazily caches bridge vocabularies, protects syntax validation with a module lock, and requires bridge-patching tests to reset the process-wide state before observing patched vocabularies.
Describe the Python bridge region-kind surface as the canonical `stilyagi_ir::RegionKind` vocabulary and record the full thin-container contract for Markdown list-item and blockquote regions.
Add Interrogate to the Makefile lint gate with a 100% threshold over the Python package and tests. Install the pinned Interrogate uv tool in CI before `make lint` runs, and update the lint contract tests and maintainer guide.
d66d8e0 to
f9b8ab5
Compare
Add the new `stilyagi-test-support` fixture directory and byte-reading helpers to the developer guide API reference. Tie bridge and API contract tests back to those helpers so corpus access remains centralised.
Remove no-op `let _ = bridge_state` reads from BDD steps. Use rstest's `#[from(bridge_state)]` fixture alias for scenario functions so the macro keeps the required fixture binding without creating unused local variables.
Add Interrogate to the developer guide's `make lint` summary so the high-level target order matches the Makefile and the detailed lint-tier section.
|
@coderabbitai Have the following now been resolved? docs/developers-guide.md (1)
📝 Suggested fix- `make lint`
- run Ruff checks through `uv`
+ - run Interrogate docstring-coverage checks requiring 100% coverage
- run focused Pylint checks through the pinned `pylint-pypy-shim` wrapper
under PyPy🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C6 'make lint' docs/developers-guide.md | sed -n '1,80p'
echo "---"
sed -n '600,660p' docs/developers-guide.mdLength of output: 7090
No further work is required for this finding. |
|
@coderabbitai Have the following now been resolved? ❌ Failed checks (1 error, 1 warning)
|
Summary
Implements roadmap item 2.1.2: every shipped v1 Markdown region kind is now
covered by golden fixtures and structural assertions.
The implementation adds the missing Markdown region surfaces (
list_item,blockquote,frontmatter,image_alt, andlink_title), keepsfrontmatter_fieldreserved through ADR 005/RFC 0001, and validates IR segmentsource backing by re-slicing the original source bytes.
Review Follow-up
SyntheticReasonrather than afree-form string.
decoded_textsyntheticsegments.
link_titleregions and cover the negative case in the fixture.supported_region_kinds()tuple againstRegionKind::ALL.cargo-nextestinstall.not advertised as public API.
Validation
make check-fmtmake lintmake typecheckmake testmake markdownlintmake nixieReferences