console: Backups section on the instance page, approved copy (#898)
Member backups slice 1, tasks 4 and 0. The instance page reads the instance's record and asks backupsFor in-process, then shows the approved dashboard layout: three tiles (last change saved, how far back, restore test) when the copy's position is known, the "What we keep" table with a chip per row, one reason line when a row needs one, and the db pull commands in a "Use the command line" disclosure when db pull can serve the instance (copied, another region, or too large to plan here). Times are UTC, as the page's others are. No Download button: slice 1b. The commands carry --out, which db pull requires. A route with no record gets no section, unless it is a site, which gets its line. Task 0: docs/superpowers/plans/member-backups-slice1-copy.json records the 33 strings Paul approved unedited; TestApprovedMemberBackupsCopy pins the 26 the page applies and names the 7 still pending (six for slice 1b, backups.cli.heading for task 5).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
approved_member_backups_copy_test.go+105 −0docs/superpowers/plans/member-backups-slice1-copy.json+40 −0internal/console/instancecopy.go+44 −0internal/console/instancepage.go+170 −0internal/console/instancepage_test.go+417 −0internal/console/templates/app_instance.html+23 −0
Intent
<task-notification> <task-id>a7e4ffe967b5c5af8</task-id> <tool-use-id>toolu_013L8r4wiXGQyhY85payHc23</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ab362fc0-f177-4a7f-a92e-4a29ea210aad/tasks/a7e4ffe967b5c5af8.output</output-file> <status>completed</status> <summary>Agent "Implement slice 1 Task 3" 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. Commit f5b886ff `console: the backups door, GET .../instances/{host}/backups (#898)` (not pushed). Tests: the 4 new door tests (key sets, roles, bad and unknown host, other region with the db pull forward still admitted), the census tests you named, all TestTeam*, the backups tests and TestClaimConsoleMutationInvariant pass. So does the door's new subtest of TestClaimConsoleMutationInvariantProbes, run alone. gofmt and vet are clean, `go build ./...` passes, and darwin and windows builds of the console pass. Concerns and decisions: - **Extra file:** TestClaimConsoleMutationInvariant required a read probe, so I added one in claim_invariant_probes_read_test.go, a file the brief didn't list. The door is also in `teamClosed`. - **Bad host shape gets 404, not 400.** That is what the rest of the instance doors answer, so the test asserts 404. - **No `principalFrom` in the handler.** This door doesn't use the principal for anything. - **App-less tokens:** an account-scoped operate or admin credential in the same account gets 200, because its scope is the whole account. A deploy credential can't be minted without an app, and the test checks that. The 404 for app-less tokens is tested with another account's credentials. - **Deploy rungs:** a deploy credential's rungs don't limit which hosts it can read here (gate-pass does check them). The door also shares the instance budget of 60 requests per token per minute, which the Task 5 CLI should know about. - **Vacuous RED:** the bad-host test passed before the route existed, because the router's own 404 is the same bytes. - **Sandbox:** /tmp/g is read-only inside the sandbox, so I ran the Go commands with the sandbox off. No cache variables were set. `backups.go` is unchanged: `region` is already set only for other_region. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups-1/.superpowers/sdd/2026-11-11-member-backups-slice1/task-3-report.md</result> <usage><subagent_tokens>178437</subagent_tokens><tool_uses>63</tool_uses><duration_ms>1692399</duration_ms></usage> </task-notification>
diff --git a/approved_member_backups_copy_test.go b/approved_member_backups_copy_test.go| new file mode 100644 |
| index 000000000..06ae4ad8f |
| --- /dev/null |
| +++ b/approved_member_backups_copy_test.go |
| @@ -0,0 +1,105 @@ |
| +package main |
| + |
| +import ( |
| + "encoding/json" |
| + "os" |
| + "slices" |
| + "sort" |
| + "testing" |
| +) |
| + |
| +// memberBackupsCopyRecordPath is the member backups slice 1 copy record |
| +// (#898): the 33 strings Paul approved unedited in the copy review of |
| +// 2026-11-11, for the Backups section on the instance page, its Download |
| +// button (slice 1b) and `carlos instances backups` (Task 5). |
| +const memberBackupsCopyRecordPath = "docs/superpowers/plans/member-backups-slice1-copy.json" |
| + |
| +// memberBackupsCopyIDs is the record's applied inventory, pinned as a |
| +// literal: every entry here must be in the file the record names, byte for |
| +// byte. |
| +var memberBackupsCopyIDs = []string{ |
| + "backups.heading", |
| + "backups.saved.label", "backups.saved.today", |
| + "backups.history.label", "backups.history.detail", |
| + "backups.test.label", "backups.test.none", |
| + "backups.keep.heading", "backups.keep.db", "backups.keep.files", |
| + "backups.chip.copied", "backups.chip.notcopied", "backups.chip.notshown", |
| + "backups.chip.nothingyet", "backups.chip.unavailable", |
| + "backups.why.nosleep", "backups.why.ownaddress", "backups.why.notinstance", |
| + "backups.why.demo", "backups.why.pooled", "backups.why.fleet", |
| + "backups.why.otherregion", "backups.why.nothingyet", |
| + "backups.cli.summary", "backups.cli.latest", "backups.cli.at", |
| +} |
| + |
| +// memberBackupsPendingIDs are approved entries no file holds yet, each |
| +// with the slice that applies it. That slice moves its ids from here into |
| +// memberBackupsCopyIDs, so the check below then covers them. |
| +var memberBackupsPendingIDs = map[string]string{ |
| + "backups.download": "slice 1b", |
| + "backups.preparing": "slice 1b", |
| + "backups.preparing.note": "slice 1b", |
| + "backups.ready": "slice 1b", |
| + "backups.ready.note": "slice 1b", |
| + "backups.toolarge": "slice 1b", |
| + "backups.cli.heading": "slice 1 task 5", |
| +} |
| + |
| +// Every applied member backups string is present, byte for byte, in the |
| +// file the record names; the record names exactly the applied and pending |
| +// ids, each once, so a string can't drop out of the approval unnoticed. |
| +func TestApprovedMemberBackupsCopy(t *testing.T) { |
| + raw, err := os.ReadFile(memberBackupsCopyRecordPath) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var rec map[string]json.RawMessage |
| + if err := json.Unmarshal(raw, &rec); err != nil { |
| + t.Fatal(err) |
| + } |
| + var entries []struct { |
| + ID string `json:"id"` |
| + Pending string `json:"pending"` |
| + } |
| + if err := json.Unmarshal(rec["entries"], &entries); err != nil { |
| + t.Fatal(err) |
| + } |
| + var applied []json.RawMessage |
| + var all []json.RawMessage |
| + if err := json.Unmarshal(rec["entries"], &all); err != nil { |
| + t.Fatal(err) |
| + } |
| + var pendingSeen []string |
| + for i, e := range entries { |
| + slice, pending := memberBackupsPendingIDs[e.ID] |
| + if e.Pending != slice { |
| + t.Errorf("%s: the record says pending %q, the test %q", e.ID, e.Pending, slice) |
| + } |
| + if pending { |
| + pendingSeen = append(pendingSeen, e.ID) |
| + continue |
| + } |
| + applied = append(applied, all[i]) |
| + } |
| + sort.Strings(pendingSeen) |
| + var wantPending []string |
| + for id := range memberBackupsPendingIDs { |
| + wantPending = append(wantPending, id) |
| + } |
| + sort.Strings(wantPending) |
| + if !slices.Equal(pendingSeen, wantPending) { |
| + t.Errorf("pending entries in the record = %v, want %v", pendingSeen, wantPending) |
| + } |
| + |
| + // The applied entries alone go through the shared check: it fails on |
| + // an entry the pinned list lacks, a pinned id the record lacks, a |
| + // duplicate, and a text the named file doesn't hold. |
| + rec["entries"], err = json.Marshal(applied) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + only, err := json.Marshal(rec) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + checkApprovedCopy(t, only, ".", memberBackupsCopyIDs, nil) |
| +} |
diff --git a/docs/superpowers/plans/member-backups-slice1-copy.json b/docs/superpowers/plans/member-backups-slice1-copy.json| new file mode 100644 |
| index 000000000..374cca758 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/member-backups-slice1-copy.json |
| @@ -0,0 +1,40 @@ |
| +{ |
| + "approved_by": "Paul", |
| + "approved_on": "2026-11-11", |
| + "source": "copy review ddwtnxr27ojv5j7v5ntnrha6cq (generation 2), approved unedited", |
| + "entries": [ |
| + {"id": "backups.heading", "file": "internal/console/instancecopy.go", "text": "Backups"}, |
| + {"id": "backups.download", "file": "internal/console/instancecopy.go", "text": "Download a copy", "pending": "slice 1b"}, |
| + {"id": "backups.saved.label", "file": "internal/console/instancecopy.go", "text": "Last change saved"}, |
| + {"id": "backups.saved.today", "file": "internal/console/instancecopy.go", "text": "today"}, |
| + {"id": "backups.history.label", "file": "internal/console/instancecopy.go", "text": "Go back as far as"}, |
| + {"id": "backups.history.detail", "file": "internal/console/instancecopy.go", "text": "about 7 days of history"}, |
| + {"id": "backups.test.label", "file": "internal/console/instancecopy.go", "text": "Restore test"}, |
| + {"id": "backups.test.none", "file": "internal/console/instancecopy.go", "text": "not shown yet"}, |
| + {"id": "backups.keep.heading", "file": "internal/console/instancecopy.go", "text": "What we keep"}, |
| + {"id": "backups.keep.db", "file": "internal/console/instancecopy.go", "text": "Database"}, |
| + {"id": "backups.keep.files", "file": "internal/console/instancecopy.go", "text": "Files on disk"}, |
| + {"id": "backups.chip.copied", "file": "internal/console/instancecopy.go", "text": "Copied"}, |
| + {"id": "backups.chip.notcopied", "file": "internal/console/instancecopy.go", "text": "Not copied"}, |
| + {"id": "backups.chip.notshown", "file": "internal/console/instancecopy.go", "text": "Not shown here"}, |
| + {"id": "backups.chip.nothingyet", "file": "internal/console/instancecopy.go", "text": "Nothing yet"}, |
| + {"id": "backups.chip.unavailable", "file": "internal/console/instancecopy.go", "text": "Can't read now"}, |
| + {"id": "backups.preparing", "file": "internal/console/instancecopy.go", "text": "Preparing your copy", "pending": "slice 1b"}, |
| + {"id": "backups.preparing.note", "file": "internal/console/instancecopy.go", "text": "Usually a minute or two. We'll email you when it's ready.", "pending": "slice 1b"}, |
| + {"id": "backups.ready", "file": "internal/console/instancecopy.go", "text": "Download {file} ({size})", "pending": "slice 1b"}, |
| + {"id": "backups.ready.note", "file": "internal/console/instancecopy.go", "text": "Ready until {time} tomorrow.", "pending": "slice 1b"}, |
| + {"id": "backups.toolarge", "file": "internal/console/instancecopy.go", "text": "Too large to download here. Use the command line below.", "pending": "slice 1b"}, |
| + {"id": "backups.why.nosleep", "file": "internal/console/instancecopy.go", "text": "This instance never sleeps, so we don't copy it yet."}, |
| + {"id": "backups.why.ownaddress", "file": "internal/console/instancecopy.go", "text": "It runs outside the platform, so we can't copy it."}, |
| + {"id": "backups.why.notinstance", "file": "internal/console/instancecopy.go", "text": "{host} is a redirect or site, with no database."}, |
| + {"id": "backups.why.demo", "file": "internal/console/instancecopy.go", "text": "Demo data isn't kept."}, |
| + {"id": "backups.why.pooled", "file": "internal/console/instancecopy.go", "text": "Copies of pooled instances aren't shown here yet."}, |
| + {"id": "backups.why.fleet", "file": "internal/console/instancecopy.go", "text": "Copies on your own servers aren't shown here yet."}, |
| + {"id": "backups.why.otherregion", "file": "internal/console/instancecopy.go", "text": "Copies in {region} aren't shown here yet. You can still download one."}, |
| + {"id": "backups.why.nothingyet", "file": "internal/console/instancecopy.go", "text": "Check back in a minute."}, |
| + {"id": "backups.cli.summary", "file": "internal/console/instancecopy.go", "text": "Use the command line"}, |
| + {"id": "backups.cli.latest", "file": "internal/console/instancecopy.go", "text": "The latest copy:"}, |
| + {"id": "backups.cli.at", "file": "internal/console/instancecopy.go", "text": "As it was at a given time:"}, |
| + {"id": "backups.cli.heading", "file": "instances_backups.go", "text": "Backups for {host}", "pending": "slice 1 task 5"} |
| + ] |
| +} |
diff --git a/internal/console/instancecopy.go b/internal/console/instancecopy.go| index 364f1e13b..d1b7c9190 100644 |
| --- a/internal/console/instancecopy.go |
| +++ b/internal/console/instancecopy.go |
| @@ -26,3 +26,47 @@ func (p page) InstanceAllURL() string { |
| } |
| return suffix |
| } |
| + |
| +// backupsCopyStrings is the instance page's Backups section, the member |
| +// backups copy review of 2026-11-11 (record: |
| +// docs/superpowers/plans/member-backups-slice1-copy.json, ids backups.*). |
| +// {host} and {region} are filled in when the line is shown. |
| +type backupsCopyStrings struct { |
| + Heading, SavedLabel, SavedToday, HistoryLabel, HistoryDetail, TestLabel, TestNone string |
| + KeepHeading, KeepDB, KeepFiles string |
| + ChipCopied, ChipNotCopied, ChipNotShown, ChipNothingYet, ChipUnavailable string |
| + WhyNoSleep, WhyOwnAddress, WhyNotInstance, WhyDemo, WhyPooled, WhyFleet string |
| + WhyOtherRegion, WhyNothingYet string |
| + CLISummary, CLILatest, CLIAt string |
| +} |
| + |
| +var backupsCopy = backupsCopyStrings{ |
| + Heading: "Backups", |
| + SavedLabel: "Last change saved", |
| + SavedToday: "today", |
| + HistoryLabel: "Go back as far as", |
| + HistoryDetail: "about 7 days of history", |
| + TestLabel: "Restore test", |
| + TestNone: "not shown yet", |
| + KeepHeading: "What we keep", |
| + KeepDB: "Database", |
| + KeepFiles: "Files on disk", |
| + ChipCopied: "Copied", |
| + ChipNotCopied: "Not copied", |
| + ChipNotShown: "Not shown here", |
| + ChipNothingYet: "Nothing yet", |
| + ChipUnavailable: "Can't read now", |
| + WhyNoSleep: "This instance never sleeps, so we don't copy it yet.", |
| + WhyOwnAddress: "It runs outside the platform, so we can't copy it.", |
| + WhyNotInstance: "{host} is a redirect or site, with no database.", |
| + WhyDemo: "Demo data isn't kept.", |
| + WhyPooled: "Copies of pooled instances aren't shown here yet.", |
| + WhyFleet: "Copies on your own servers aren't shown here yet.", |
| + WhyOtherRegion: "Copies in {region} aren't shown here yet. You can still download one.", |
| + WhyNothingYet: "Check back in a minute.", |
| + CLISummary: "Use the command line", |
| + CLILatest: "The latest copy:", |
| + CLIAt: "As it was at a given time:", |
| +} |
| + |
| +func (p page) BackupsCopy() backupsCopyStrings { return backupsCopy } |
diff --git a/internal/console/instancepage.go b/internal/console/instancepage.go| index f4ffd4edf..b332cb760 100644 |
| --- a/internal/console/instancepage.go |
| +++ b/internal/console/instancepage.go |
| @@ -1,12 +1,17 @@ |
| package console |
| import ( |
| + "context" |
| "encoding/base64" |
| "encoding/json" |
| + "errors" |
| "fmt" |
| + "log" |
| "net/http" |
| "net/url" |
| + "os" |
| "sort" |
| + "strings" |
| "time" |
| "github.com/carlosframework/platform/internal/provision" |
| @@ -33,6 +38,9 @@ type instanceDetail struct { |
| // Updates is the instance's update settings section (settings spec §5); |
| // nil when the host has no instance record or it could not be read. |
| Updates *updatesPageView |
| + // Backups is the instance's Backups section (member backups spec §2); |
| + // nil when the page has nothing to say about the host's copy. |
| + Backups *backupsSection |
| } |
| // retryable is whether the box's report holds this host back in a way a |
| @@ -314,8 +322,170 @@ func (s *Server) handleAppInstance(w http.ResponseWriter, r *http.Request) { |
| sort.Strings(detail.Aliases) |
| } |
| } |
| + // The record's own account and app key the read, so a remote row |
| + // (another box, often another region) is answered from its record too. |
| + detail.Backups = s.instanceBackups(r.Context(), acct.Sqid, p.AppName, selected) |
| p.InstanceDetail = detail |
| p.InstanceQuery = parseInstanceQuery(r.URL.Query()) |
| p.InstanceListURL = p.Nav + "/apps/" + p.AppName + "/instances" + instanceQuerySuffix(p.InstanceQuery) |
| s.render(w, http.StatusOK, "app_instance", p) |
| } |
| + |
| +// backupsSection is the instance page's Backups section (member backups |
| +// spec §2, layout rev 5): the three tiles when the copy's position is |
| +// known, the "What we keep" table with a chip per row, one reason line |
| +// when a row needs one, and the db pull commands when db pull can serve |
| +// the instance. Every time is UTC, as the page's other times are. |
| +type backupsSection struct { |
| + // Tiles is whether the tiles show: the copy is read and its newest |
| + // point is known. SavedTime and SavedDay are the first tile's value |
| + // and detail ("today" or the weekday and date); SavedAt and HistoryAt |
| + // are RFC 3339 for <time datetime>. HistoryDay is "" when the |
| + // listing carries no times, and the tile shows the unknown dash. |
| + Tiles bool |
| + SavedTime, SavedDay string |
| + SavedAt, HistoryDay string |
| + HistoryAt string |
| + DBChip, DBTone string |
| + FilesChip, FilesTone string |
| + // Why is the one reason line under the table, "" for none. |
| + Why string |
| + // PullLatest and PullAt are the two db pull commands, "" when db pull |
| + // can't serve the instance. |
| + PullLatest, PullAt string |
| +} |
| + |
| +// The chips' tones: chip-env is the neutral label, chip-stale the warning |
| +// outline a known gap wears. |
| +const ( |
| + backupsToneNeutral = "chip-env" |
| + backupsToneGap = "chip-stale" |
| +) |
| + |
| +// backupsSectionFor turns the door's view of host's copy into the section, |
| +// at now. The reasons map to the approved lines; too_large_to_plan and |
| +// unavailable read "Can't read now" with no line (1b says more for a copy |
| +// too large to plan). |
| +func backupsSectionFor(v backupsView, app, host string, now time.Time) *backupsSection { |
| + c := backupsCopy |
| + s := &backupsSection{FilesChip: c.ChipNotCopied, FilesTone: backupsToneGap} |
| + if v.HABorn { |
| + s.FilesChip, s.FilesTone = c.ChipNotShown, backupsToneNeutral |
| + } |
| + pull := false |
| + switch v.Class { |
| + case backupReplicated: |
| + s.DBChip, s.DBTone = c.ChipCopied, backupsToneNeutral |
| + pull = true |
| + case backupNoCopy: |
| + s.DBChip, s.DBTone = c.ChipNotCopied, backupsToneGap |
| + default: |
| + s.DBChip, s.DBTone = c.ChipNotShown, backupsToneNeutral |
| + } |
| + switch v.Reason { |
| + case backupReasonNoSleep: |
| + s.Why = c.WhyNoSleep |
| + case backupReasonOwnAddress: |
| + s.Why = c.WhyOwnAddress |
| + case backupReasonNotInstance: |
| + s.Why = strings.ReplaceAll(c.WhyNotInstance, "{host}", host) |
| + case backupReasonDemo: |
| + s.Why = c.WhyDemo |
| + case backupReasonPooled: |
| + s.Why = c.WhyPooled |
| + case backupReasonFleet: |
| + s.Why = c.WhyFleet |
| + case backupReasonOtherRegion: |
| + // db pull forwards to the instance's region (spec §1, R2-2). |
| + s.Why = strings.ReplaceAll(c.WhyOtherRegion, "{region}", v.Region) |
| + pull = true |
| + case backupReasonNothing: |
| + s.DBChip, s.Why = c.ChipNothingYet, c.WhyNothingYet |
| + case backupReasonTooLarge: |
| + // Too large for this console to plan within its bounds; the CLI |
| + // plans it without them. |
| + s.DBChip = c.ChipUnavailable |
| + pull = true |
| + case backupReasonUnavailable: |
| + s.DBChip = c.ChipUnavailable |
| + } |
| + var from *time.Time |
| + if v.Class == backupReplicated && v.CopiedTo != nil { |
| + saved := v.CopiedTo.WrittenAt.UTC() |
| + s.Tiles = true |
| + s.SavedAt, s.SavedTime = saved.Format(time.RFC3339), saved.Format("15:04")+" UTC" |
| + s.SavedDay = backupsDate(saved, now.UTC(), "Mon 2 Jan") |
| + if n := now.UTC(); saved.Year() == n.Year() && saved.YearDay() == n.YearDay() { |
| + s.SavedDay = c.SavedToday |
| + } |
| + if v.HistoryFrom != nil { |
| + h := v.HistoryFrom.UTC() |
| + from = &h |
| + s.HistoryAt, s.HistoryDay = h.Format(time.RFC3339), backupsDate(h, now.UTC(), "2 Jan") |
| + } |
| + } |
| + if pull { |
| + // db pull needs --out, a path that doesn't exist yet: the host's |
| + // first label, and for --at the time too, so the two don't clash. |
| + file, _, _ := strings.Cut(host, ".") |
| + at := backupsAtExample(from, now) |
| + s.PullLatest = fmt.Sprintf("carlos db pull --app %s --instance %s --out %s.db", app, host, file) |
| + s.PullAt = fmt.Sprintf("carlos db pull --app %s --instance %s --at %s --out %s-%s.db", |
| + app, host, at.Format(time.RFC3339), file, at.Format("20060102T1504Z")) |
| + } |
| + return s |
| +} |
| + |
| +// backupsDate is t in layout, with the year when it isn't now's. |
| +func backupsDate(t, now time.Time, layout string) string { |
| + if t.Year() != now.Year() { |
| + layout += " 2006" |
| + } |
| + return t.Format(layout) |
| +} |
| + |
| +// backupsAtExample is the --at in the second command: a day before now, |
| +// on the hour, unless the kept history starts later, and then the first |
| +// whole minute inside it. db pull refuses a time after now and one before |
| +// the history. |
| +func backupsAtExample(from *time.Time, now time.Time) time.Time { |
| + at := now.UTC().Add(-24 * time.Hour).Truncate(time.Hour) |
| + if from == nil || !at.Before(*from) { |
| + return at |
| + } |
| + at = from.Truncate(time.Minute) |
| + if at.Before(*from) { |
| + at = at.Add(time.Minute) |
| + } |
| + if at.After(now) { |
| + at = *from |
| + } |
| + return at |
| +} |
| + |
| +// instanceBackups is the Backups section for rt, read in-process through |
| +// backupsFor from the instance's record. A host with no record is a route |
| +// the page lists without one: a site or redirect gets its line, and an |
| +// instance gets no section, since nothing says what its copy is. |
| +func (s *Server) instanceBackups(ctx context.Context, acct, app string, rt *RouteView) *backupsSection { |
| + if s.cfg.Releases == nil { |
| + return nil |
| + } |
| + rctx, cancel := context.WithTimeout(ctx, instanceStoreTimeout) |
| + rec, _, err := s.readRecord(rctx, acct, app, rt.Host) |
| + cancel() |
| + var v backupsView |
| + switch { |
| + case errors.Is(err, os.ErrNotExist): |
| + if rt.Kind == "" || rt.Kind == "instance" { |
| + return nil |
| + } |
| + v = s.backupsFor(ctx, provision.Record{Host: rt.Host, Kind: rt.Kind}) |
| + case err != nil: |
| + log.Printf("console: instance page backups %s/%s/%s: %v", acct, app, rt.Host, err) |
| + v = backupsView{Class: backupNotShown, Reason: backupReasonUnavailable} |
| + default: |
| + v = s.backupsFor(ctx, *rec) |
| + } |
| + return backupsSectionFor(v, app, rt.Host, time.Now()) |
| +} |
diff --git a/internal/console/instancepage_test.go b/internal/console/instancepage_test.go| index b249175f4..d4c3419ec 100644 |
| --- a/internal/console/instancepage_test.go |
| +++ b/internal/console/instancepage_test.go |
| @@ -1,13 +1,26 @@ |
| package console |
| import ( |
| + "bytes" |
| + "context" |
| + "encoding/json" |
| + "errors" |
| + "html/template" |
| + "io" |
| "net/http" |
| "net/url" |
| + "os" |
| "reflect" |
| + "regexp" |
| "strings" |
| "testing" |
| "time" |
| + "github.com/superfly/ltx" |
| + |
| + "github.com/carlosframework/platform/internal/demo" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/regionlabel" |
| "github.com/carlosframework/platform/internal/registry" |
| "github.com/carlosframework/platform/internal/status" |
| ) |
| @@ -272,3 +285,407 @@ func TestInstanceDetailShowsLayoutUnknownWithNoReport(t *testing.T) { |
| // pre-existing gap in Assemble (R10: "do not touch"), not one this task |
| // introduces. The `s.cfg.Releases != nil` guard above is still correct |
| // defensive code for the day Assemble stops assuming a bucket. |
| + |
| +// backupsPageFixture is a console whose replica reader serves the fakes in |
| +// replicas by prefix (instances/<host>) and fails for every other host, |
| +// signed in as the owner of kass. |
| +func backupsPageFixture(t *testing.T, replicas map[string]replicaReader) (*consoleFixture, *http.Client) { |
| + t.Helper() |
| + fx := newConsoleFixture(t) |
| + c := signInPaul(t, fx) |
| + fx.srv.cfg.HibernateBucket = "data-test" |
| + fx.srv.cfg.HibernatePrefix = "instances" |
| + fx.srv.dbReplica = func(_ context.Context, prefix string) (replicaReader, error) { |
| + if rd, ok := replicas[prefix]; ok { |
| + return rd, nil |
| + } |
| + return nil, errors.New("no such replica") |
| + } |
| + return fx, c |
| +} |
| + |
| +// putBackupsHost writes kass's instance record for rec.Host (hibernating |
| +// unless rec says otherwise) and the registry route the page lists. |
| +func putBackupsHost(t *testing.T, fx *consoleFixture, rec provision.Record) { |
| + t.Helper() |
| + rec.App, rec.Account = "kass", fx.sqid |
| + if rec.Hibernate == nil { |
| + yes := true |
| + rec.Hibernate = &yes |
| + } |
| + body, err := json.Marshal(rec) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := fx.rel.Put(context.Background(), provision.RecordKey(rec.Account, rec.App, rec.Host), body, ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + kind := rec.Kind |
| + if kind == "" { |
| + kind = "instance" |
| + } |
| + fx.addRoute(t, registry.Route{Host: rec.Host, App: "kass", Account: fx.sqid, Kind: kind}) |
| +} |
| + |
| +// spanReplica is a replica of two level-0 files: the first transaction |
| +// written at from, the second at to. Its history starts just after from. |
| +type spanReplica struct{ from, to time.Time } |
| + |
| +func (r spanReplica) LTXFiles(_ context.Context, level int, _ ltx.TXID, _ bool) (ltx.FileIterator, error) { |
| + if level != 0 { |
| + return ltx.NewFileInfoSliceIterator(nil), nil |
| + } |
| + return ltx.NewFileInfoSliceIterator([]*ltx.FileInfo{ |
| + {Level: 0, MinTXID: 1, MaxTXID: 1, Size: 100, CreatedAt: r.from}, |
| + {Level: 0, MinTXID: 2, MaxTXID: 2, Size: 100, CreatedAt: r.to}, |
| + }), nil |
| +} |
| + |
| +func (r spanReplica) OpenLTXFile(_ context.Context, _ int, minTXID, maxTXID ltx.TXID, offset, size int64) (io.ReadCloser, error) { |
| + at := r.from |
| + if maxTXID == 2 { |
| + at = r.to |
| + } |
| + h := ltx.Header{Version: ltx.Version, PageSize: 4096, Commit: 2, MinTXID: minTXID, MaxTXID: maxTXID, Timestamp: at.UnixMilli()} |
| + b, err := h.MarshalBinary() |
| + if err != nil { |
| + return nil, err |
| + } |
| + end := offset + size |
| + if size <= 0 || end > int64(len(b)) { |
| + end = int64(len(b)) |
| + } |
| + return io.NopCloser(bytes.NewReader(b[offset:end])), nil |
| +} |
| + |
| +// backupsFailReplica fails every listing with err. |
| +type backupsFailReplica struct{ err error } |
| + |
| +func (r backupsFailReplica) LTXFiles(context.Context, int, ltx.TXID, bool) (ltx.FileIterator, error) { |
| + return nil, r.err |
| +} |
| + |
| +func (r backupsFailReplica) OpenLTXFile(context.Context, int, ltx.TXID, ltx.TXID, int64, int64) (io.ReadCloser, error) { |
| + return nil, r.err |
| +} |
| + |
| +// backupsSectionOf is the page's Backups section, from its opening tag to |
| +// the tag that closes it (the tiles are a section inside it); "" without |
| +// one. |
| +func backupsSectionOf(t *testing.T, body string) string { |
| + t.Helper() |
| + start := strings.Index(body, `<section class="backups">`) |
| + if start < 0 { |
| + return "" |
| + } |
| + depth, i := 0, start |
| + for { |
| + open := strings.Index(body[i:], "<section") |
| + end := strings.Index(body[i:], "</section>") |
| + if end < 0 { |
| + t.Fatalf("the backups section never closes: %s", body[start:]) |
| + } |
| + if open >= 0 && open < end { |
| + depth++ |
| + i += open + len("<section") |
| + continue |
| + } |
| + depth-- |
| + i += end + len("</section>") |
| + if depth == 0 { |
| + return body[start:i] |
| + } |
| + } |
| +} |
| + |
| +// backupsPage is the Backups section of host's instance page. |
| +func backupsPage(t *testing.T, fx *consoleFixture, c *http.Client, host string) string { |
| + t.Helper() |
| + status, _, body := get(t, c, fx.u("/apps/kass/instances/"+host)) |
| + if status != http.StatusOK { |
| + t.Fatalf("%s = %d: %s", host, status, body) |
| + } |
| + return backupsSectionOf(t, body) |
| +} |
| + |
| +// pageText is s as html/template prints it in a text node. |
| +func pageText(s string) string { return template.HTMLEscapeString(s) } |
| + |
| +var backupsAtRE = regexp.MustCompile(`--at ([0-9TZ:-]+)`) |
| + |
| +func TestInstancePageBackupsReplicated(t *testing.T) { |
| + now := time.Now() |
| + from, to := now.Add(-6*24*time.Hour), now.Add(-2*time.Minute) |
| + fx, c := backupsPageFixture(t, map[string]replicaReader{ |
| + "instances/keep.carlosapp.dev": spanReplica{from: from, to: to}, |
| + "instances/ha.carlosapp.dev": spanReplica{from: from, to: to}, |
| + }) |
| + putBackupsHost(t, fx, provision.Record{Host: "keep.carlosapp.dev"}) |
| + putBackupsHost(t, fx, provision.Record{Host: "ha.carlosapp.dev", HA: true}) |
| + |
| + sec := backupsPage(t, fx, c, "keep.carlosapp.dev") |
| + if sec == "" { |
| + t.Fatal("no backups section") |
| + } |
| + v := fx.srv.backupsFor(t.Context(), provision.Record{Host: "keep.carlosapp.dev", Hibernate: backupsYes()}) |
| + if v.CopiedTo == nil || v.HistoryFrom == nil { |
| + t.Fatalf("view = %+v, want a position and a history", v) |
| + } |
| + saved := v.CopiedTo.WrittenAt.UTC() |
| + historyDay := v.HistoryFrom.UTC().Format("2 Jan") |
| + if v.HistoryFrom.UTC().Year() != time.Now().UTC().Year() { |
| + historyDay = v.HistoryFrom.UTC().Format("2 Jan 2006") |
| + } |
| + for _, want := range []string{ |
| + `<h2 id="backups-heading">Backups</h2>`, |
| + `<section class="tiles stat-tiles" aria-labelledby="backups-heading">`, |
| + "<h2>Last change saved</h2>", |
| + `<p class="tile-value"><time datetime="` + saved.Format(time.RFC3339) + `">` + saved.Format("15:04") + " UTC</time></p>", |
| + "<h2>Go back as far as</h2>", |
| + `<p class="tile-value"><time datetime="` + v.HistoryFrom.UTC().Format(time.RFC3339) + `">` + historyDay + "</time></p>", |
| + `<p class="tile-detail">about 7 days of history</p>`, |
| + "<h2>Restore test</h2>", |
| + `<p class="tile-detail">not shown yet</p>`, |
| + `<h3 class="small">What we keep</h3>`, |
| + `<tr><td>Database</td><td><span class="chip chip-env">Copied</span></td></tr>`, |
| + `<tr><td>Files on disk</td><td><span class="chip chip-stale">Not copied</span></td></tr>`, |
| + `<details class="reveal">`, |
| + "<summary>Use the command line</summary>", |
| + `<p class="small">The latest copy:</p>`, |
| + "<pre><code>carlos db pull --app kass --instance keep.carlosapp.dev --out keep.db</code></pre>", |
| + `<p class="small">As it was at a given time:</p>`, |
| + } { |
| + if !strings.Contains(sec, want) { |
| + t.Errorf("missing %q in %s", want, sec) |
| + } |
| + } |
| + m := backupsAtRE.FindStringSubmatch(sec) |
| + if m == nil { |
| + t.Fatalf("no --at example in %s", sec) |
| + } |
| + at, err := time.Parse(time.RFC3339, m[1]) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if at.Before(*v.HistoryFrom) || at.After(time.Now()) { |
| + t.Errorf("--at %s is outside the history %s .. now", at, v.HistoryFrom) |
| + } |
| + if !strings.Contains(sec, "--at "+m[1]+" --out keep-"+at.Format("20060102T1504Z")+".db</code></pre>") { |
| + t.Errorf("the --at command does not name its own file: %s", sec) |
| + } |
| + // No reason line: no row needs one. The two small lines label the |
| + // commands. |
| + if n := strings.Count(sec, `<p class="small">`); n != 2 { |
| + t.Errorf("%d small lines, want the two command labels: %s", n, sec) |
| + } |
| + |
| + ha := backupsPage(t, fx, c, "ha.carlosapp.dev") |
| + if !strings.Contains(ha, `<tr><td>Files on disk</td><td><span class="chip chip-env">Not shown here</span></td></tr>`) { |
| + t.Errorf("born HA: files row is not Not shown here: %s", ha) |
| + } |
| +} |
| + |
| +// TestBackupsSectionTimes pins the tiles' clock: UTC, the time and today |
| +// for a change saved today, the weekday and date otherwise, and the year |
| +// only when it isn't this one. |
| +func TestBackupsSectionTimes(t *testing.T) { |
| + now := time.Date(2026, 11, 11, 15, 30, 0, 0, time.UTC) |
| + from := time.Date(2026, 11, 4, 9, 0, 1, 0, time.UTC) |
| + view := func(saved time.Time) backupsView { |
| + return backupsView{Class: backupReplicated, CopiedTo: &backupsPosition{Transaction: 9, WrittenAt: saved}, HistoryFrom: &from, Files: backupFilesNotCopied} |
| + } |
| + for _, c := range []struct { |
| + saved time.Time |
| + time, day string |
| + historyDay string |
| + }{ |
| + {time.Date(2026, 11, 11, 14, 2, 0, 0, time.FixedZone("CET", 3600)), "13:02 UTC", "today", "4 Nov"}, |
| + {time.Date(2026, 11, 10, 23, 59, 0, 0, time.UTC), "23:59 UTC", "Tue 10 Nov", "4 Nov"}, |
| + {time.Date(2025, 12, 31, 8, 0, 0, 0, time.UTC), "08:00 UTC", "Wed 31 Dec 2025", "4 Nov"}, |
| + } { |
| + s := backupsSectionFor(view(c.saved), "kass", "keep.carlosapp.dev", now) |
| + if s.SavedTime != c.time || s.SavedDay != c.day || s.HistoryDay != c.historyDay { |
| + t.Errorf("saved %s: tiles %q %q %q, want %q %q %q", c.saved, s.SavedTime, s.SavedDay, s.HistoryDay, c.time, c.day, c.historyDay) |
| + } |
| + } |
| + // A history shorter than a day: the example is inside it, not a day ago. |
| + short := time.Date(2026, 11, 11, 10, 0, 1, 0, time.UTC) |
| + s := backupsSectionFor(backupsView{Class: backupReplicated, CopiedTo: &backupsPosition{WrittenAt: now.Add(-time.Minute)}, HistoryFrom: &short}, "kass", "h.example.com", now) |
| + if !strings.Contains(s.PullAt, "--at 2026-11-11T10:01:00Z ") { |
| + t.Errorf("short history: %q", s.PullAt) |
| + } |
| + // No history known: a day ago, on the hour. |
| + s = backupsSectionFor(backupsView{Class: backupReplicated, CopiedTo: &backupsPosition{WrittenAt: now.Add(-time.Minute)}}, "kass", "h.example.com", now) |
| + if !strings.Contains(s.PullAt, "--at 2026-11-10T15:00:00Z ") || s.HistoryDay != "" { |
| + t.Errorf("unknown history: %q, history %q", s.PullAt, s.HistoryDay) |
| + } |
| +} |
| + |
| +// TestInstancePageBackupsKnownGaps: every instance the platform keeps no |
| +// copy of, or doesn't show here, shows the same shape (the table, its |
| +// chip and one reason line) and no tiles; only those db pull can serve |
| +// show the command. |
| +func TestInstancePageBackupsKnownGaps(t *testing.T) { |
| + no := false |
| + fx, c := backupsPageFixture(t, nil) |
| + fx.srv.dbReplica = func(_ context.Context, prefix string) (replicaReader, error) { |
| + switch prefix { |
| + case "instances/empty.carlosapp.dev": |
| + return emptyReplica{}, nil |
| + case "instances/large.carlosapp.dev": |
| + return backupsFailReplica{err: context.DeadlineExceeded}, nil |
| + } |
| + return backupsFailReplica{err: errors.New("listing failed")}, nil |
| + } |
| + for _, rec := range []provision.Record{ |
| + {Host: "awake.carlosapp.dev", Hibernate: &no}, |
| + {Host: "addr.carlosapp.dev", Addr: "127.0.0.1:9000"}, |
| + {Host: "site.carlosapp.dev", Kind: "static"}, |
| + {Host: "demo.carlosapp.dev", Demo: &demo.Descriptor{ID: "d1", Host: "demo.carlosapp.dev"}}, |
| + {Host: "pool.carlosapp.dev", Pool: "shared"}, |
| + {Host: "fleet.carlosapp.dev", Region: "fleet/acme"}, |
| + {Host: "empty.carlosapp.dev"}, |
| + {Host: "large.carlosapp.dev"}, |
| + {Host: "broken.carlosapp.dev"}, |
| + } { |
| + putBackupsHost(t, fx, rec) |
| + } |
| + for _, c2 := range []struct { |
| + host, chip, why string |
| + command bool |
| + }{ |
| + {"awake.carlosapp.dev", `<span class="chip chip-stale">Not copied</span>`, "This instance never sleeps, so we don't copy it yet.", false}, |
| + {"addr.carlosapp.dev", `<span class="chip chip-stale">Not copied</span>`, "It runs outside the platform, so we can't copy it.", false}, |
| + {"site.carlosapp.dev", `<span class="chip chip-stale">Not copied</span>`, "site.carlosapp.dev is a redirect or site, with no database.", false}, |
| + {"demo.carlosapp.dev", `<span class="chip chip-stale">Not copied</span>`, "Demo data isn't kept.", false}, |
| + {"pool.carlosapp.dev", `<span class="chip chip-env">Not shown here</span>`, "Copies of pooled instances aren't shown here yet.", false}, |
| + {"fleet.carlosapp.dev", `<span class="chip chip-env">Not shown here</span>`, "Copies on your own servers aren't shown here yet.", false}, |
| + {"empty.carlosapp.dev", `<span class="chip chip-env">Nothing yet</span>`, "Check back in a minute.", false}, |
| + {"large.carlosapp.dev", `<span class="chip chip-env">Can't read now</span>`, "", true}, |
| + {"broken.carlosapp.dev", `<span class="chip chip-env">Can't read now</span>`, "", false}, |
| + } { |
| + t.Run(c2.host, func(t *testing.T) { |
| + sec := backupsPage(t, fx, c, c2.host) |
| + if sec == "" { |
| + t.Fatal("no backups section") |
| + } |
| + if want := `<tr><td>Database</td><td>` + c2.chip + `</td></tr>`; !strings.Contains(sec, want) { |
| + t.Errorf("missing %q in %s", want, sec) |
| + } |
| + if !strings.Contains(sec, `<tr><td>Files on disk</td><td><span class="chip chip-stale">Not copied</span></td></tr>`) { |
| + t.Errorf("files row: %s", sec) |
| + } |
| + if c2.why != "" && !strings.Contains(sec, `<p class="small">`+pageText(c2.why)+`</p>`) { |
| + t.Errorf("missing the reason %q in %s", c2.why, sec) |
| + } |
| + // One small line per command label, and one for the reason. |
| + lines := 0 |
| + if c2.command { |
| + lines += 2 |
| + } |
| + if c2.why != "" { |
| + lines++ |
| + } |
| + if n := strings.Count(sec, `<p class="small">`); n != lines { |
| + t.Errorf("%d small lines, want %d: %s", n, lines, sec) |
| + } |
| + if strings.Contains(sec, "Last change saved") || strings.Contains(sec, "stat-tiles") { |
| + t.Errorf("tiles without a position: %s", sec) |
| + } |
| + if got := strings.Contains(sec, "carlos db pull"); got != c2.command { |
| + t.Errorf("command shown = %v, want %v: %s", got, c2.command, sec) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// emptyReplica lists nothing at any level: nothing replicated yet. |
| +type emptyReplica struct{} |
| + |
| +func (emptyReplica) LTXFiles(context.Context, int, ltx.TXID, bool) (ltx.FileIterator, error) { |
| + return ltx.NewFileInfoSliceIterator(nil), nil |
| +} |
| + |
| +func (emptyReplica) OpenLTXFile(context.Context, int, ltx.TXID, ltx.TXID, int64, int64) (io.ReadCloser, error) { |
| + return nil, os.ErrNotExist |
| +} |
| + |
| +// TestInstancePageBackupsOtherRegion: an instance kept in another region |
| +// says so, names the region, and still shows the command, since db pull |
| +// forwards to that region. |
| +func TestInstancePageBackupsOtherRegion(t *testing.T) { |
| + fx, c := backupsPageFixture(t, nil) |
| + putBackupsHost(t, fx, provision.Record{Host: "far.carlosapp.dev", Region: "uk"}) |
| + far := regionlabel.ForCode("uk", fx.srv.regionHome(), fx.srv.regionNames()).Text |
| + if far == "" { |
| + t.Fatal("no label for uk") |
| + } |
| + sec := backupsPage(t, fx, c, "far.carlosapp.dev") |
| + for _, want := range []string{ |
| + `<tr><td>Database</td><td><span class="chip chip-env">Not shown here</span></td></tr>`, |
| + `<p class="small">` + pageText("Copies in "+far+" aren't shown here yet. You can still download one.") + `</p>`, |
| + "<pre><code>carlos db pull --app kass --instance far.carlosapp.dev --out far.db</code></pre>", |
| + "--at ", |
| + } { |
| + if !strings.Contains(sec, want) { |
| + t.Errorf("missing %q in %s", want, sec) |
| + } |
| + } |
| + if strings.Contains(sec, "stat-tiles") { |
| + t.Errorf("tiles for another region's instance: %s", sec) |
| + } |
| +} |
| + |
| +// TestInstancePageBackupsNoForbiddenWords: across every class the section |
| +// says none of the words that would overclaim the copy. |
| +func TestInstancePageBackupsNoForbiddenWords(t *testing.T) { |
| + no := false |
| + now := time.Now() |
| + fx, c := backupsPageFixture(t, map[string]replicaReader{ |
| + "instances/keep.carlosapp.dev": spanReplica{from: now.Add(-24 * time.Hour), to: now.Add(-time.Minute)}, |
| + "instances/empty.carlosapp.dev": emptyReplica{}, |
| + }) |
| + recs := []provision.Record{ |
| + {Host: "keep.carlosapp.dev"}, |
| + {Host: "ha.carlosapp.dev", HA: true}, |
| + {Host: "awake.carlosapp.dev", Hibernate: &no}, |
| + {Host: "addr.carlosapp.dev", Addr: "127.0.0.1:9000"}, |
| + {Host: "site.carlosapp.dev", Kind: "static"}, |
| + {Host: "demo.carlosapp.dev", Demo: &demo.Descriptor{ID: "d1", Host: "demo.carlosapp.dev"}}, |
| + {Host: "pool.carlosapp.dev", Pool: "shared"}, |
| + {Host: "fleet.carlosapp.dev", Region: "fleet/acme"}, |
| + {Host: "far.carlosapp.dev", Region: "uk"}, |
| + {Host: "empty.carlosapp.dev"}, |
| + {Host: "broken.carlosapp.dev"}, |
| + } |
| + for _, rec := range recs { |
| + putBackupsHost(t, fx, rec) |
| + } |
| + for _, rec := range recs { |
| + sec := strings.ToLower(backupsPage(t, fx, c, rec.Host)) |
| + if sec == "" { |
| + t.Errorf("%s: no backups section", rec.Host) |
| + continue |
| + } |
| + for _, bad := range []string{"backed up", "up to date", "current", "✓", "✓", "✓"} { |
| + if strings.Contains(sec, bad) { |
| + t.Errorf("%s: the section says %q: %s", rec.Host, bad, sec) |
| + } |
| + } |
| + } |
| +} |
| + |
| +// TestInstancePageBackupsWithoutRecord: a route with no instance record |
| +// gets no section when it's an instance (nothing says what its copy is), |
| +// and its line when it's a site. |
| +func TestInstancePageBackupsWithoutRecord(t *testing.T) { |
| + fx, c := backupsPageFixture(t, nil) |
| + fx.addRoute(t, registry.Route{Host: "bare-site.carlosapp.dev", App: "kass", Account: fx.sqid, Kind: "static"}) |
| + if sec := backupsPage(t, fx, c, "kass.carlosapp.dev"); sec != "" { |
| + t.Errorf("a section for an instance with no record: %s", sec) |
| + } |
| + sec := backupsPage(t, fx, c, "bare-site.carlosapp.dev") |
| + if want := `<p class="small">bare-site.carlosapp.dev is a redirect or site, with no database.</p>`; !strings.Contains(sec, want) { |
| + t.Errorf("missing %q in %q", want, sec) |
| + } |
| +} |
diff --git a/internal/console/templates/app_instance.html b/internal/console/templates/app_instance.html| index 01c10c354..ce01e29d3 100644 |
| --- a/internal/console/templates/app_instance.html |
| +++ b/internal/console/templates/app_instance.html |
| @@ -59,5 +59,28 @@ |
| {{end}} |
| </section> |
| {{end}} |
| +{{with .Backups}}{{$c := $.BackupsCopy}} |
| +<section class="backups"> |
| + <div class="sectionhead"><h2 id="backups-heading">{{$c.Heading}}</h2></div> |
| + {{if .Tiles}}<section class="tiles stat-tiles" aria-labelledby="backups-heading"> |
| + <div class="tile"><h2>{{$c.SavedLabel}}</h2><p class="tile-value"><time datetime="{{.SavedAt}}">{{.SavedTime}}</time></p><p class="tile-detail">{{.SavedDay}}</p></div> |
| + <div class="tile"><h2>{{$c.HistoryLabel}}</h2>{{if .HistoryDay}}<p class="tile-value"><time datetime="{{.HistoryAt}}">{{.HistoryDay}}</time></p><p class="tile-detail">{{$c.HistoryDetail}}</p>{{else}}<p class="tile-value">—</p>{{end}}</div> |
| + <div class="tile"><h2>{{$c.TestLabel}}</h2><p class="tile-value">—</p><p class="tile-detail">{{$c.TestNone}}</p></div> |
| + </section>{{end}} |
| + <h3 class="small">{{$c.KeepHeading}}</h3> |
| + <div class="tablewrap"><table> |
| + <tr><td>{{$c.KeepDB}}</td><td><span class="chip {{.DBTone}}">{{.DBChip}}</span></td></tr> |
| + <tr><td>{{$c.KeepFiles}}</td><td><span class="chip {{.FilesTone}}">{{.FilesChip}}</span></td></tr> |
| + </table></div> |
| + {{with .Why}}<p class="small">{{.}}</p>{{end}} |
| + {{if .PullLatest}}<details class="reveal"> |
| + <summary>{{$c.CLISummary}}</summary> |
| + <p class="small">{{$c.CLILatest}}</p> |
| + <pre><code>{{.PullLatest}}</code></pre> |
| + <p class="small">{{$c.CLIAt}}</p> |
| + <pre><code>{{.PullAt}}</code></pre> |
| + </details>{{end}} |
| +</section> |
| +{{end}} |
| {{end}} |
| {{template "bottom" .}}{{end}} |