Skip to content

fix(loomgen): reject #loom.pattern and #loom.line_pattern coexistence#704

Merged
dowdiness merged 3 commits into
mainfrom
fix/702-annotation-conflict
Jul 12, 2026
Merged

fix(loomgen): reject #loom.pattern and #loom.line_pattern coexistence#704
dowdiness merged 3 commits into
mainfrom
fix/702-annotation-conflict

Conversation

@dowdiness

@dowdiness dowdiness commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Problem

A token variant could carry both #loom.pattern and #loom.line_pattern, silently ignoring the character-level pattern (issue #702).

Changes

  • New validation in parse_annotations (592795d) — rejects a token variant with both annotations before unrelated role checks, with a diagnostic explaining that one token cannot be produced by both character-level and line-mode lexers.
  • Regression tests — cover the exact loomgen: #loom.line_pattern and #loom.pattern coexistence on same variant is unvalidated #702 scenario, plus error+line_pattern and ident+line_pattern rejection branches that previously had no direct coverage.
  • Idiomatic list access (43ac9e4) — replaced manual counter in nth_string_from_apply with @list.List::nth.
  • Deterministic docs checks (f44e6b7) — check-docs.sh and check-docs-symbols.py now exclude nested .worktrees/ directories that caused false-positive failures. Added the missing plan link to docs/README.md.

Verification

  • moon check --target native: passed
  • Full native test suite: 3425 passed, 0 failed
  • moon info: no API drift
  • moon fmt: passed
  • check-deps.sh: passed
  • check-docs.sh: all checks passed
  • git diff --check: clean

Closes #702

Summary by CodeRabbit

  • Bug Fixes

    • Improved documentation checks to skip worktree-specific files and directories, preventing unrelated files from affecting validation.
    • Added validation to reject lexer token definitions that specify conflicting pattern types.
    • Added validation for unsupported line-pattern annotations on error and identifier variants.
  • Documentation

    • Added a reference to the lambda printer migration plan in the documentation analysis section.
  • Tests

    • Expanded lexer annotation coverage for invalid and conflicting configurations.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dowdiness, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: af4e90cb-1884-4357-b517-51318e25c9dc

📥 Commits

Reviewing files that changed from the base of the PR and between f44e6b7 and 00310e3.

📒 Files selected for processing (3)
  • check-docs.sh
  • docs/README.md
  • scripts/check-docs-symbols.py
📝 Walkthrough

Walkthrough

The PR excludes .worktrees/ from documentation and package scans, adds a documentation index entry, and strengthens lexer annotation validation with tests for invalid line_pattern combinations.

Changes

Documentation scan exclusions

Layer / File(s) Summary
Exclude worktree files from documentation checks
check-docs.sh, scripts/check-docs-symbols.py, docs/README.md
Documentation and package discovery skip .worktrees paths, and the Analysis section links the lambda-printer migration plan.

Lexer annotation validation

Layer / File(s) Summary
Validate lexer annotation combinations
loomgen/parse_annotations.mbt, loomgen/emit_lexer_wbtest.mbt
Token variants combining #loom.pattern and #loom.line_pattern are rejected; tests also cover invalid line_pattern usage with #loom.error and #loom.ident. The positional string helper uses direct property lookup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • No additional retrieved issues directly addressed by this PR.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The docs exclusions, README link, and nth_string_from_apply refactor are unrelated to #702's validation fix. Split the unrelated docs and refactor changes into separate PRs, or link the corresponding issue that justifies them.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: rejecting coexistence of #loom.pattern and #loom.line_pattern.
Description check ✅ Passed It covers the problem, changes, and verification, and mentions the docs update, though it doesn't follow the exact template headings.
Linked Issues check ✅ Passed The PR adds the required parse_annotations rejection and regression coverage for the both-annotations case in emit_lexer_wbtest.mbt.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/702-annotation-conflict

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.

❤️ Share

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

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

Actionable comments posted: 2

🤖 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 `@check-docs.sh`:
- Line 130: Update all three path predicates in check-docs.sh, including the
checks around the current .worktrees exclusions, to use the component-aware
*/.worktrees/* pattern. Ensure both repository-root and nested .worktrees
directories are excluded consistently.

In `@scripts/check-docs-symbols.py`:
- Around line 22-23: Update the path filtering used by should_scan_doc to reject
any path containing “.worktrees” as a complete path component, including nested
paths such as docs/.worktrees/example.md. Preserve the existing root-level
exclusion while aligning the check with the shell-based component-aware
behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: c84f87ca-fe43-4155-95cf-e2f508c426c2

📥 Commits

Reviewing files that changed from the base of the PR and between 002298b and f44e6b7.

📒 Files selected for processing (5)
  • check-docs.sh
  • docs/README.md
  • loomgen/emit_lexer_wbtest.mbt
  • loomgen/parse_annotations.mbt
  • scripts/check-docs-symbols.py

Comment thread check-docs.sh Outdated
Comment thread scripts/check-docs-symbols.py
@dowdiness dowdiness force-pushed the fix/702-annotation-conflict branch from f44e6b7 to 00310e3 Compare July 12, 2026 17:10
@dowdiness dowdiness merged commit 8d8866e into main Jul 12, 2026
38 checks passed
@dowdiness dowdiness deleted the fix/702-annotation-conflict branch July 12, 2026 17:50
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.

loomgen: #loom.line_pattern and #loom.pattern coexistence on same variant is unvalidated

1 participant