test: add file download resolver v2 diagnostic

This commit is contained in:
zhaoyilun
2026-07-11 00:20:15 +08:00
parent 7db022469c
commit c8b619c254
5 changed files with 310 additions and 22 deletions

View File

@@ -709,7 +709,7 @@ git push gitea main
- `-MsgLibDb` and `-SQLiteDll` accept copied DB/runtime paths when real copied DB is available; fixture tests do not require real DB files.
- `-SanitizedOutputPath` writes committed-safe JSON summary to a caller-selected output file.
- [ ] **Step 1: Add fixture test for resolver scoring**
- [x] **Step 1: Add fixture test for resolver scoring**
Fixture contains three DB-like file records and four cache-like file entries. Expected scoring:
@@ -719,15 +719,15 @@ exact size + source id in name/ref => score 80
filename only => score 40 and not accepted
```
- [ ] **Step 2: Implement scoring and sanitized output**
- [x] **Step 2: Implement scoring and sanitized output**
Output fields: `records_checked`, `cache_candidates_checked`, `accepted_matches`, `ambiguous_matches`, `raw_paths_printed=false`, `file_contents_read=false`.
- [ ] **Step 3: Write decision note**
- [x] **Step 3: Write decision note**
`docs/source-discovery/2026-07-10-file-download-mapping-v2.md` records whether accepted matches exist. If not, download remains blocked and UI/client download connector becomes the next route.
- [ ] **Step 4: Verify and commit**
- [x] **Step 4: Verify and commit**
```powershell
git diff --check
@@ -742,6 +742,14 @@ git push gitea main
**Acceptance gate:** 文件下载要么得到可实现映射,要么得到明确阻断证据。
**R10 Result:**
- Added v2 fixture scoring to `scripts/verify-file-cache-mapping.ps1`.
- Updated `scripts/test-verify-file-cache-mapping.ps1` to prove exact filename/size/time gets score 100, source-id/size gets score 80, and filename-only gets score 40 without acceptance.
- Fixture verification produced `records_checked=3`, `cache_candidates_checked=4`, `accepted_matches=2`, `ambiguous_matches=0`, `score_100_matches=1`, `score_80_matches=1`, `score_40_only_matches=1`, `raw_paths_printed=false`, and `file_contents_read=false`.
- Created `docs/source-discovery/2026-07-10-file-download-mapping-v2.md`.
- Real production file download remains blocked because this proves resolver logic, not a real iSphere cache mapping from an online package.
---
### R11: Receive-file download preview contract