Skip to content

Commit 0e20067

Browse files
committed
fixes to find_in_file and CI report format error
1 parent fc2013b commit 0e20067

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

.github/workflows/claude-nl-suite.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,10 @@ jobs:
816816
817817
def id_from_filename(p: Path):
818818
n = p.name
819-
m = re.match(r'NL(\d+)_results\.xml$', n, re.I)
819+
m = re.match(r'NL-?(\d+)_results\.xml$', n, re.I)
820820
if m:
821821
return f"NL-{int(m.group(1))}"
822-
m = re.match(r'T([A-J])_results\.xml$', n, re.I)
822+
m = re.match(r'T-?([A-J])_results\.xml$', n, re.I)
823823
if m:
824824
return f"T-{m.group(1).upper()}"
825825
return None
@@ -863,10 +863,10 @@ jobs:
863863
seen = set()
864864
def id_from_filename(p: Path):
865865
n = p.name
866-
m = re.match(r'NL(\d+)_results\.xml$', n, re.I)
866+
m = re.match(r'NL-?(\d+)_results\.xml$', n, re.I)
867867
if m:
868868
return f"NL-{int(m.group(1))}"
869-
m = re.match(r'T([A-J])_results\.xml$', n, re.I)
869+
m = re.match(r'T-?([A-J])_results\.xml$', n, re.I)
870870
if m:
871871
return f"T-{m.group(1).upper()}"
872872
return None

Server/src/services/tools/find_in_file.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ async def find_in_file(
7373
max_results: Annotated[int, "Cap results to avoid huge payloads"] = 200,
7474
ignore_case: Annotated[bool | str | None, "Case insensitive search"] = True,
7575
) -> dict[str, Any]:
76+
# project_root is currently unused but kept for interface consistency
7677
unity_instance = get_unity_instance_from_context(ctx)
7778
await ctx.info(
7879
f"Processing find_in_file: {uri} (unity_instance={unity_instance or 'default'})")
@@ -100,7 +101,7 @@ async def find_in_file(
100101
try:
101102
contents = base64.b64decode(data.get("encodedContents", "").encode(
102103
"utf-8")).decode("utf-8", "replace")
103-
except Exception:
104+
except (ValueError, TypeError, base64.binascii.Error):
104105
contents = contents or ""
105106

106107
if contents is None:
@@ -120,18 +121,6 @@ async def find_in_file(
120121
except re.error as e:
121122
return {"success": False, "message": f"Invalid regex pattern: {e}"}
122123

123-
matches = []
124-
lines = contents.splitlines()
125-
126-
# Helper to map index to line number
127-
def get_line_number(index, content_lines):
128-
# This is a bit slow for large files if we do it for every match,
129-
# but robust.
130-
# Better: iterate matches and count newlines?
131-
# Or just search line by line?
132-
# Searching line by line is safer for line-based results, but regex might span lines.
133-
pass
134-
135124
# If the regex is not multiline specific (doesn't contain \n literal match logic),
136125
# we could iterate lines. But users might use multiline regexes.
137126
# Let's search the whole content and map back to lines.

0 commit comments

Comments
 (0)