console: branch review P2 fixes for secrets slice 2
P2-1: unresolved_routes on the config door's restart wire carries the classifier's whole Unresolved bucket; the CLI prints it and drops duplicate legacy lines. P2-2: no host facts from incomplete box reports. P2-4: no-JS save bar override wins over [hidden]. P2-5: CLI Self and sidecar lines no longer claim restart behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apimode.go+5 −0appconfig_cli.go+21 −4appconfig_cli_test.go+63 −2internal/console/apiconfig.go+10 −0internal/console/apiconfigrestart_test.go+37 −0internal/console/configreach.go+8 −0internal/console/envform_test.go+37 −7internal/console/templates/app_settings.html+1 −1internal/console/testdata/configseal_browser.mjs+10 −3
CI failed — run details
Intent
<task-notification> <task-id>ac8b7cbdf42d58772</task-id> <tool-use-id>toolu_011JHDeZc2iyeZgCV3fP18yL</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/abe35d56-e4c2-40df-9005-6e66b76b1f50/tasks/ac8b7cbdf42d58772.output</output-file> <status>completed</status> <summary>Agent "Fix round 2: refuse on read failure" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: done. A bundle read that fails inside the write now gets its own refusal code, configRefusalRead. The JSON door returns the same 502 and message as before. On the form, Save then shows the section unavailable (409, no form, nothing submitted shown, CouldNotRead + Try again), while a failed write still keeps the draft. Commits: b3ac5cd3 for round 3, on top of 3eaf36e5. git printed a `packed-refs.lock` error during the commit, probably another session's git; the branch does point at b3ac5cd3 and the tree is clean. The report is appended to `task-8-report.md`, which stays uncommitted because `.superpowers` is gitignored. Tests: new TestEnvSaveLateBundleReadRefused covers the default and `staging` targets through configPutBeforeApply (no write, nothing shown) and checks a failed write still keeps the draft. Undoing the fix makes it fail. Your command passed in 38.2s; gofmt and vet are clean. Concerns: none.</result> <usage><subagent_tokens>140144</subagent_tokens><tool_uses>9</tool_uses><duration_ms>213812</duration_ms></usage> </task-notification>
<task-notification> <task-id>br7cplhnc</task-id> <tool-use-id>toolu_01XDt9Ex6XJNCBvVXvvToZTt</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/abe35d56-e4c2-40df-9005-6e66b76b1f50/tasks/br7cplhnc.output</output-file> <status>completed</status> <summary>Background command "until [ -f .superpowers/sdd/2026-11-08-console-secrets/astra-branch.done ]; do sleep 30; done; tail -2 .superpowers/sdd/2026-11-08-console-secrets/astra-branch-findings.md; amadan ci status carlos/platform -branch design-console-secrets 2>&1 | head -3" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>a7ac88b64bfa769fc</task-id> <tool-use-id>toolu_01VdMCeqBifgM479EqCSikgy</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/abe35d56-e4c2-40df-9005-6e66b76b1f50/tasks/a7ac88b64bfa769fc.output</output-file> <status>completed</status> <summary>Agent "Branch review fix wave + CI" is waiting on its own background work</summary> <note>This agent stopped with background work of its own still running. It may resume on its own when that work completes or reports, and the same task-id notifies again if it does; the result below may be interim.</note> <result>Waiting on the console suite.</result> <usage><subagent_tokens>139808</subagent_tokens><tool_uses>64</tool_uses><duration_ms>1004649</duration_ms></usage> </task-notification>
Attributed to this commit: 6.38 g CO₂e (802,726 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-console-secrets, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/apimode.go b/apimode.go| index e6ba404e7..8c136a61f 100644 |
| --- a/apimode.go |
| +++ b/apimode.go |
| @@ -3066,6 +3066,11 @@ type apiConfigRestart struct { |
| Yours []apiConfigReachHost `json:"yours,omitempty"` |
| Starting []apiConfigReachHost `json:"starting,omitempty"` |
| Unseen []string `json:"unseen,omitempty"` |
| + // UnresolvedRoutes is the classifier's whole Unresolved bucket, |
| + // additive: routes whose settings the console could not work out. When |
| + // present, a legacy Unresolved line for a host it names is not printed |
| + // again. |
| + UnresolvedRoutes []apiConfigReachHost `json:"unresolved_routes,omitempty"` |
| } |
| // apiConfigReachHost is one route in a bucket: How on Yours ("addr", |
diff --git a/appconfig_cli.go b/appconfig_cli.go| index 6952f493e..50ac6acc4 100644 |
| --- a/appconfig_cli.go |
| +++ b/appconfig_cli.go |
| @@ -46,12 +46,13 @@ type restartAnswer struct { |
| // Direct mode leaves them empty and prints the legacy notice. |
| self, yours, starting []apiConfigReachHost |
| unseen []string |
| + unresolved []apiConfigReachHost |
| } |
| // buckets reports whether the answer carries the classifier's buckets, in |
| // which case they are printed in place of pending.Hosts. |
| func (a *restartAnswer) buckets() bool { |
| - return len(a.self) > 0 || len(a.yours) > 0 || len(a.starting) > 0 || len(a.unseen) > 0 |
| + return len(a.self) > 0 || len(a.yours) > 0 || len(a.starting) > 0 || len(a.unseen) > 0 || len(a.unresolved) > 0 |
| } |
| // restartFromAPI converts the console's answer, preserving the nil case. |
| @@ -69,6 +70,7 @@ func restartFromAPI(r *apiConfigRestart) *restartAnswer { |
| out.pending.Blocked = append(out.pending.Blocked, appconfig.BlockedHost{Host: b.Host, Reason: b.Reason}) |
| } |
| out.self, out.yours, out.starting, out.unseen = r.Self, r.Yours, r.Starting, r.Unseen |
| + out.unresolved = r.UnresolvedRoutes |
| return out |
| } |
| @@ -128,7 +130,7 @@ func printRestartNotice(w io.Writer, app string, a *restartAnswer) { |
| // names (a route the classifier sent elsewhere, such as an addr route |
| // whose config file name collides) is still printed the old way, so a |
| // newer console never makes a host vanish from the notice. |
| - named := map[string]bool{} |
| + named, unresolved := map[string]bool{}, map[string]bool{} |
| if a.buckets() { |
| for _, h := range a.self { |
| named[h.Host] = true |
| @@ -154,6 +156,14 @@ func printRestartNotice(w io.Writer, app string, a *restartAnswer) { |
| named[h] = true |
| fmt.Fprintf(w, "%s %s\n", c.warn("note:"), fmt.Sprintf(restartCopyUnseen, h)) |
| } |
| + // The classifier's whole Unresolved bucket. Its hosts are named, |
| + // so neither a legacy Hosts line nor a legacy Unresolved line for |
| + // the same host is printed below. |
| + for _, h := range a.unresolved { |
| + named[h.Host] = true |
| + unresolved[h.Host] = true |
| + fmt.Fprintf(w, "%s %s\n", c.warn("note:"), fmt.Sprintf(restartCopyCouldNotWorkOut, h.Host)) |
| + } |
| } |
| for _, h := range a.pending.Hosts { |
| if named[h.Host] { |
| @@ -166,6 +176,9 @@ func printRestartNotice(w io.Writer, app string, a *restartAnswer) { |
| fmt.Fprintf(w, "%s %s\n", c.warn("note:"), line) |
| } |
| for _, h := range a.pending.Unresolved { |
| + if unresolved[h] { |
| + continue |
| + } |
| fmt.Fprintf(w, "%s %s\n", c.warn("note:"), fmt.Sprintf(restartCopyUnresolved, h)) |
| } |
| for _, h := range a.pending.Undelivered { |
| @@ -219,11 +232,15 @@ const ( |
| restartCopyBlocked = "delivery to %s is blocked: %s" |
| // The classifier's buckets, from a console that sends them. Not yet |
| // through a copy pass. |
| - restartCopySelf = "%s will get the new values. carlos will restart it." |
| - restartCopyYoursSidecar = "the settings file will reach %s, but carlos will not restart it. check that it is running the new values." |
| + restartCopySelf = "%s will get the new values. carlos expects it to restart by itself, or to pick them up when it next wakes." |
| + restartCopyYoursSidecar = "%s is a background worker. carlos can't tell from here whether it has picked up the new values. check that it is running them, and restart the app if not." |
| restartCopyAsleep = "%s is asleep. it will pick up the new values when it wakes." |
| restartCopyStarting = "%s is not running. it will pick up the new values when it starts." |
| restartCopyUnseen = "could not tell whether %s got the new values. it is not listed on this machine." |
| + // The classifier's Unresolved bucket: a missing or unreadable bound |
| + // bundle, a config name another route owns, an overlay that will not |
| + // read. The page's "Couldn't check" in CLI words. |
| + restartCopyCouldNotWorkOut = "could not tell whether %s will get the new values. carlos could not work out the settings it would get." |
| ) |
| const envUsage = `usage: carlos env <command> |
diff --git a/appconfig_cli_test.go b/appconfig_cli_test.go| index 2420498c9..395e216f0 100644 |
| --- a/appconfig_cli_test.go |
| +++ b/appconfig_cli_test.go |
| @@ -7,6 +7,7 @@ package main |
| import ( |
| "bytes" |
| + "encoding/json" |
| "strings" |
| "testing" |
| ) |
| @@ -58,7 +59,7 @@ func TestRestartNoticeNewBuckets(t *testing.T) { |
| order := []string{ |
| "sock.shop.example.com will get the new values", |
| "addr.shop.example.com has the file but is still running the old values", |
| - "the settings file will reach worker.shop.example.com, but carlos will not restart it", |
| + "worker.shop.example.com is a background worker. carlos can't tell from here whether it has picked up the new values", |
| "nap.shop.example.com is asleep", |
| "boot.shop.example.com is not running", |
| "could not tell whether remote.shop.example.com got the new values. it is not listed on this machine.", |
| @@ -86,7 +87,7 @@ func TestRestartNoticeNewBuckets(t *testing.T) { |
| t.Errorf("output has %d lines, want %d:\n%s", n, len(order), got) |
| } |
| for _, dash := range []string{"\u2014", "\u2013"} { |
| - for _, s := range []string{restartCopySelf, restartCopyYoursSidecar, restartCopyAsleep, restartCopyStarting, restartCopyUnseen} { |
| + for _, s := range []string{restartCopySelf, restartCopyYoursSidecar, restartCopyAsleep, restartCopyStarting, restartCopyUnseen, restartCopyCouldNotWorkOut} { |
| if strings.Contains(s, dash) { |
| t.Errorf("copy %q carries a dash", s) |
| } |
| @@ -104,3 +105,63 @@ func TestRestartNoticeBucketsAloneAreNotEmpty(t *testing.T) { |
| t.Fatalf("bucket-only answer printed %q", b.String()) |
| } |
| } |
| + |
| +// TestRestartNoticeUnresolvedRoutes (branch review P2-1): the console's |
| +// whole Unresolved bucket is printed, each host once, and a legacy |
| +// Unresolved or Hosts line for a host it names is not printed again; a |
| +// legacy Unresolved host it does not name still is. The JSON is the |
| +// console's wire shape (reachWire; TestEnvOutcomeMatchesCLIWire pins the |
| +// console side of the same names). |
| +func TestRestartNoticeUnresolvedRoutes(t *testing.T) { |
| + raw := `{"known":true, |
| + "hosts":[{"host":"clash.shop.example.com"}], |
| + "unresolved":["bound.shop.example.com","old.shop.example.com"], |
| + "unresolved_routes":[{"host":"bound.shop.example.com"},{"host":"clash.shop.example.com"},{"host":"gone.shop.example.com"}]}` |
| + var r apiConfigRestart |
| + if err := json.Unmarshal([]byte(raw), &r); err != nil { |
| + t.Fatal(err) |
| + } |
| + var b bytes.Buffer |
| + printRestartNotice(&b, "relay", restartFromAPI(&r)) |
| + want := "note: could not tell whether bound.shop.example.com will get the new values. carlos could not work out the settings it would get.\n" + |
| + "note: could not tell whether clash.shop.example.com will get the new values. carlos could not work out the settings it would get.\n" + |
| + "note: could not tell whether gone.shop.example.com will get the new values. carlos could not work out the settings it would get.\n" + |
| + "note: could not tell whether old.shop.example.com picked this up. Its config bundle would not load.\n" + |
| + restartCopyScope + "\n" |
| + if got := b.String(); got != want { |
| + t.Fatalf("notice:\n%s\nwant:\n%s", got, want) |
| + } |
| + // Unresolved alone is still a notice: the classifier said something. |
| + b.Reset() |
| + printRestartNotice(&b, "relay", restartFromAPI(&apiConfigRestart{Known: true, |
| + UnresolvedRoutes: []apiConfigReachHost{{Host: "bound.shop.example.com"}}})) |
| + if !strings.Contains(b.String(), "bound.shop.example.com will get the new values. carlos could not work out") { |
| + t.Fatalf("unresolved-only answer printed %q", b.String()) |
| + } |
| +} |
| + |
| +// TestRestartNoticeClaimsNoMoreThanItKnows (branch review P2-5): the CLI |
| +// classifies over local facts only (no management, no sleep), so the Self |
| +// line is an expectation that covers a next wake, and the sidecar line |
| +// never says carlos will not restart it. |
| +func TestRestartNoticeClaimsNoMoreThanItKnows(t *testing.T) { |
| + var b bytes.Buffer |
| + printRestartNotice(&b, "relay", restartFromAPI(&apiConfigRestart{Known: true, |
| + Self: []apiConfigReachHost{{Host: "sock.shop.example.com"}}, |
| + Yours: []apiConfigReachHost{{Host: "worker.shop.example.com", How: "sidecar"}}, |
| + })) |
| + got := b.String() |
| + for _, want := range []string{ |
| + "note: sock.shop.example.com will get the new values. carlos expects it to restart by itself, or to pick them up when it next wakes.\n", |
| + "note: worker.shop.example.com is a background worker. carlos can't tell from here whether it has picked up the new values. check that it is running them, and restart the app if not.\n", |
| + } { |
| + if !strings.Contains(got, want) { |
| + t.Errorf("notice lacks %q:\n%s", want, got) |
| + } |
| + } |
| + for _, over := range []string{"will restart it", "will not restart", "won't restart", "does not restart"} { |
| + if strings.Contains(got, over) { |
| + t.Errorf("notice claims %q from local facts:\n%s", over, got) |
| + } |
| + } |
| +} |
diff --git a/internal/console/apiconfig.go b/internal/console/apiconfig.go| index 8dbb8b2be..346b33d03 100644 |
| --- a/internal/console/apiconfig.go |
| +++ b/internal/console/apiconfig.go |
| @@ -563,6 +563,15 @@ type apiConfigRestart struct { |
| Yours []apiConfigReachHost `json:"yours,omitempty"` |
| Starting []apiConfigReachHost `json:"starting,omitempty"` |
| Unseen []string `json:"unseen,omitempty"` |
| + // UnresolvedRoutes is the classifier's whole Unresolved bucket: routes |
| + // whose settings could not be worked out (a bound bundle that is |
| + // missing or will not read, a config name another route owns, an |
| + // overlay that will not read). Additive and omitted when empty; the |
| + // legacy Unresolved above is unchanged for older CLIs, and names only |
| + // the subset its old predicates reach, so a newer CLI prints this one |
| + // and drops a legacy line for a host it names. Its JSON name is not |
| + // "unresolved" because the legacy field already holds that name. |
| + UnresolvedRoutes []apiConfigReachHost `json:"unresolved_routes,omitempty"` |
| } |
| // apiConfigReachHost is one route in a bucket. How is set on Yours ("addr", |
| @@ -611,6 +620,7 @@ func reachWire(r appconfig.WriteReach) apiConfigRestart { |
| out.Yours = reachHostsWire(r.Yours) |
| out.Starting = reachHostsWire(r.Starting) |
| out.Unseen = r.Unseen |
| + out.UnresolvedRoutes = reachHostsWire(r.Unresolved) |
| return out |
| } |
diff --git a/internal/console/apiconfigrestart_test.go b/internal/console/apiconfigrestart_test.go| index 9b83a0d7e..03242c21b 100644 |
| --- a/internal/console/apiconfigrestart_test.go |
| +++ b/internal/console/apiconfigrestart_test.go |
| @@ -320,3 +320,40 @@ func TestReachFactsFromRecordsAndReports(t *testing.T) { |
| t.Fatalf("hosts = %+v, want %+v", f.Hosts, want) |
| } |
| } |
| + |
| +// TestReachFactsIncompleteReportsAreUnknown (branch review P2-2): a fresh, |
| +// qualifying managed-and-asleep report beside a box snapshot that will not |
| +// decode is an incomplete read, so no host fact is recorded at all (the |
| +// unreadable box could hold a newer word). The records are still listed. |
| +func TestReachFactsIncompleteReportsAreUnknown(t *testing.T) { |
| + fx, _ := configFixture(t, "code-reach-partial") |
| + ctx := context.Background() |
| + created := time.Now().UTC().Add(-time.Hour) |
| + if err := provision.CreateRecord(ctx, fx.rel, provision.Record{Schema: 1, Host: "asleep.shop.example.com", Slug: "asleep", |
| + App: "titogo", Account: "bab", Channel: "stable", CreatedAt: created, CreatedBy: "paul@keymail.dev"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + box := status.CollectBox(nil, status.Probes{MachineID: "box1"}, time.Now()) |
| + box.Metrics = &status.BoxMetrics{Rollout: &status.RolloutReport{Hosts: map[string]status.HostRollout{ |
| + "asleep.shop.example.com": {Account: "bab", App: "titogo", Managed: true}, |
| + }}} |
| + if err := status.WriteBox(ctx, fx.rel, box); err != nil { |
| + t.Fatal(err) |
| + } |
| + // The qualifying report alone gives the fact: the guard below is the |
| + // unreadable box, nothing else. |
| + if f := fx.srv.reachFacts(ctx, "bab", "titogo"); !f.Hosts["asleep.shop.example.com"].Asleep { |
| + t.Fatalf("hosts = %+v, want the readable report's asleep fact before the broken box", f.Hosts) |
| + } |
| + if _, err := fx.rel.Put(ctx, "status/boxes/broken.json", []byte("{not json"), ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + fx.srv.boxReports.invalidate() |
| + f := fx.srv.reachFacts(ctx, "bab", "titogo") |
| + if !f.RecordsComplete || len(f.Records) != 1 { |
| + t.Fatalf("records = %+v complete=%v, want the one record, complete", f.Records, f.RecordsComplete) |
| + } |
| + if len(f.Hosts) != 0 { |
| + t.Fatalf("hosts = %+v, want none: an incomplete read is unknown", f.Hosts) |
| + } |
| +} |
diff --git a/internal/console/configreach.go b/internal/console/configreach.go| index 75e7545a0..cd63ddf64 100644 |
| --- a/internal/console/configreach.go |
| +++ b/internal/console/configreach.go |
| @@ -30,8 +30,16 @@ func (s *Server) reachFacts(ctx context.Context, acct, app string) appconfig.Rea |
| return facts |
| } |
| remote := s.remoteFacts(ctx, acct, app) |
| + // A box report that did not read could hold a newer word about any |
| + // host (a move in flight): an incomplete read is unknown for every |
| + // host, never asleep or managed (spec: incomplete reports mean |
| + // unknown). The records are still collected. |
| + reportsOK := remote.complete() |
| for _, rec := range recs { |
| facts.Records = append(facts.Records, appconfig.ReachRecord{Host: rec.Host, Environment: rec.Environment}) |
| + if !reportsOK { |
| + continue |
| + } |
| rep := remote.host(rec) |
| if rep == nil { |
| continue |
diff --git a/internal/console/envform_test.go b/internal/console/envform_test.go| index 629c74519..f347ee67d 100644 |
| --- a/internal/console/envform_test.go |
| +++ b/internal/console/envform_test.go |
| @@ -387,7 +387,7 @@ func TestEnvFormStageAddRemoveUndoDiscard(t *testing.T) { |
| t.Fatalf("discard = %d", status) |
| } |
| mustNotContain(t, body, `<div class="savebar">`, "newenv.", `name="new.`, `name="bundle" value="default"`) |
| - mustContain(t, body, `<div class="savebar" hidden>`, "<noscript><style>.savebar[hidden]") |
| + mustContain(t, body, `<div class="savebar" hidden>`, "<noscript><style>form[data-env-form] .savebar[hidden] { display: flex !important; }") |
| // Save is envsave_test.go's. |
| e.spy.none(t) |
| @@ -676,17 +676,26 @@ func TestEnvFormChromium(t *testing.T) { |
| Click string `json:"click"` |
| Input bool `json:"input,omitempty"` |
| Check string `json:"check,omitempty"` |
| + // NoScript loads and drives the page with its scripts disabled. |
| + NoScript bool `json:"noscript,omitempty"` |
| } |
| scenes := []scene{ |
| {ts.URL + "/page", map[string]string{"add.default.name": "WEBHOOK_SECRET", "add.default.value": secret}, []string{"add.default.secret"}, "add:default", false, |
| - `document.querySelector(".savebar").hidden === true`}, |
| - {ts.URL + "/page", map[string]string{"sec.default.STRIPE_KEY": replaced}, nil, "stage", false, ""}, |
| + `document.querySelector(".savebar").hidden === true`, false}, |
| + {ts.URL + "/page", map[string]string{"sec.default.STRIPE_KEY": replaced}, nil, "stage", false, "", false}, |
| // An edit in a panel shows the hidden save bar; its Discard posts. |
| {ts.URL + "/page", map[string]string{"val.default.LOG_LEVEL": "warn"}, nil, "discard", true, |
| - `document.querySelector(".savebar").hidden === false && getComputedStyle(document.querySelector(".savebar")).display !== "none"`}, |
| + `document.querySelector(".savebar").hidden === false && getComputedStyle(document.querySelector(".savebar")).display !== "none"`, false}, |
| // Save with a replaced secret and an ordinary edit: one post, the |
| // secret as its envelope only. |
| - {ts.URL + "/page", map[string]string{"val.default.LOG_LEVEL": "warn", "sec.default.STRIPE_KEY": saved}, nil, "save", true, ""}, |
| + {ts.URL + "/page", map[string]string{"val.default.LOG_LEVEL": "warn", "sec.default.STRIPE_KEY": saved}, nil, "save", true, "", false}, |
| + // JavaScript off (branch review P2-4): the save bar is shown, over |
| + // the console's global [hidden] rule, and an ordinary edit saves |
| + // through its visible Save button. |
| + {ts.URL + "/page", map[string]string{"val.default.LOG_LEVEL": "error"}, nil, "save", false, |
| + `(() => { const bar = document.querySelector(".savebar"), save = bar.querySelector('button[value="save"]'); |
| + const r = save.getBoundingClientRect(); |
| + return bar.hidden === true && getComputedStyle(bar).display === "flex" && r.width > 0 && r.height > 0; })()`, true}, |
| } |
| payload, _ := json.Marshal(scenes) |
| ctx, cancel := context.WithTimeout(t.Context(), 90*time.Second) |
| @@ -698,8 +707,8 @@ func TestEnvFormChromium(t *testing.T) { |
| mu.Lock() |
| defer mu.Unlock() |
| - if len(posts) != 4 { |
| - t.Fatalf("%d posts, want 4: %v", len(posts), posts) |
| + if len(posts) != 5 { |
| + t.Fatalf("%d posts, want 5: %v", len(posts), posts) |
| } |
| if d := posts[2]; d.Get("op") != "discard" || d.Get("val.default.LOG_LEVEL") != "warn" { |
| t.Errorf("discard posted %v", d) |
| @@ -762,6 +771,27 @@ func TestEnvFormChromium(t *testing.T) { |
| t.Fatalf("stored after the browser's save: %+v %v", m, err) |
| } |
| + // The no-script Save, on the real console: the ordinary edit saves. |
| + ns := posts[4] |
| + if ns.Get("op") != "save" || ns.Get("val.default.LOG_LEVEL") != "error" { |
| + t.Errorf("no-script save posted %v", ns) |
| + } |
| + // It was posted from the page before the Save above moved the bundle: |
| + // its versions are brought up to now, or it is (rightly) a conflict. |
| + fresh := envFields(t, e.page(t)) |
| + for k := range ns { |
| + if strings.HasPrefix(k, "ver.") { |
| + ns.Set(k, fresh.Get(k)) |
| + } |
| + } |
| + status, _, nbody := postForm(t, e.c, e.fx.u("/apps/shop/settings/environments"), ns) |
| + if status != http.StatusOK { |
| + t.Fatalf("console saving the no-script post = %d:\n%s", status, nbody) |
| + } |
| + if m, err := appconfig.Get(context.Background(), e.fx.rel, e.fx.sqid, "shop"); err != nil || m.Vars["LOG_LEVEL"].Value != "error" { |
| + t.Fatalf("stored after the no-script save: %+v %v", m, err) |
| + } |
| + |
| if dir := os.Getenv("ENV_FORM_SHOTS"); dir != "" { |
| // The staged page, so the save bar shows too. |
| page = body |
diff --git a/internal/console/templates/app_settings.html b/internal/console/templates/app_settings.html| index 65a338c89..2adb90c06 100644 |
| --- a/internal/console/templates/app_settings.html |
| +++ b/internal/console/templates/app_settings.html |
| @@ -721,7 +721,7 @@ blocks deletion. Turn the safety delay off on the <a href="{{.Nav}}/apps/{{.AppN |
| <button type="submit" class="btn-sm" name="op" value="save">{{$c.Save}}</button> |
| </div> |
| </div> |
| - <noscript><style>.savebar[hidden] { display: flex; }</style></noscript> |
| + <noscript><style>form[data-env-form] .savebar[hidden] { display: flex !important; }</style></noscript> |
| </form> |
| {{- end}} |
| {{with $s.EnvOutcome}}{{template "app_settings_env_outcome" $}}{{end}} |
diff --git a/internal/console/testdata/configseal_browser.mjs b/internal/console/testdata/configseal_browser.mjs| index 42daa96a3..6dcb65931 100644 |
| --- a/internal/console/testdata/configseal_browser.mjs |
| +++ b/internal/console/testdata/configseal_browser.mjs |
| @@ -5,7 +5,8 @@ |
| // node configseal_browser.mjs <chromium> <profile dir> <scenes JSON> |
| // scene: {url, fill: {id: value}, tick: [id], click: <button value>, |
| // input: fire input events on the filled fields, check: a JS |
| -// expression that must be true before the click} |
| +// expression that must be true before the click, noscript: load |
| +// and drive the page with its scripts disabled} |
| import {spawn} from 'node:child_process'; |
| import assert from 'node:assert/strict'; |
| @@ -54,10 +55,16 @@ try { |
| session = (await call('Target.attachToTarget', {targetId: created.targetId, flatten: true}, false)).sessionId; |
| await call('Page.enable'); |
| for (const scene of JSON.parse(scenesJSON)) { |
| + // Page scripts off or on before the load, so the parser reads |
| + // <noscript> as the page would with JavaScript disabled. This |
| + // driver's own evaluations still run. |
| + await call('Emulation.setScriptExecutionDisabled', {value: !!scene.noscript}); |
| await call('Page.navigate', {url: scene.url}); |
| await until('document.readyState === "complete" && !!document.querySelector("form[data-seal-pub]")'); |
| - assert.equal(await evaluate('[...document.querySelectorAll("[data-secret-input],[data-secret-toggle]")].every(e => !e.disabled)'), true); |
| - assert.equal(await evaluate('window.isSecureContext && !!crypto.subtle'), true); |
| + if (!scene.noscript) { |
| + assert.equal(await evaluate('[...document.querySelectorAll("[data-secret-input],[data-secret-toggle]")].every(e => !e.disabled)'), true); |
| + assert.equal(await evaluate('window.isSecureContext && !!crypto.subtle'), true); |
| + } |
| await evaluate(`(() => { |
| const fill = ${JSON.stringify(scene.fill || {})}, tick = ${JSON.stringify(scene.tick || [])}; |
| for (const [id, v] of Object.entries(fill)) { |