Skip to content

fix: harden document fallback paths#117

Merged
lzehrung merged 1 commit into
mainfrom
fix-markdown-doc-fallbacks
Jun 3, 2026
Merged

fix: harden document fallback paths#117
lzehrung merged 1 commit into
mainfrom
fix-markdown-doc-fallbacks

Conversation

@lzehrung
Copy link
Copy Markdown
Owner

@lzehrung lzehrung commented Jun 2, 2026

Summary

  • harden markdown document-link extraction against malformed and nested link/image syntax without creating false edges
  • enforce native:on availability consistently across graph-only, cached, and symbol/detail fallback paths
  • add regressions covering malformed markdown, graph-only docs, and required-native behavior

Testing

  • npm run test:fast tests/document-links.test.ts tests/fallback-import-extraction.test.ts tests/agent-orient.test.ts tests/native-fallback-contract.test.ts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens document-link extraction and native tree-sitter fallback behavior so malformed/nested markdown link syntax doesn’t create false graph edges, and so native: "on" is enforced consistently across graph-only parsing, cached paths, and symbol/detail fallback paths.

Changes:

  • Refactors markdown reference/inline link parsing to be more robust against malformed/nested constructs and bounded rescans.
  • Introduces and wires assertNativeRequiredAvailable(...) to ensure required-native failures are not suppressed (including graph-only + cached flows).
  • Adds regression tests for malformed markdown inputs, graph-only document behavior, and required-native enforcement.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/native-fallback-contract.test.ts Adds regression coverage ensuring required-native errors propagate through locals enrichment and detailed symbol graph building.
tests/fallback-import-extraction.test.ts Ensures graph-only documents don’t produce native-query reporting, while still honoring native: "on" requirements.
tests/document-links.test.ts Expands markdown document-link regression suite for malformed/nested syntax and scan-boundary behaviors.
src/native/treeSitterNative.ts Re-exports assertNativeRequiredAvailable from the native runtime API surface.
src/native/runtime.ts Adds assertNativeRequiredAvailable helper to consistently enforce native: "on" availability checks.
src/indexer/parse-context.ts Avoids native syntax-tree execution for graph-only languages while still enforcing required-native in prepare.
src/indexer/locals-and-exports.ts Enforces required-native early and ensures required-native failures aren’t swallowed by fallback try/catch blocks.
src/indexer/build-workers.ts Prevents graph-only files from going through native worker extraction/reporting paths.
src/indexer/build-index.ts Enforces required-native at build start and forwards native mode into edge collection options consistently.
src/graphs/symbol-graph-detailed.ts Enforces required-native upfront and ensures required-native errors propagate out of detailed-edge construction.
src/graph-edge-collector.ts Enforces required-native even when serving cached edges and avoids native compact-import execution for graph-only languages.
src/documentLinks/markdown.ts Reworks markdown reference definition/link scanning to handle malformed/nested inputs and avoid false positives.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lzehrung lzehrung merged commit 8648a33 into main Jun 3, 2026
4 checks passed
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.

2 participants