Private
Public Access
artifacts
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import json
|
||||
d = json.load(open('tests/artifacts/PHASE1_AUDIT_BASELINE.json'))
|
||||
MIG = {"INTERNAL_BROAD_CATCH", "INTERNAL_SILENT_SWALLOW", "INTERNAL_OPTIONAL_RETURN", "INTERNAL_RETHROW", "UNCLEAR"}
|
||||
EXPECTED = {
|
||||
"src\\mcp_client.py": (40, 5, 0, 0, 1, 46),
|
||||
"src\\ai_client.py": (17, 9, 0, 7, 0, 33),
|
||||
"src\\rag_engine.py": (5, 1, 0, 3, 0, 9),
|
||||
}
|
||||
for f in d['files']:
|
||||
fn = f.get('filename', '')
|
||||
if fn in EXPECTED:
|
||||
cats = {}
|
||||
for finding in f.get('findings', []):
|
||||
cat = finding.get('category', '?')
|
||||
cats[cat] = cats.get(cat, 0) + 1
|
||||
bc = cats.get('INTERNAL_BROAD_CATCH', 0)
|
||||
ss = cats.get('INTERNAL_SILENT_SWALLOW', 0)
|
||||
opt = cats.get('INTERNAL_OPTIONAL_RETURN', 0)
|
||||
rethrow = cats.get('INTERNAL_RETHROW', 0)
|
||||
unclear = cats.get('UNCLEAR', 0)
|
||||
mig = bc + ss + opt + rethrow + unclear
|
||||
exp = EXPECTED[fn]
|
||||
print(f"{fn}: BC={bc} SS={ss} OPT={opt} RETHROW={rethrow} UNCLEAR={unclear} MIG={mig} | expected MIG={exp[5]}")
|
||||
# Also show what categories DO exist
|
||||
if any(v > 0 for v in [bc, ss, opt, rethrow, unclear]):
|
||||
pass
|
||||
else:
|
||||
print(f" NO migration-target categories found! Top 5 categories:")
|
||||
for cat, n in sorted(cats.items(), key=lambda x: -x[1])[:5]:
|
||||
print(f" {cat}: {n}")
|
||||
@@ -0,0 +1,12 @@
|
||||
import json
|
||||
d = json.load(open('tests/artifacts/PHASE1_AUDIT_BASELINE.json'))
|
||||
print('Schema check:')
|
||||
print(' data["files"] is', type(d.get('files')).__name__)
|
||||
if isinstance(d.get('files'), list) and d['files']:
|
||||
f = d['files'][0]
|
||||
print(' First file keys:', list(f.keys())[:10] if isinstance(f, dict) else 'NOT A DICT')
|
||||
print(' First file:', repr(f)[:300])
|
||||
# check by_kind
|
||||
print('by_kind:', d.get('by_kind'))
|
||||
# check by_category
|
||||
print('by_category keys:', list(d.get('by_category', {}).keys())[:5])
|
||||
@@ -0,0 +1,12 @@
|
||||
with open(r"C:\projects\manual_slop_tier2\src\rag_engine.py", "r", encoding="utf-8", newline="") as f:
|
||||
content = f.read()
|
||||
# Fix the leading space on line 260
|
||||
old = " )\n\n def _check_existing_index_result(self, file_path: str, mtime: float) -> Result[bool]:"
|
||||
new = " )\n\ndef _check_existing_index_result(self, file_path: str, mtime: float) -> Result[bool]:"
|
||||
if old in content:
|
||||
content = content.replace(old, new)
|
||||
with open(r"C:\projects\manual_slop_tier2\src\rag_engine.py", "w", encoding="utf-8", newline="") as f:
|
||||
f.write(content)
|
||||
print("Fixed line 260 leading space")
|
||||
else:
|
||||
print("Pattern not found")
|
||||
@@ -0,0 +1,22 @@
|
||||
import json
|
||||
d = json.load(open('tests/artifacts/PHASE1_AUDIT_BASELINE.json'))
|
||||
for f in d['files']:
|
||||
if 'mcp_client' in f.get('filename', ''):
|
||||
print('mcp_client findings count:', len(f['findings']))
|
||||
for finding in f['findings'][:5]:
|
||||
print(' ', finding)
|
||||
break
|
||||
ai = None
|
||||
for f in d['files']:
|
||||
if 'ai_client' in f.get('filename', ''):
|
||||
ai = f
|
||||
break
|
||||
if ai:
|
||||
print('ai_client findings count:', len(ai['findings']))
|
||||
rag = None
|
||||
for f in d['files']:
|
||||
if 'rag_engine' in f.get('filename', ''):
|
||||
rag = f
|
||||
break
|
||||
if rag:
|
||||
print('rag_engine findings count:', len(rag['findings']))
|
||||
@@ -0,0 +1,12 @@
|
||||
$files = @(
|
||||
"C:\projects\manual_slop_tier2\tests\test_ts_c_tools.py",
|
||||
"C:\projects\manual_slop_tier2\tests\test_ts_cpp_tools.py"
|
||||
)
|
||||
foreach ($f in $files) {
|
||||
$c = Get-Content $f -Raw
|
||||
$c = $c -replace 'original_resolve = mcp_client\._resolve_and_check', 'original_resolve = mcp_client._resolve_and_check_result'
|
||||
$c = $c -replace 'mcp_client\._resolve_and_check = lambda path: \(Path\(path\), None\)', 'mcp_client._resolve_and_check_result = lambda path: __import__("src").mcp_client.Result(data=Path(path), errors=[])'
|
||||
$c = $c -replace 'mcp_client\._resolve_and_check = original_resolve', 'mcp_client._resolve_and_check_result = original_resolve'
|
||||
[System.IO.File]::WriteAllText($f, $c, [System.Text.UTF8Encoding]::new($false))
|
||||
}
|
||||
"Done updating test files."
|
||||
Reference in New Issue
Block a user