Skip to content

Test Release#26

Merged
cawpea merged 8 commits into
mainfrom
develop
Jan 1, 2026
Merged

Test Release#26
cawpea merged 8 commits into
mainfrom
develop

Conversation

@cawpea

@cawpea cawpea commented Jan 1, 2026

Copy link
Copy Markdown
Owner

No description provided.

cawpea and others added 5 commits January 1, 2026 13:27
BREAKING CHANGE: The `ignoreFile` configuration no longer defaults to '.docsignore'.
To continue using .docsignore, explicitly set `ignoreFile: '.docsignore'` in your
configuration file (.coderefrc.json or package.json).

This change makes the ignore file behavior explicit rather than implicit, applying
ignore patterns only when intentionally configured. All documentation examples now
use `.gitignore` instead of `.docsignore` to reflect this generic approach.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
feat!: remove default .docsignore value from configuration
Fixed an issue where CODE_REF comments inside unclosed markdown code blocks
were not being excluded from validation. The getCodeBlockRanges() function
now detects unclosed code blocks (starting ``` without closing ```) and
treats them as code blocks from the start position to the end of the file.

Changes:
- Enhanced getCodeBlockRanges() to detect and handle unclosed code blocks
- Added comprehensive test cases for code block exclusion scenarios:
  - CODE_REF in normal code blocks
  - CODE_REF in inline code
  - CODE_REF in unclosed code blocks
  - Multiple code blocks with mixed CODE_REFs

This resolves the issue where documentation examples of CODE_REF syntax
within code blocks were incorrectly validated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Improved the getCodeBlockRanges() function to use a more robust odd/even
pairing approach instead of the previous implementation that had potential
issues with overlapping ranges.

Previous implementation issues:
- Closing backticks could be incorrectly treated as unclosed blocks
- Range check did not account for the 3-character length of triple backticks
- Could create overlapping or duplicate ranges

New implementation:
- Collects all triple backtick positions in order
- Pairs them sequentially: indices 0-1, 2-3, 4-5, etc.
- If odd number of backticks exists, the last one starts an unclosed block
- Cleaner logic with fewer edge cases

All existing tests pass (372 tests).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ck-comments

fix: exclude CODE_REF comments in unclosed code blocks from validation
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

Pull Request Review

Summary

This PR changes the default ignore file from .docsignore to no default value (was previously .docsignore in config), and includes important improvements to CODE_REF parsing to exclude references inside code blocks.

✅ Strengths

  1. Excellent Test Coverage: The new test cases in src/core/validate.test.ts (lines 165-244) thoroughly cover edge cases:

    • CODE_REFs inside code blocks
    • CODE_REFs in inline code
    • Unclosed code blocks
    • Multiple code blocks mixed with valid CODE_REFs
    • Tests use Japanese comments demonstrating i18n consideration
  2. Bug Fix - Code Block Parsing: The refactored getCodeBlockRanges() function (validate.ts:53-95) now properly handles:

    • Unclosed code blocks
    • Multiple code blocks
    • Inline code backticks
    • This is a significant improvement over the previous regex-based approach
  3. Documentation Updates: Comprehensive updates to README.md and docs/user-guide/configuration.md explaining the breaking change with migration notes

  4. Code Style Compliance: Changes follow the project's coding standards (2-space indent, single quotes, semicolons enabled)

⚠️ Issues & Concerns

1. Breaking Change Communication (High Priority)

  • Location: src/config.ts:82
  • Issue: Removing the default value for ignoreFile is a breaking change that could silently affect existing users
  • Impact: Users upgrading will lose their ignore functionality unless they explicitly set it
  • Recommendation:
    • This should be clearly marked as a breaking change in commit message (use feat! or BREAKING CHANGE: footer)
    • Consider adding a deprecation warning in a previous minor version before removal
    • The PR title "Test Release" doesn't reflect the breaking change

2. Potential Bug - Code Block Range Detection (Medium Priority)

  • Location: src/core/validate.ts:86-92
  • Issue: Inline code pattern /\[^\`\\n]+?`/g` will match backticks after processing triple backticks, potentially creating overlapping ranges
  • Example:
    // This could incorrectly detect inline code ranges within already-detected code blocks
    const codeBlockRanges = getCodeBlockRanges(content);
    // The inline code regex runs on the entire content, not excluding code blocks
  • Recommendation: Process inline code detection only outside of already-detected triple-backtick ranges, or sort and merge ranges to handle overlaps

3. Test Coverage Gap (Low Priority)

  • Missing Tests:
    • Nested backticks scenario: `typescript\ninline\n`
    • Overlapping inline code and code blocks
    • Edge case: ` (4 consecutive backticks)
  • Recommendation: Add edge case tests for complex backtick scenarios

4. Documentation Clarity (Low Priority)

  • Location: docs/user-guide/configuration.md:67
  • Issue: The note says "Prior to version 0.2.0" but doesn't specify what version introduces this change
  • Recommendation: Specify the exact version number or use "From version X.Y.Z onward"

🔒 Security Review

✅ No security concerns identified:

  • Path traversal protection remains intact (validate.ts:361)
  • No new external dependencies
  • File operations properly validated

🚀 Performance Review

✅ Performance improvements:

  • The new backtick pairing approach (O(n) single pass) is more efficient than the previous regex approach (O(n²) potential backtracking)
  • Processing inline code separately is reasonable for typical markdown files

📋 Suggested Changes

  1. Fix the breaking change communication:
    Update commit message to include BREAKING CHANGE footer or use feat! conventional commit type

  2. Fix potential range overlap bug:
    In getCodeBlockRanges(), either sort and merge ranges, or filter inline code to exclude code block ranges

  3. Add version info to migration note:
    Specify the exact version number in the migration documentation

📝 Nitpicks

  • src/cli/validate.ts:108 - "ignore patterns" (good consistency update)
  • The PR could benefit from a proper description explaining the rationale for the changes

Verdict

Conditional Approval

The code quality is good and the bug fix for code block parsing is valuable, but the breaking change needs proper communication before merging. Please address the breaking change concern (#1) and consider fixing the potential range overlap issue (#2).


🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

cawpea and others added 3 commits January 1, 2026 14:07
Fixed an issue where 4 or more backticks (````) used to wrap markdown
code blocks were not properly handled, causing CODE_REF comments inside
these blocks to be incorrectly validated.

The previous implementation only detected triple backticks (```), which
matched the first 3 characters of longer sequences like ````, leading to
incorrect pairing and false positives.

New implementation:
- Detects all backtick sequences of 3 or more characters
- Records both position and length of each sequence
- Pairs sequences only if they have matching lengths
- Supports arbitrary nesting levels (````, ``````, etc.)

Test cases added:
- 4-backtick code blocks containing 3-backtick blocks
- 5-backtick code blocks with nested structures
- Unclosed blocks with variable-length sequences

All tests pass (17 test suites, 374 tests).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ck-comments

Fix/exclude validation in code block comments
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

Code Review for PR #26: Test Release

I've reviewed this PR and here's my comprehensive feedback:

✅ Strengths

  1. Well-designed algorithm: The code block detection algorithm (src/core/validate.ts:53-129) is sophisticated and handles edge cases well:

    • Correctly pairs backtick sequences by matching lengths
    • Handles unclosed code blocks
    • Supports nested code blocks with different backtick lengths (3, 4, 5+)
  2. Comprehensive test coverage: The new tests cover multiple scenarios:

    • Code blocks with CODE_REF comments
    • Inline code exclusion
    • Unclosed code blocks
    • Nested code blocks with 4 and 5 backticks
    • Multiple mixed code blocks
  3. Good documentation: The architecture documentation (docs/architecture/overview.md:13-39) clearly explains the validation logic and algorithm.

  4. Breaking change handled properly: The removal of default .docsignore value is documented with a clear migration note in docs/user-guide/configuration.md:67-68.

🐛 Potential Issues

  1. Algorithm inefficiency (src/core/validate.ts:83-104):

    • The nested loop for pairing backtick sequences is O(n²) in the worst case
    • For documents with many code blocks, this could be slow
    • Recommendation: Consider using a stack-based approach or tracking used indices more efficiently
  2. Inline code pattern issue (src/core/validate.ts:118):

    const inlineCodePattern = /`[^`\n]+?`/g;
    • This pattern doesn't allow newlines in inline code, which is correct for markdown
    • However, the non-greedy +? could cause issues with empty backticks
    • Recommendation: Change to /[^\n]+/g` (greedy instead of non-greedy) for better performance
  3. Potential edge case (src/core/validate.ts:108-115):

    • When handling unclosed blocks, ALL unpaired sequences are treated as extending to EOF
    • This could mark multiple ranges as extending to EOF if there are multiple unpaired sequences
    • Question: Is this intentional? Should only the last unpaired sequence extend to EOF?

🔒 Security Concerns

No security issues identified. The path traversal protection at src/core/validate.ts:395-402 remains intact.

📊 Performance Concerns

  1. Multiple regex passes: The code now:

    • Scans entire content for backtick sequences (manual loop)
    • Scans for inline code patterns (regex)
    • Scans for CODE_REF patterns (regex)

    For large markdown files, consider combining these passes or adding performance benchmarks.

📝 Code Quality

  1. Code style compliance: ✅ Follows project conventions (2-space indent, single quotes, semicolons)

  2. Type safety: ✅ Proper TypeScript usage throughout

  3. Test quality: The tests use Japanese comments (e.g., line 164: コードブロック内のCODE_REFを除外すること). While this may be intentional for the project, consider:

    • Are all team members comfortable with Japanese test descriptions?
    • Should test descriptions match the language used in code comments?

🧪 Test Coverage

Coverage appears good for the new functionality:

  • ✅ Basic code block exclusion
  • ✅ Inline code exclusion
  • ✅ Unclosed blocks
  • ✅ Multiple code blocks
  • ✅ Nested blocks (4 and 5 backticks)

Potential gaps:

  • ❌ Performance tests for documents with many code blocks
  • ❌ Edge case: Mixed backtick lengths in unpaired sequences
  • ❌ Edge case: Backtick sequences at end of file
  • ❌ Edge case: CODE_REF at exact boundary of code block

📚 Documentation

  1. ✅ Configuration docs updated consistently
  2. ✅ Breaking change documented with migration guidance
  3. ✅ Architecture docs explain the new algorithm well
  4. ⚠️ Consider adding complexity analysis (time/space) to architecture docs

🔄 Breaking Changes

Config default change (src/config.ts:80-84):

  • Removed ignoreFile: '.docsignore' default
  • This is a breaking change for existing users
  • ✅ Well documented in docs/user-guide/configuration.md
  • ⚠️ Consider: Should this trigger a major version bump per semantic versioning?

📋 Recommendations

High Priority:

  1. Add test cases for the edge cases mentioned above
  2. Consider performance optimization for the pairing algorithm
  3. Clarify the unclosed block behavior (multiple unpaired sequences)

Medium Priority:
4. Add inline code comments explaining the pairing algorithm logic
5. Consider adding time complexity notes to the algorithm documentation
6. Verify that removing the default ignoreFile triggers appropriate version bump

Low Priority:
7. Consider consistency in test description language (Japanese vs English)
8. Add performance benchmarks for large markdown files

✨ Overall Assessment

This is a solid PR with well-thought-out logic and good test coverage. The code block detection algorithm is sophisticated and handles complex nesting scenarios well. The main concerns are around performance optimization and a few edge cases that should be tested. The breaking change is well-documented but should be considered for versioning.

Status: ✅ Approved with suggestions for improvement

@cawpea cawpea merged commit 3585b41 into main Jan 1, 2026
6 checks passed
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 0.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

1 participant