fix: harden document fallback paths#117
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing