carlos / platform Public

test: name #522's conditional writers in the Apply callers guard

TestApplyCallersAreTheKnownWalks stopped finding internal/console/
apiconfig.go once the config doors moved to appconfig.ApplyIf and
ApplyEnvironmentOwnedIf, which its writer set did not name. Both are
bundle writers this branch added (same bundles, same CAS, with a version
precondition), so they join the set, apiconfig.go stays pinned, and the
default-bundle-only files are also barred from ApplyEnvironmentOwnedIf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 8e30f15c8f51c72ba557d95f7337be3a59c155c1 parent 7c4e567
1 file changed, +9 −4
  • internal/console/teamcreds_test.go +9 −4

Intent

Human

<task-notification> <task-id>b2wv095oh</task-id> <tool-use-id>toolu_01RRXtD7zBU1W8xSHduXoPJH</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/4c585ebb-d953-40f5-8f58-fbd337832024/tasks/b2wv095oh.output</output-file> <status>completed</status> <summary>Background command "Wait for CI to finish on the branch tip" completed (exit code 0)</summary> </task-notification>

diff --git a/internal/console/teamcreds_test.go b/internal/console/teamcreds_test.go
index 5b2841307..76d8e9af8 100644
--- a/internal/console/teamcreds_test.go
+++ b/internal/console/teamcreds_test.go
@@ -343,7 +343,9 @@ func TestScanRefusesAStoreBoundToAnOwnedEnvironment(t *testing.T) {
}
// TestApplyCallersAreTheKnownWalks is §8.18: every appconfig.Apply,
-// ApplyEnvironment and ApplyEnvironmentOwned caller outside
+// ApplyEnvironment and ApplyEnvironmentOwned caller (and every other bundle
+// writer named in the switch below, the conditional ApplyIf and
+// ApplyEnvironmentOwnedIf of #522 included) outside
// internal/console and internal/appconfig is one of the two walks, and
// the console's own callers are exactly the files pinned here, so a new
// writer into bundles cannot appear unreviewed.
@@ -377,7 +379,10 @@ func TestApplyCallersAreTheKnownWalks(t *testing.T) {
return true
}
switch sel.Sel.Name {
- case "Apply", "ApplyEnvironment", "ApplyEnvironmentOwned", "SetEnv", "SetSecret", "SaveEnvironment", "SetEnvironmentOwner", "ForkEnvironment", "ApplyInstance":
+ case "Apply", "ApplyEnvironment", "ApplyEnvironmentOwned", "SetEnv", "SetSecret", "SaveEnvironment", "SetEnvironmentOwner", "ForkEnvironment", "ApplyInstance",
+ // #522's conditional writers: the same bundles, the same CAS,
+ // with a version precondition and a receipt.
+ "ApplyIf", "ApplyEnvironmentOwnedIf":
if callers[rel] == nil {
callers[rel] = map[string]bool{}
}
@@ -414,7 +419,7 @@ func TestApplyCallersAreTheKnownWalks(t *testing.T) {
// events key (default bundle only), the scan callback secret (default
// bundle only), the config doors, and the ownership doors.
consoleWant := []string{
- "internal/console/apiconfig.go", // the config doors, a team's through ApplyEnvironmentOwned
+ "internal/console/apiconfig.go", // the config doors through ApplyIf, a team's through ApplyEnvironmentOwnedIf
"internal/console/apienv.go", // adopt, release and fork
"internal/console/apimail.go", // CARLOS_MAIL_EVENTS_KEY, default bundle only
"internal/console/apiscan.go", // the scan callback secret's removal, default bundle only
@@ -436,7 +441,7 @@ func TestApplyCallersAreTheKnownWalks(t *testing.T) {
// ApplyEnvironment: the scan secret and the mail-events key are not
// delivered to an owned environment.
for _, file := range []string{"internal/console/apimail.go", "internal/console/scankeysync.go", "internal/console/apiscan.go"} {
- if callers[file]["ApplyEnvironment"] || callers[file]["ApplyEnvironmentOwned"] {
+ if callers[file]["ApplyEnvironment"] || callers[file]["ApplyEnvironmentOwned"] || callers[file]["ApplyEnvironmentOwnedIf"] {
t.Errorf("%s writes a named environment; §3a delivers its value to the default bundle only", file)
}
}