From 99d8f098ac563af98b985cb0af6eb4ae280d18c1 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Mon, 24 Aug 2026 17:22:24 +0300 Subject: [PATCH] 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 --- internal/parser/vendors/easy_bee/parser.go | 6 ++-- .../parser/vendors/easy_bee/parser_test.go | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/internal/parser/vendors/easy_bee/parser.go b/internal/parser/vendors/easy_bee/parser.go index 5274db7..80fba4e 100644 --- a/internal/parser/vendors/easy_bee/parser.go +++ b/internal/parser/vendors/easy_bee/parser.go @@ -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 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 confidence += 10 } @@ -267,7 +267,7 @@ type manifestMetadata struct { func findSnapshotFile(files []parser.ExtractedFile) *parser.ExtractedFile { for i := range files { 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] } } diff --git a/internal/parser/vendors/easy_bee/parser_test.go b/internal/parser/vendors/easy_bee/parser_test.go index 5ad0aae..b8e9298 100644 --- a/internal/parser/vendors/easy_bee/parser_test.go +++ b/internal/parser/vendors/easy_bee/parser_test.go @@ -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) { p := &Parser{} files := []parser.ExtractedFile{