Skip to content

Unify region-kind vocabulary (6.4.1) - #55

Merged
leynos merged 23 commits into
mainfrom
roadmap-6-4-1
Jul 16, 2026
Merged

Unify region-kind vocabulary (6.4.1)#55
leynos merged 23 commits into
mainfrom
roadmap-6-4-1

Conversation

@leynos

@leynos leynos commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

This branch implements roadmap task (6.4.1): it makes stilyagi_ir::RegionKind
the canonical source for emitted shared region spellings, adds explicit bridge-to-
IR vocabulary guards, and removes remaining tree-sitter copies of shared
spelling literals. This prevents silent divergence while retaining the
bridge-only document region and its separate parser contract.

Roadmap task: (6.4.1)
ExecPlan: docs/execplans/roadmap-6-4-1.md

The branch also parameterizes the shared Markdown and Python IR snapshots,
updates the developer and roadmap documentation, and replaces lint-disallowed
panic closures in affected Rust tests.

Review Walkthrough

Validation

  • make check-fmt: passed
  • make test: passed, including workspace tests, doctests, and Python tests
  • make typecheck: passed
  • make lint: passed, including Clippy, Rustdoc, Whitaker, and Python checks
  • make markdownlint: passed
  • make nixie: passed
  • coderabbit review --agent: completed with zero findings

Notes

stilyagi_extract::RegionKind::Document remains intentionally bridge-only:
ir_region_kind() returns None, and stilyagi_ir::RegionKind::try_from("document")
rejects it. Shared emitted spellings forward through the IR enum; the bridge
TryFrom<&str> remains a separate, test-pinned parser.

References

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

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 53 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: aab1acdd-52f4-47ef-96c9-6b028c095af3

📥 Commits

Reviewing files that changed from the base of the PR and between d272284 and 8442eee.

📒 Files selected for processing (23)
  • crates/stilyagi-extract/src/error.rs
  • crates/stilyagi-extract/src/lib.rs
  • crates/stilyagi-extract/src/region.rs
  • crates/stilyagi-extract/src/tests.rs
  • crates/stilyagi-extract/tests/extract/extraction_behaviour.rs
  • crates/stilyagi-extract/tests/extract/ir_identity.rs
  • crates/stilyagi-extract/tests/extract/region_vocabulary.rs
  • crates/stilyagi-extract/tests/extract/spelling_display.rs
  • crates/stilyagi-extract/tests/extract_integration.rs
  • crates/stilyagi-ir/src/tests/mod.rs
  • crates/stilyagi-markdown/src/tests/properties.rs
  • crates/stilyagi-pyext/src/lib.rs
  • crates/stilyagi-pyext/src/tests/mod.rs
  • crates/stilyagi-pyext/src/tests/rust_doc_comment.rs
  • crates/stilyagi-tree-sitter/src/python/mod.rs
  • crates/stilyagi-tree-sitter/src/rust/builder.rs
  • docs/developers-guide.md
  • docs/execplans/.roadmap-6-4-1-review-r1.commitmsg
  • docs/execplans/.roadmap-6-4-1.commitmsg
  • docs/execplans/roadmap-6-4-1-review-r1.md
  • docs/execplans/roadmap-6-4-1.md
  • docs/roadmap.md
  • docs/users-guide.md

Walkthrough

Unify RegionKind spellings between stilyagi-extract and stilyagi-ir, move extract APIs into modules, switch tree-sitter emission to enum-derived values, add vocabulary and failure-path tests, and update roadmap documentation.

Changes

RegionKind vocabulary unification

Layer / File(s) Summary
Region and error API contracts
crates/stilyagi-extract/src/{error.rs,region.rs,lib.rs}, crates/stilyagi-extract/src/tests.rs
Define and re-export extraction errors, bridge region kinds, typed regions, mappings, stable spellings, and IR-backed extraction helpers.
Tree-sitter enum-derived emission
crates/stilyagi-tree-sitter/src/python/mod.rs, crates/stilyagi-tree-sitter/src/rust/builder.rs
Replace hard-coded Python and Rust region-kind strings with canonical IR enum spellings.
Vocabulary and spelling validation
crates/stilyagi-extract/tests/extract/{region_vocabulary.rs,spelling_display.rs}, crates/stilyagi-extract/tests/extract_integration.rs
Register integration coverage for bridge mappings, emitted IR kinds, and RustDocComment spelling round-trips.
Test failure-path cleanup
crates/stilyagi-extract/tests/extract/*, crates/stilyagi-ir/src/tests/mod.rs, crates/stilyagi-markdown/src/tests/properties.rs, crates/stilyagi-pyext/src/tests/*
Use fixed expect messages and parameterised snapshot coverage while preserving test assertions.
Documentation and roadmap records
docs/developers-guide.md, docs/users-guide.md, docs/execplans/*, docs/roadmap.md, crates/stilyagi-pyext/src/lib.rs
Document vocabulary ownership, bridge API boundaries, review corrections, implementation details, and roadmap completion.

Sequence Diagram(s)

sequenceDiagram
  participant ExtractSyntax
  participant extract_document_from_ir
  participant TreeSitter
  participant IrRegionKind
  participant ExtractDocument
  ExtractSyntax->>extract_document_from_ir: dispatch syntax extraction
  extract_document_from_ir->>TreeSitter: build canonical IR
  TreeSitter->>IrRegionKind: emit enum-derived region spelling
  TreeSitter-->>extract_document_from_ir: return IR regions
  extract_document_from_ir->>ExtractDocument: attach IR and bridge regions
Loading

Possibly related PRs

  • leynos/stilyagi#11: Both changes modify the extract-side RegionKind and ExtractRegion bridge.
  • leynos/stilyagi#15: Both changes connect Markdown IR propagation with ExtractError::MarkdownIr.
  • leynos/stilyagi#30: Both changes modify Python docstring extraction and shared region-kind dispatch.

Suggested labels: Roadmap

Suggested reviewers: codescene-delta-analysis, codescene-access

Poem

Bridge words march in tidy rows,
RegionKind::ALL keeps what each side knows.
Docstrings and Rust docs share one tune,
Enums guide builders beneath the moon. ✨

🚥 Pre-merge checks | ✅ 19 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Developer Documentation ⚠️ Warning The execplan still records 2026-07-17 progress as historical, and the developer guide still leaves the IR RegionKind::as_str() reference unqualified. Backdate or remove the 2026-07-17 progress entries, and qualify the IR spelling reference as stilyagi_ir::RegionKind::as_str().
✅ Passed checks (19 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR’s main change and includes the roadmap item reference (6.4.1).
Description check ✅ Passed The description is clearly related to the changeset and summarises the roadmap task, tests, and documentation updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Testing (Overall) ✅ Passed PASS: The new tests exercise bridge/IR round-trips, emitted region vocabulary, error mapping, and extraction payloads on real fixtures, so plausible regressions fail.
User-Facing Documentation ✅ Passed Document the new Rust doc-comment support and bridge-helper boundary in docs/users-guide.md; the lead locale reflects the changed user-facing behaviour.
Module-Level Documentation ✅ Passed Scanned 77 Rust files in the touched crates, and every module begins with a //! doc comment describing its role.
Testing (Unit And Behavioural) ✅ Passed PASS: Unit tests cover region-kind invariants and error mapping; integration tests exercise the public extract_document boundary for Markdown, Python, and Rust.
Testing (Property / Proof) ✅ Passed Use exhaustive table and bridge tests; the execplan states the closed ALL set is strictly exhaustive, so no property or proof work is warranted.
Testing (Compile-Time / Ui) ✅ Passed PASS: The PR adds semantic snapshot tests for structured IR output and no new compile-time contract that would need trybuild coverage.
Unit Architecture ✅ Passed Injected helpers expose IR building and error mapping explicitly; query APIs stay Result/Option-based and region spelling now comes from canonical IR.
Domain Architecture ✅ Passed PASS: keep the bridge/adapter split; core extract code only maps shared vocab, and tree-sitter/Python adapters own producer and transport translation.
Observability ✅ Passed PASS: The patch only refactors bridge vocabulary and tests; existing Python/Rust extractors still carry tracing/metrics, and no new operational boundary or alerting change is introduced.
Security And Privacy ✅ Passed No secrets, auth gaps, or unsafe sinks were introduced; changes are limited to vocabulary mapping, tests, and docs with synthetic data only.
Performance And Resource Use ✅ Passed No material regression: all new work stays linear and bounded, traversal limits are unchanged, and runtime allocations mirror the previous per-region clone behaviour.
Concurrency And State ✅ Passed No shared mutable state, locks, async tasks, or ordering-sensitive protocol were introduced; all new state is per-call owned builder/document data.
Architectural Complexity And Maintainability ✅ Passed PASS: the new helper and module split remove duplication at an explicit seam, and the crate graph stays acyclic with no hidden registration or speculative layers.
Rust Compiler Lint Integrity ✅ Passed No dead_code/unused suppressions or fake anchors were added; new expectations target clippy::too_many_arguments and missing_const_for_fn, and the clone in extract_document_from_ir is ownership-pres...
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch roadmap-6-4-1

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

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the roadmap-6-4-1 branch from db8941e to 4bd2a94 Compare July 7, 2026 12:26
codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review July 7, 2026 17:28

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

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai coderabbitai Bot added the Roadmap label Jul 7, 2026
@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

@leynos

leynos commented Jul 13, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Jul 13, 2026

Copy link
Copy Markdown
Owner Author

@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. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

crates/stilyagi-extract/tests/extract/ir_identity.rs

Comment on file

#[rstest]
fn shared_markdown_fixture_has_a_golden_ir_snapshot() {
    let document = stilyagi_test_support::golden_markdown_ir_fixture(SHARED_MARKDOWN_FIXTURE_PATH)
        .unwrap_or_else(|error| panic!("expected shared Markdown golden IR: {error}"));

❌ Getting worse: Code Duplication
introduced similar code in: shared_markdown_fixture_has_a_golden_ir_snapshot,shared_python_fixture_has_a_golden_ir_snapshot

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the roadmap-6-4-1 branch from ab4530c to 059c8d3 Compare July 13, 2026 23:40
codescene-access[bot]

This comment was marked as outdated.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

coderabbitai[bot]

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

leynos added 23 commits July 16, 2026 15:27
Commit the recovered planning artefacts so continue-mode recovery can
resume from durable git state after the stopped workflow.

This does not implement the roadmap task or mark it complete.
Add the extract-to-IR region-kind mapping so shared bridge
spellings come from `stilyagi_ir::RegionKind`. Record the
Work item 1 drift evidence and gate results in the ExecPlan.
Add integration tests that prove extract-emitted IR region kinds
belong to the canonical `stilyagi_ir` vocabulary, with `document`
kept as the explicit bridge-only exception.
Replace the Python and Rust tree-sitter region-kind literals with
`stilyagi_ir::RegionKind` spellings so the IR vocabulary stays the
single source of truth at the producer boundary.
Keep the rebased Rust doc-comment builder aligned with `origin/main`
by restoring the IR type imports while retaining the shared
RegionKind spelling source. Record the rebase finding in the plan.
Mark the completed ExecPlan consistently and update its test harness paths to match the registered integration entry point and shared helpers.
Use descriptive test expectations accepted by the Whitaker lint suite.
Record the verified follow-up and successful gates in the ExecPlan.
Consolidate the Markdown and Python shared fixture cases while preserving their existing snapshot names.
Update the developer guide to describe the bridge region-kind API,
including the non-exhaustive bridge enum, its  helper, and the
 mapping into .

Mark roadmap item 6.4.1 complete and record the verification in the
associated exec plan so the docs and roadmap state stay aligned.
Replace the stale two-variant declaration and remove the adjacent duplicate enum example.
Add public helper examples and make the bridge-only Document invariants explicit in both vocabulary test layers.
Clarify canonical emitted spelling ownership in the ExecPlan.
Require every non-Document bridge kind to map to IR and pin emitted kind spellings per extraction fixture.
Record the review follow-up in the ExecPlan.
Move region and error concerns out of the oversized crate root while
preserving the public extraction API.

Add focused vocabulary, error-source, and Rustdoc coverage, and record
the verified review decisions in the ExecPlan.
Clarify private extraction helpers and distinguish Rust bridge
vocabulary helpers from the Python-facing region-kind API.
Route Python and Rust extraction through one private IR conversion path
while preserving their syntax-specific builders and error mapping.
Explain the bridge-region and canonical-IR boundaries in private
extraction helpers, and validate shared bridge spellings through the IR
vocabulary without changing unsupported-spelling errors.
Call the shared canonical-IR conversion helper directly from the syntax
dispatcher and retain language-specific outcomes alongside each arm.
@lodyai
lodyai Bot force-pushed the roadmap-6-4-1 branch from b75daeb to 8442eee Compare July 16, 2026 13:30
codescene-access[bot]

This comment was marked as outdated.

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

No quality gates enabled for this code.

@leynos
leynos merged commit 1a98c5c into main Jul 16, 2026
10 checks passed
@leynos
leynos deleted the roadmap-6-4-1 branch July 16, 2026 17:16
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.

2 participants