fix(parser): match easy_bee bee-audit.json/runtime-health.json outside export/
bee-support v12.x bundles place bee-audit.json under tasks/_state/ and runtime-health.json under status/, not export/. Detection was path-locked to export/, dropping confidence to 50 and relying on a coincidental export/reanimator.json duplicate to find the snapshot at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
6599ab49c2
commit
99d8f098ac
+3
-3
@@ -58,12 +58,12 @@ func (p *Parser) Detect(files []parser.ExtractedFile) int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(path, "/export/bee-audit.json") || path == "bee-audit.json" {
|
if strings.HasSuffix(path, "/bee-audit.json") || path == "bee-audit.json" {
|
||||||
hasBeeAudit = true
|
hasBeeAudit = true
|
||||||
confidence += 55
|
confidence += 55
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasBundlePrefix && (strings.HasSuffix(path, "/export/runtime-health.json") || path == "runtime-health.json") {
|
if hasBundlePrefix && (strings.HasSuffix(path, "/runtime-health.json") || path == "runtime-health.json") {
|
||||||
hasRuntimeHealth = true
|
hasRuntimeHealth = true
|
||||||
confidence += 10
|
confidence += 10
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,7 @@ type manifestMetadata struct {
|
|||||||
func findSnapshotFile(files []parser.ExtractedFile) *parser.ExtractedFile {
|
func findSnapshotFile(files []parser.ExtractedFile) *parser.ExtractedFile {
|
||||||
for i := range files {
|
for i := range files {
|
||||||
path := strings.ToLower(strings.TrimSpace(files[i].Path))
|
path := strings.ToLower(strings.TrimSpace(files[i].Path))
|
||||||
if strings.HasSuffix(path, "/export/bee-audit.json") || path == "bee-audit.json" {
|
if strings.HasSuffix(path, "/bee-audit.json") || path == "bee-audit.json" {
|
||||||
return &files[i]
|
return &files[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
@@ -29,6 +29,38 @@ func TestDetectBeeSupportArchive(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestDetectBeeSupportArchiveV12Layout covers the real bundle layout produced
|
||||||
|
// by bee-support v12.x, where bee-audit.json lives under tasks/_state/ and
|
||||||
|
// runtime-health.json under status/, not export/. See CLAUDE.md memory on
|
||||||
|
// the 2026-08-24 BEE-SP v12.84 bundle for the layout this guards against.
|
||||||
|
func TestDetectBeeSupportArchiveV12Layout(t *testing.T) {
|
||||||
|
p := &Parser{}
|
||||||
|
prefix := "bee-support-stage-easy-bee-nvidia-v12-84-20260824-220134"
|
||||||
|
files := []parser.ExtractedFile{
|
||||||
|
{
|
||||||
|
Path: prefix + "/manifest.txt",
|
||||||
|
Content: []byte("bee_version=12.84\nhost=easy-bee-nvidia-v12-84\ngenerated_at_utc=2026-08-24T22:02:12Z\nexport_dir=/appdata/bee/export\n"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Path: prefix + "/tasks/_state/bee-audit.json",
|
||||||
|
Content: []byte(`{"hardware":{"board":{"serial_number":"SN-BEE-001"}}}`),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Path: prefix + "/status/runtime-health.json",
|
||||||
|
Content: []byte(`{"status":"OK"}`),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if got := p.Detect(files); got < 90 {
|
||||||
|
t.Fatalf("expected high confidence detect score for v12 layout, got %d", got)
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshot := findSnapshotFile(files)
|
||||||
|
if snapshot == nil || snapshot.Path != prefix+"/tasks/_state/bee-audit.json" {
|
||||||
|
t.Fatalf("expected findSnapshotFile to pick up tasks/_state/bee-audit.json, got %+v", snapshot)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestDetectRejectsNonBeeArchive(t *testing.T) {
|
func TestDetectRejectsNonBeeArchive(t *testing.T) {
|
||||||
p := &Parser{}
|
p := &Parser{}
|
||||||
files := []parser.ExtractedFile{
|
files := []parser.ExtractedFile{
|
||||||
|
|||||||
Reference in New Issue
Block a user