mirror of
https://github.com/safishamsi/graphify.git
synced 2026-08-26 16:26:42 +00:00
test(wiki): make the bracketed-label parity case non-vacuous (#2597)
The parity check keyed on the whole [display](target) pattern, so a link whose display text contains brackets (Array[T] Models) never matched and the bracket case asserted nothing. Key on the ](target) boundary instead — wiki targets contain no ) or whitespace — so bracketed labels are actually checked. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
fc00f673c6
commit
6c29d988bd
@@ -5,6 +5,7 @@ Full release notes with details on each version: [GitHub Releases](https://githu
|
||||
## 0.9.42 (unreleased)
|
||||
|
||||
- Fix: a cross-file INFERRED `uses` edge now binds to the symbol whose body actually references the imported name (a module-level function is a valid source; a co-located class that never touches the import gets no edge), instead of fanning out from the import line to every class in the importing file (#2652, thanks @ousamabenyounes). A reference at module top level, with no enclosing symbol, emits no edge.
|
||||
- Fix: a wiki article link now targets the article's filename verbatim instead of a percent-encoded twin, so a label with `( ) & #` or non-ASCII characters no longer produces a link that names no file on disk; the link and the on-disk filename share one canonicalization (#2597, thanks @abhay-codes07).
|
||||
- Feature: OCaml `.ml`/`.mli` extraction via tree-sitter-ocaml (optional `[ocaml]` extra). Extracts modules, top-level and module-level values/functions, types and their variant constructors, `open` imports, and function calls; qualified calls (`Geo.area`) resolve to the value, and cross-file `open`/call targets collapse onto the unique real definition via the corpus stub rewire.
|
||||
- Fix: a JS/TS `for...of` / `for...in` loop binding is now shadowed, so passing it as a call argument no longer fabricates an `indirect_call` edge to an unrelated same-named callable (#2685, thanks @ousamabenyounes); completes the loop/closure/catch shadow family (#2568/#2569/#2517).
|
||||
- Fix: graph provenance (`built_at_commit`) is stamped from the analysed repository rather than the shell's working directory, so `graphify extract` run from elsewhere records the target's commit, not the caller's (#2534 family; #2699, thanks @C0KERNEL).
|
||||
|
||||
@@ -20,11 +20,16 @@ import pytest
|
||||
from graphify.wiki import _safe_filename, to_wiki
|
||||
|
||||
# Deliberately does not decode: the target is compared exactly as written.
|
||||
_MD_LINK = re.compile(r"\[([^\]]+)\]\(([^)]+)\)")
|
||||
# Key on the `](target)` boundary rather than the whole `[display](target)` so a
|
||||
# display text that itself contains brackets (e.g. `Array[T] Models`) is still
|
||||
# captured — a display-anchored regex silently skips those links, making the
|
||||
# bracket case a vacuous pass. Wiki targets never contain `)` (parens are dropped
|
||||
# from the slug) or whitespace (spaces become `_`), so `[^)\s]+` is exact.
|
||||
_MD_TARGET = re.compile(r"\]\(([^)\s]+)\)")
|
||||
|
||||
|
||||
def _targets(text: str) -> list[str]:
|
||||
return [t for _d, t in _MD_LINK.findall(text) if "://" not in t]
|
||||
return [t for t in _MD_TARGET.findall(text) if "://" not in t]
|
||||
|
||||
|
||||
def _wiki(tmp_path, labels: dict[int, str], god: list[dict] | None = None):
|
||||
|
||||
Reference in New Issue
Block a user