The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
fix(sandbox): stop asserting a retention contract the CLI does not offer
shukieshah5146be3dc8ee
diff --git a/beacon-sandbox/check/uninstall.go b/beacon-sandbox/check/uninstall.goindex 20b07654..6e57e38f 100644--- a/beacon-sandbox/check/uninstall.go+++ b/beacon-sandbox/check/uninstall.go@@ -24,9 +24,14 @@ type Removal struct {// ServiceGone is "true"/"false" when the service manager was asked, empty when it was not.ServiceGone stringServiceQuery string- // ConfigRetained and LogRetained are "true"/"false" when the path was checked, empty otherwise.- ConfigRetained string- LogRetained string+ // LogRetained is "true"/"false" when the path was checked, empty otherwise.+ //+ // Only the log. `endpoint uninstall` removes everything in its install manifest -- which includes+ // config.json and otelcol.yaml -- and --keep-config does not change that, because it governs+ // *harness* telemetry settings rather than Beacon's own configuration. Retaining that is a+ // contract the packaging layer keeps by stashing the files around a removal, so asserting it at+ // this level would fail every correct run.+ LogRetained string// Status is `endpoint status --json` after the removal, which is Beacon's own account of itself.Status string}@@ -92,26 +97,23 @@ func Uninstall(v *Verdict, r Removal) {// Retention is the other half of the contract, and it fails in the opposite direction: too much// removed rather than too little. An uninstall is often the first half of a reinstall, and- // destroying an operator's configuration and collected telemetry is a separate, deliberate act.+ // destroying collected telemetry is a separate, deliberate act.for name, retained := range map[string]string{- "configuration": r.ConfigRetained,- "runtime log": r.LogRetained,+ "runtime log": r.LogRetained,} {switch retained {case "true":v.Add(Finding{Check: "uninstall.data_retained",Severity: SevInfo,- Summary: fmt.Sprintf("%s survived the uninstall, as --keep-logs and --keep-config ask", name),+ Summary: fmt.Sprintf("the %s survived the uninstall, as --keep-logs asks", name),})case "false":v.Add(Finding{Check: "uninstall.data_retained",Severity: SevFail,- Summary: fmt.Sprintf("%s was removed despite --keep-logs and --keep-config", name),- Why: "Removing the product must not destroy what it collected unless a purge asks for " +- "it. Note that --keep-config governs harness settings rather than Beacon's own " +- "config, which is why packaging stashes those files around a removal.",+ Summary: fmt.Sprintf("the %s was removed despite --keep-logs", name),+ Why: "Removing the product must not destroy what it collected unless a purge asks for it.",})default:v.Add(Finding{diff --git a/beacon-sandbox/check/uninstall_test.go b/beacon-sandbox/check/uninstall_test.goindex 630ef88f..a1712530 100644--- a/beacon-sandbox/check/uninstall_test.go+++ b/beacon-sandbox/check/uninstall_test.go@@ -9,15 +9,14 @@ import (// status agreeing.func clean() Removal {return Removal{- Ran: "true",- ExitCode: "0",- Output: "Endpoint uninstalled",- ServiceKind: "systemd",- ServiceLabel: "beacon-collector.service",- ServiceGone: "true",- ConfigRetained: "true",- LogRetained: "true",- Status: `{"service":{"running":false}}`,+ Ran: "true",+ ExitCode: "0",+ Output: "Endpoint uninstalled",+ ServiceKind: "systemd",+ ServiceLabel: "beacon-collector.service",+ ServiceGone: "true",+ LogRetained: "true",+ Status: `{"service":{"running":false}}`,}}@@ -100,12 +99,6 @@ func TestAnUnaskedServiceQuestionIsWarnedNotPassed(t *testing.T) {// rather than too little.func TestDestroyedDataFails(t *testing.T) {r := clean()- r.ConfigRetained = "false"- if !has(findingsFor(r), "uninstall.data_retained", SevFail) {- t.Fatal("configuration destroyed by a non-purge uninstall did not fail")- }-- r = clean()r.LogRetained = "false"if !has(findingsFor(r), "uninstall.data_retained", SevFail) {t.Fatal("a runtime log destroyed by a non-purge uninstall did not fail")@@ -114,7 +107,6 @@ func TestDestroyedDataFails(t *testing.T) {func TestUncheckedRetentionIsWarnedNotPassed(t *testing.T) {r := clean()- r.ConfigRetained = ""r.LogRetained = ""findings := findingsFor(r)if has(findings, "uninstall.data_retained", SevInfo) {diff --git a/beacon-sandbox/cmd/beacon-sandbox/main.go b/beacon-sandbox/cmd/beacon-sandbox/main.goindex ff30210d..dd454add 100644--- a/beacon-sandbox/cmd/beacon-sandbox/main.go+++ b/beacon-sandbox/cmd/beacon-sandbox/main.go@@ -401,16 +401,15 @@ func judge(sc scenario.Scenario, art runner.Artifacts, creds credentials.Resolve// Read from meta rather than from a live probe, so `verify` re-judges a saved run's removal for// free exactly as it re-judges its capture.check.Uninstall(&v, check.Removal{- Ran: art.Meta["uninstall_ran"],- ExitCode: art.Meta["uninstall_rc"],- Output: art.Meta["uninstall_output"],- ServiceKind: art.Meta["service_kind"],- ServiceLabel: art.Meta["service_label"],- ServiceGone: art.Meta["uninstall_service_gone"],- ServiceQuery: art.Meta["uninstall_service_query"],- ConfigRetained: art.Meta["uninstall_config_retained"],- LogRetained: art.Meta["uninstall_log_retained"],- Status: art.Meta["uninstall_status"],+ Ran: art.Meta["uninstall_ran"],+ ExitCode: art.Meta["uninstall_rc"],+ Output: art.Meta["uninstall_output"],+ ServiceKind: art.Meta["service_kind"],+ ServiceLabel: art.Meta["service_label"],+ ServiceGone: art.Meta["uninstall_service_gone"],+ ServiceQuery: art.Meta["uninstall_service_query"],+ LogRetained: art.Meta["uninstall_log_retained"],+ Status: art.Meta["uninstall_status"],})v.Resolve()return v, log@@ -724,7 +723,7 @@ func applyMutation(path, mode string) (mutated string, planted string, err error}default:return "", "", fmt.Errorf("unknown mutation %q (want drop-commands, drop-action:<action>, "+- "corrupt-line, plant-secret, leave-service, or drop-retained-config)", mode)+ "corrupt-line, plant-secret, leave-service, or drop-retained-log)", mode)}// The shared post-condition: the log must differ from what it was. Compared on the trimmed@@ -856,9 +855,9 @@ func applyMetaMutation(meta map[string]string, mode string) bool {// service stays registered and starts at boot.meta["uninstall_service_gone"] = "false"return true- case "drop-retained-config":- // The opposite direction: a removal that took the operator's configuration with it.- meta["uninstall_config_retained"] = "false"+ case "drop-retained-log":+ // The opposite direction: a removal that took the collected telemetry with it.+ meta["uninstall_log_retained"] = "false"return true}return falsediff --git a/beacon-sandbox/cmd/beacon-sandbox/mutation_meta_test.go b/beacon-sandbox/cmd/beacon-sandbox/mutation_meta_test.goindex 3d3c305a..87548455 100644--- a/beacon-sandbox/cmd/beacon-sandbox/mutation_meta_test.go+++ b/beacon-sandbox/cmd/beacon-sandbox/mutation_meta_test.go@@ -4,7 +4,7 @@ import "testing"// The meta mutations must turn a clean removal into a failure, or they prove nothing.func TestMetaMutationsInvertARecordedRemoval(t *testing.T) {- for _, mode := range []string{"leave-service", "drop-retained-config"} {+ for _, mode := range []string{"leave-service", "drop-retained-log"} {meta := map[string]string{"uninstall_ran": "true","uninstall_service_gone": "true",@@ -13,7 +13,7 @@ func TestMetaMutationsInvertARecordedRemoval(t *testing.T) {if !applyMetaMutation(meta, mode) {t.Fatalf("%s was not recognised as a meta mutation", mode)}- if meta["uninstall_service_gone"] == "true" && meta["uninstall_config_retained"] == "true" {+ if meta["uninstall_service_gone"] == "true" && meta["uninstall_log_retained"] == "true" {t.Fatalf("%s changed nothing", mode)}}diff --git a/beacon-sandbox/runner/runner.go b/beacon-sandbox/runner/runner.goindex a0c16ddc..5fdf1ff6 100644--- a/beacon-sandbox/runner/runner.go+++ b/beacon-sandbox/runner/runner.go@@ -922,15 +922,20 @@ func probeUninstall(ctx context.Context, g guest, sc scenario.Scenario,label := art.Meta["service_label"]kind := art.Meta["service_kind"]- // Config and log paths come from the install status, so the probe checks the paths Beacon- // actually used rather than the ones the scenario assumed.- configPath := art.Meta["install_config_path"]+ // The log path comes from the install status, so the probe checks the path Beacon actually used+ // rather than the one the scenario assumed.+ //+ // The endpoint config is deliberately not checked. `endpoint uninstall` removes everything in its+ // install manifest, which includes config.json and otelcol.yaml, and --keep-config does not change+ // that -- it governs *harness* telemetry settings. Retaining Beacon's own config is a contract the+ // packaging layer keeps by stashing those files around a removal, not one the CLI offers, so+ // asserting it here would fail every correct run.logPath := art.Meta["install_log_path"]- // --keep-logs and --keep-config, because that is the contract a package removal keeps: an- // uninstall is often the first half of a reinstall, and destroying collected telemetry is a- // separate, deliberate act. Asserting the retention is half of what this probe is for.- r, err := g.Exec(ctx, "beacon endpoint uninstall "+scope+" --keep-logs --keep-config 2>&1", opts)+ // --keep-logs, because keeping collected telemetry through a removal is a real contract: an+ // uninstall is often the first half of a reinstall. Asserting that it held is half of what this+ // probe is for; the other half is that the service actually went.+ r, err := g.Exec(ctx, "beacon endpoint uninstall "+scope+" --keep-logs 2>&1", opts)art.Meta["uninstall_ran"] = "true"art.Meta["uninstall_output"] = oneLine(r.Stdout + r.Stderr)art.Meta["uninstall_rc"] = fmt.Sprintf("%d", r.ExitCode)@@ -956,17 +961,11 @@ func probeUninstall(ctx context.Context, g guest, sc scenario.Scenario,art.Meta["uninstall_service_kind_supervised"] = "true"}- // Retention, asked of the filesystem. Absent paths are reported as unknown rather than as- // retained: a check that cannot see the file must not conclude it survived.- for key, path := range map[string]string{- "uninstall_config_retained": configPath,- "uninstall_log_retained": logPath,- } {- if path == "" {- continue- }- e, _ := g.Exec(ctx, sh.PathExists(path), opts)- art.Meta[key] = fmt.Sprintf("%v", e.ExitCode == 0)+ // Retention, asked of the filesystem. An absent path is reported as unknown rather than as+ // retained: a check that could not look must not conclude the file survived.+ if logPath != "" {+ e, _ := g.Exec(ctx, sh.PathExists(logPath), opts)+ art.Meta["uninstall_log_retained"] = fmt.Sprintf("%v", e.ExitCode == 0)}// Beacon's own account of itself, recorded alongside the machine's. When the two disagree, that