Ask: offer Carry on for a stopped job when Equipo says so
A job held because building was turned off for the person reads stopped, and once building is on again Equipo offers carry_on on it (plan AD4). Base's Card.CleanAt keeps carry_on on a stopped job card, and the page, ask.js and the app draw Carry on now for it as for a paused job, without the other plan's line. The fake's StopJob and carry_on accept it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 files changed,
+143
−21
docs/api/base-native-v1.md+6 −3internal/browsertest/ask_lookup_test.go+22 −0internal/equipo/chat.go+3 −2internal/equipo/equipo_test.go+20 −1internal/equipo/equipotest/chat.go+17 −1internal/look/static/ask.js+9 −4internal/web/templates/partials/chat.html+2 −2internal/webtest/ask_lookup_test.go+37 −0native/apple/Sources/BaseKit/API/Models.swift+4 −3native/apple/Sources/BaseKit/Ask/Pill.swift+5 −2native/apple/Tests/BaseKitTests/{LookupTests.swift => AbilitiesTests.swift}+18 −3
CI failed — run details
CI log
=== build === CGO_ENABLED=0 go build ./... === vet === go vet ./... === fmt-check === === staticcheck === go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./... === govulncheck === go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./... No vulnerabilities found. === gitleaks === [90m5:44PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net [90m5:44PM[0m [32mINF[0m [1m1 commits scanned.[0m [90m5:44PM[0m [32mINF[0m [1mscanned ~2783275 bytes (2.78 MB) in 722ms[0m [90m5:44PM[0m [32mINF[0m [1mno leaks found[0m === budget === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size budget size: 22 directories within budget === script-test === scripts/prepare-apps_test.sh ok releases lookup failure stops before ship ok app owned elsewhere stops the script ok apps listing failure stops before create ok ambiguous release dir is refused ok explicit version resolves the ambiguity ok releases match is exact, not substring ok shipped version is only promoted, existing app not created ok fresh account creates, ships, promotes to edge, enables ok failing promote stops the script ok ship is retried while uploads are rate limited all passed hack/fonts_test.sh fonts_test: ok === test === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 ./... budget: internal/webtest took 12.752s, over the 10s the default allows receipt: test step 15.025s against a 60s target (the gate's other steps are not in this figure) receipt: 16 packages ran, 0 cached, 6 without tests, 0 failed receipt: slow package 12.752s amadan.net/oficina/base/internal/webtest receipt: slow package 990ms amadan.net/oficina/base/internal/issuer receipt: slow package 732ms amadan.net/oficina/base/internal/equipo receipt: slow package 676ms amadan.net/oficina/base/internal/operations receipt: slow package 381ms amadan.net/oficina/base/internal/consumer receipt: slow test 1.53s amadan.net/oficina/base/internal/webtest TestHomeDoesNotWaitOnAStalledSnapshot receipt: slow test 1.17s amadan.net/oficina/base/internal/webtest TestAskZoneIsToldOnce receipt: slow test 650ms amadan.net/oficina/base/internal/issuer TestAuthorizeRefusals receipt: slow test 620ms amadan.net/oficina/base/internal/webtest TestAskUploadStalledBodyFreesItsSlot receipt: slow test 530ms amadan.net/oficina/base/internal/operations TestOperationsRefusals rastrillo: budget test: 1 problem(s) exit status 1 make: *** [Makefile:47: test] Error 1 amadan: step test failed: exit status 2 amadan: job failed at step test — its output is above, not at the tail of this log
diff --git a/docs/api/base-native-v1.md b/docs/api/base-native-v1.md| index dbdf38d..4b9df6a 100644 |
| --- a/docs/api/base-native-v1.md |
| +++ b/docs/api/base-native-v1.md |
| @@ -191,8 +191,11 @@ Equipo: `GET /ask/attachments/{id}`, and an image's thumbnail (at most |
| more and `started_at` when it began. A `paused` job carries on by itself |
| (draw it with the clock mark); its `result` and `detail` are Equipo's, |
| already in the team's time zone ("Paused until 21:00"): show them as |
| - given. `carry_on: true` (on a `paused` job card only, else absent) offers |
| - "Carry on now" (`POST /ask/cards/{id}/carry_on`). |
| + given. `carry_on: true` (on a `paused` or `stopped` job card only, else |
| + absent) offers "Carry on now" (`POST /ask/cards/{id}/carry_on`). On a |
| + `paused` job it has the line "Uses your other plan, at no extra cost." |
| + under it; on a `stopped` one (a job held while building was turned off |
| + for the person, now on again) it has no line. |
| - `job` names the job card a card belongs to; `turn_id`, on a connect card |
| from the stream, the turn that raised it. |
| @@ -262,7 +265,7 @@ Form: `choice` (an option's `value`), `revision` (the card's, as seen) and |
| ### `POST /ask/cards/{id}/carry_on` |
| -A paused job's "Carry on now". Form: `revision` (the job card's, as seen) |
| +A paused or held job's "Carry on now". Form: `revision` (the job card's, as seen) |
| and `key`, a fresh idempotency key kept until an answer settles the |
| outcome (a resend after a network error or a `502` reuses it). |
diff --git a/internal/browsertest/ask_lookup_test.go b/internal/browsertest/ask_lookup_test.go| index dd3395d..2da207c 100644 |
| --- a/internal/browsertest/ask_lookup_test.go |
| +++ b/internal/browsertest/ask_lookup_test.go |
| @@ -110,3 +110,25 @@ func TestAskLookupMarkdownNoLinks(t *testing.T) { |
| t.Errorf("the script and the server draw differently:\n%s", got) |
| } |
| } |
| + |
| +// With scripts, a held job that offers it shows Carry on now in its view, |
| +// with no "other plan" line, and carries on in place (plan AD4). |
| +func TestStoppedCarryOnDrawn(t *testing.T) { |
| + rig, f := askBase(t) |
| + openPanel(t, rig) |
| + id := f.AskJob("Bakery website") |
| + f.StopJob(id, "Stopped", "Building is on again. You can carry on with this, or drop it.", true) |
| + job := `#ask-panel li.job[data-job="` + id + `"]` |
| + drive(t, rig, chromedp.Poll[chromedp.Void](`document.querySelector(`+strconv.Quote(job)+`)?.dataset.state === "stopped" && document.querySelector(`+strconv.Quote(job+` .jv-act`)+`) !== null`, |
| + chromedp.WithPollingTimeout(10*time.Second))) |
| + if got := harness.Evaluate[string](rig, `(() => { const f = document.querySelector(`+strconv.Quote(job+` .jv-act`)+`); |
| + return [f.querySelector("button").textContent, f.querySelectorAll("small").length].join("|"); })()`); got != "Carry on now|0" { |
| + t.Errorf("the held job's Carry on now: %s", got) |
| + } |
| + drive(t, rig, chromedp.Click(chromedp.CSS(job+` summary`)), chromedp.Sleep(250*time.Millisecond), |
| + chromedp.Click(chromedp.CSS(job+` .jv-act button`))) |
| + drive(t, rig, chromedp.Poll[chromedp.Void](`document.querySelector(`+strconv.Quote(job)+`)?.dataset.state === "working"`, chromedp.WithPollingTimeout(10*time.Second))) |
| + if n := len(f.Calls("/api/v1/assistant/cards/" + id + "/carry_on")); n != 1 { |
| + t.Errorf("carry on went %d times", n) |
| + } |
| +} |
diff --git a/internal/equipo/chat.go b/internal/equipo/chat.go| index ae126ce..6a5a652 100644 |
| --- a/internal/equipo/chat.go |
| +++ b/internal/equipo/chat.go |
| @@ -59,7 +59,8 @@ type Turn struct { |
| // sentence more and StartedAt when it began; Job is the job card a |
| // go-ahead or Publish card belongs to. A paused job's Result and Detail |
| // are already in the person's time zone ("Paused until 21:00"), and |
| -// CarryOn says the person may start it again now (CarryOnNow). |
| +// CarryOn says the person may start it again now (CarryOnNow): a paused |
| +// job, or a stopped one held while building was off, once it is on again. |
| type Card struct { |
| ID string `json:"id"` |
| Revision int64 `json:"revision"` |
| @@ -153,7 +154,7 @@ func (c Card) CleanAt(base string) (Card, bool) { |
| Options: []Option{}, Links: []Link{}, Result: c.Result} |
| if c.Kind == CardJob { |
| out.Detail, out.StartedAt = c.Detail, c.StartedAt |
| - out.CarryOn = c.CarryOn && c.State == JobPaused |
| + out.CarryOn = c.CarryOn && (c.State == JobPaused || c.State == JobStopped) |
| } else { |
| for _, o := range c.Options { |
| out.Options = append(out.Options, Option{Value: o.Value, Label: o.Label}) |
diff --git a/internal/equipo/equipo_test.go b/internal/equipo/equipo_test.go| index fdb1e82..a8463ac 100644 |
| --- a/internal/equipo/equipo_test.go |
| +++ b/internal/equipo/equipo_test.go |
| @@ -490,7 +490,6 @@ func TestCardCleanPausedJob(t *testing.T) { |
| } |
| for _, c := range []equipo.Card{ |
| {ID: "c_2", Kind: equipo.CardJob, State: equipo.JobWorking, CarryOn: true}, |
| - {ID: "c_3", Kind: equipo.CardJob, State: equipo.JobStopped, CarryOn: true}, |
| {ID: "c_4", Kind: equipo.CardOutcome, State: "open", CarryOn: true}, |
| } { |
| got, _ := c.Clean() |
| @@ -500,6 +499,26 @@ func TestCardCleanPausedJob(t *testing.T) { |
| } |
| } |
| +// A stopped job keeps carry_on: a job held because building was turned |
| +// off, once it is on again, carries on when the person says so (plan |
| +// AD4). Any card that isn't a job never has it. |
| +func TestCardCleanStoppedCarryOn(t *testing.T) { |
| + got, ok := equipo.Card{ID: "c_1", Revision: 2, Kind: equipo.CardJob, State: equipo.JobStopped, Question: "Bakery website", |
| + Result: "Stopped", Detail: "Building is on again. You can carry on with this, or drop it.", CarryOn: true}.Clean() |
| + if !ok || !got.CarryOn { |
| + t.Errorf("stopped job: %v %+v", ok, got) |
| + } |
| + for _, c := range []equipo.Card{ |
| + {ID: "c_2", Kind: equipo.CardOutcome, State: "open", CarryOn: true}, |
| + {ID: "c_3", Kind: equipo.CardQuestion, State: equipo.JobStopped, CarryOn: true}, |
| + {ID: "c_4", Kind: equipo.CardJob, State: equipo.JobReady, CarryOn: true}, |
| + } { |
| + if got, _ := c.Clean(); got.CarryOn { |
| + t.Errorf("%s %s kept carry_on", c.Kind, c.State) |
| + } |
| + } |
| +} |
| + |
| // CarryOnNow posts {revision, idempotency_key} with the key as the |
| // Idempotency-Key and reads the card back from {"card"}; the same key |
| // replays the answer; Equipo's 409s come back as errors with their codes. |
diff --git a/internal/equipo/equipotest/chat.go b/internal/equipo/equipotest/chat.go| index 6f031a4..7befe7d 100644 |
| --- a/internal/equipo/equipotest/chat.go |
| +++ b/internal/equipo/equipotest/chat.go |
| @@ -294,6 +294,22 @@ func (f *Fake) PauseJob(id, result, detail string, carryOn bool) { |
| } |
| } |
| +// StopJob moves job card id to stopped, with result and detail, and |
| +// carryOn saying whether the person may carry it on now (a job held |
| +// because building was turned off, once it is on again): a new revision, |
| +// announced. |
| +func (f *Fake) StopJob(id, result, detail string, carryOn bool) { |
| + f.SetJob(id, equipo.JobStopped, result, detail) |
| + f.cmu.Lock() |
| + defer f.cmu.Unlock() |
| + for _, c := range f.cards { |
| + if c.ID == id && c.CarryOn != carryOn { |
| + c.CarryOn, c.Revision = carryOn, c.Revision+1 |
| + f.emit("card", "card", c.ID, c.Revision, "", *c) |
| + } |
| + } |
| +} |
| + |
| // SetJobStarted moves when job card id started to at: a new revision, |
| // announced. |
| func (f *Fake) SetJobStarted(id string, at time.Time) { |
| @@ -877,7 +893,7 @@ func (f *Fake) carryOn(w http.ResponseWriter, r *http.Request, id string) { |
| writeJSON(w, 200, map[string]any{"card": *c}) |
| case c.Revision != in.Revision: |
| conflict("card_stale") |
| - case c.State != equipo.JobPaused: |
| + case c.State != equipo.JobPaused && c.State != equipo.JobStopped: |
| conflict("not_paused") |
| case !c.CarryOn: |
| conflict("carry_on_unavailable") |
diff --git a/internal/look/static/ask.js b/internal/look/static/ask.js| index 720b6a0..1c699ab 100644 |
| --- a/internal/look/static/ask.js |
| +++ b/internal/look/static/ask.js |
| @@ -848,7 +848,7 @@ function start(root) { |
| header.append(stateMark(c.state), h3, close); |
| view.append(header, para("jv-stage", c.result || "")); |
| if (c.detail) view.append(para("jv-detail", c.detail)); |
| - if (c.state === "paused" && c.carry_on === true) view.append(carryOn(c)); |
| + if ((c.state === "paused" || c.state === "stopped") && c.carry_on === true) view.append(carryOn(c)); |
| const ended = document.createElement("ol"); |
| ended.className = "jv-cards"; |
| view.append(ended); |
| @@ -885,11 +885,16 @@ function start(root) { |
| b.className = "btn ghost"; |
| b.type = "submit"; |
| b.textContent = "Carry on now"; |
| - const note = document.createElement("small"); |
| - note.textContent = "Uses your other plan, at no extra cost."; |
| const error = para("jv-error", ""); |
| error.setAttribute("role", "status"); |
| - form.append(rev, b, note, error); |
| + form.append(rev, b); |
| + // A held job (stopped) carries on on the same plan: no note. |
| + if (c.state === "paused") { |
| + const note = document.createElement("small"); |
| + note.textContent = "Uses your other plan, at no extra cost."; |
| + form.append(note); |
| + } |
| + form.append(error); |
| return form; |
| } |
diff --git a/internal/web/templates/partials/chat.html b/internal/web/templates/partials/chat.html| index 101a139..85f79cc 100644 |
| --- a/internal/web/templates/partials/chat.html |
| +++ b/internal/web/templates/partials/chat.html |
| @@ -17,12 +17,12 @@ |
| <ol class="job-cards">{{range .OpenCards}}{{template "ask-card" .}}{{end}}</ol></li>{{end}} |
| {{/* A job state's mark: working has none (the mark turns, in CSS); the rest are still icons: paused a clock (it carries on by itself), stopped a square (it waits for the person). ask.js has the same paths (marks), and so does the native app (BaseIcon). */}} |
| {{define "ask-mark"}}{{if eq . "asking"}}<svg viewBox="0 0 24 24"><path d="M9.2 9.2a2.9 2.9 0 0 1 5.6 1c0 2-2.8 2.4-2.8 4.3M12 18.2h.01"/></svg>{{else if eq . "ready"}}<svg viewBox="0 0 24 24"><path d="M8 16L16 8M9.5 8H16v6.5"/></svg>{{else if eq . "done"}}<svg viewBox="0 0 24 24"><path d="M6 12.5l4 4 8-9"/></svg>{{else if eq . "paused"}}<svg viewBox="0 0 24 24"><path d="M19.2 12a7.2 7.2 0 1 1-14.4 0a7.2 7.2 0 1 1 14.4 0zM12 8.6V12l2.4 1.6"/></svg>{{else if eq . "stopped"}}<svg viewBox="0 0 24 24"><path d="M9 7.5h6a1.5 1.5 0 0 1 1.5 1.5v6a1.5 1.5 0 0 1-1.5 1.5H9a1.5 1.5 0 0 1-1.5-1.5V9A1.5 1.5 0 0 1 9 7.5z"/></svg>{{end}}{{end}} |
| -{{/* The job view, opened from the pill: its title, the status, one sentence more, for a paused job that offers it "Carry on now" (assistant.job.carry_on, with assistant.job.carry_on_note under it: copy review 2026-11-24) posting the card's revision, the job's cards that have ended (each its question and how it ended: ask-jobcard), when it started, and once there is something to see the link to it. The title links to the job's own page in Equipo (Card.Equipo, "Open in Equipo" as its tooltip, an arrow on hover and focus): the only place the chat links there, never a step the person must take. Without scripts it opens in place under the pill; the panel's script makes it a popover beside the pill, or a sheet on a phone, and shows Close (ask.js, jobView). */}} |
| +{{/* The job view, opened from the pill: its title, the status, one sentence more, for a paused job that offers it "Carry on now" (assistant.job.carry_on, with assistant.job.carry_on_note under it: copy review 2026-11-24), and for a stopped one held while building was off, once it is on again, the same button with no note (abilities plan AD4) posting the card's revision, the job's cards that have ended (each its question and how it ended: ask-jobcard), when it started, and once there is something to see the link to it. The title links to the job's own page in Equipo (Card.Equipo, "Open in Equipo" as its tooltip, an arrow on hover and focus): the only place the chat links there, never a step the person must take. Without scripts it opens in place under the pill; the panel's script makes it a popover beside the pill, or a sheet on a phone, and shows Close (ask.js, jobView). */}} |
| {{define "ask-jobview"}}<section class="jobview" aria-label="{{.Question}}"><header><span class="state-mark" aria-hidden="true">{{template "ask-mark" .State}}</span> |
| <h3>{{with .Equipo}}<a class="jv-title" href="{{.URL}}" title="{{.Label}}" target="_blank" rel="noopener">{{$.Question}}<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6h9v9M18 6L7 17"/></svg></a>{{else}}{{.Question}}{{end}}</h3> |
| <button class="round" type="button" data-job-close aria-label="Close" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button></header> |
| <p class="jv-stage">{{.Result}}</p>{{with .Detail}}<p class="jv-detail">{{.}}</p>{{end}} |
| -{{- if and (eq .State "paused") .CarryOn}}<form class="jv-act" method="post" action="/ask/cards/{{.ID}}/carry_on"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="key" value="{{newKey}}"><button class="btn ghost" type="submit">Carry on now</button><small>Uses your other plan, at no extra cost.</small><p class="jv-error" role="status"></p></form>{{end}}<ol class="jv-cards">{{range .EndedCards}}{{template "ask-jobcard" .}}{{end}}</ol>{{with .StartedAt}}<p class="jv-started">{{startedText .}}</p>{{end}} |
| +{{- if and (or (eq .State "paused") (eq .State "stopped")) .CarryOn}}<form class="jv-act" method="post" action="/ask/cards/{{.ID}}/carry_on"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="key" value="{{newKey}}"><button class="btn ghost" type="submit">Carry on now</button>{{if eq .State "paused"}}<small>Uses your other plan, at no extra cost.</small>{{end}}<p class="jv-error" role="status"></p></form>{{end}}<ol class="jv-cards">{{range .EndedCards}}{{template "ask-jobcard" .}}{{end}}</ol>{{with .StartedAt}}<p class="jv-started">{{startedText .}}</p>{{end}} |
| {{- if or (eq .State "ready") (eq .State "done")}}{{with .Go}}<a class="jv-go" href="{{.URL}}" target="_blank" rel="noopener">{{.Label}}</a>{{end}}{{end}}</section>{{end}} |
| {{/* A job's card that has ended, in its view: the question and how it ended, nothing to press. The panel's script draws the same (ask.js, addCard). */}} |
| {{define "ask-jobcard"}}<li class="jv-card" data-card="{{.ID}}" data-revision="{{.Revision}}" data-for="{{.Job}}"><p class="jv-q">{{.Question}}</p><p class="jv-result">{{.Result}}</p></li>{{end}} |
diff --git a/internal/webtest/ask_lookup_test.go b/internal/webtest/ask_lookup_test.go| index 26b9498..d60042a 100644 |
| --- a/internal/webtest/ask_lookup_test.go |
| +++ b/internal/webtest/ask_lookup_test.go |
| @@ -172,3 +172,40 @@ func TestNativeWithoutClientHeaderGetsPlainLookups(t *testing.T) { |
| check("event", string(ev.Data), drawn) |
| } |
| } |
| + |
| +// A job held because building was turned off, once it is on again, offers |
| +// Carry on now, without scripts too: the form posts to the card's |
| +// carry_on, and no "other plan" line is drawn (plan AD4). |
| +func TestStoppedCarryOnDrawn(t *testing.T) { |
| + a, f := newAskApp(t) |
| + a.approveEquipo(f) |
| + id := f.AskJob("Bakery website") |
| + f.StopJob(id, "Stopped", "Building is on again. You can carry on with this, or drop it.", true) |
| + body := a.get("/ask").Body |
| + form := `<form class="jv-act" method="post" action="/ask/cards/` + id + `/carry_on">` |
| + if !strings.Contains(body, form) || !strings.Contains(body, ">Carry on now</button>") { |
| + t.Fatalf("no Carry on now for the stopped job:\n%s", body) |
| + } |
| + if strings.Contains(body, "Uses your other plan") { |
| + t.Errorf("the other plan's line is drawn for a held job") |
| + } |
| + rev := regexp.MustCompile(`action="/ask/cards/` + id + `/carry_on"><input type="hidden" name="revision" value="(\d+)">`).FindStringSubmatch(body) |
| + if rev == nil { |
| + t.Fatal("no revision in the form") |
| + } |
| + if r := a.post("/ask/cards/"+id+"/carry_on", url.Values{"revision": {rev[1]}, "key": {"held-1"}}); r.Code != 303 || r.Location() != "/ask" { |
| + t.Fatalf("carry on: %d %q", r.Code, r.Location()) |
| + } |
| + if n := len(f.Calls("/api/v1/assistant/cards/" + id + "/carry_on")); n != 1 { |
| + t.Errorf("carry on went %d times", n) |
| + } |
| + if body := a.get("/ask").Body; strings.Contains(body, form) { |
| + t.Errorf("Carry on now still offered once the job carried on") |
| + } |
| + // A stopped job that doesn't offer it has none. |
| + other := f.AskJob("Invoices") |
| + f.StopJob(other, "Stopped", "Building is turned off for you. Paul can turn it back on, or you can drop this.", false) |
| + if body := a.get("/ask").Body; strings.Contains(body, `action="/ask/cards/`+other+`/carry_on"`) { |
| + t.Errorf("Carry on now offered while building is off") |
| + } |
| +} |
diff --git a/native/apple/Sources/BaseKit/API/Models.swift b/native/apple/Sources/BaseKit/API/Models.swift| index 9e601bb..8c7b4e5 100644 |
| --- a/native/apple/Sources/BaseKit/API/Models.swift |
| +++ b/native/apple/Sources/BaseKit/API/Models.swift |
| @@ -309,7 +309,7 @@ public struct AskCard: Decodable, Sendable, Equatable, Identifiable { |
| public var startedAt: Date? |
| public var turnID: String |
| /// A paused job offers "Carry on now" (`carry_on`; Base sends it on a |
| - /// paused job card only). |
| + /// paused or stopped job card only). |
| public var carryOn: Bool |
| public init(id: String, revision: Int64 = 1, kind: String, state: String, question: String = "", options: [Option] = [], |
| @@ -335,8 +335,9 @@ public struct AskCard: Decodable, Sendable, Equatable, Identifiable { |
| public var isOpen: Bool { state == "open" } |
| public var isJob: Bool { kind == "job" } |
| public var jobState: JobState? { isJob ? JobState(rawValue: state) : nil } |
| - /// A paused job that offers "Carry on now". |
| - public var offersCarryOn: Bool { jobState == .paused && carryOn } |
| + /// A paused job that offers "Carry on now", or a stopped one held |
| + /// while building was off, once it is on again. |
| + public var offersCarryOn: Bool { (jobState == .paused || jobState == .stopped) && carryOn } |
| /// The kinds drawn as cards (ask.js `kinds`). |
| public static let drawnKinds: Set<String> = ["question", "confirm", "outcome", "connect"] |
| /// Where to see a job's work once there is something to see (ready, |
diff --git a/native/apple/Sources/BaseKit/Ask/Pill.swift b/native/apple/Sources/BaseKit/Ask/Pill.swift| index 230afa1..eb9a6a7 100644 |
| --- a/native/apple/Sources/BaseKit/Ask/Pill.swift |
| +++ b/native/apple/Sources/BaseKit/Ask/Pill.swift |
| @@ -253,8 +253,11 @@ public struct JobView: View { |
| Button(action: carryOn) { Text(BaseText.text("assistant.job.carry_on")) } |
| .buttonStyle(BaseButtonStyle(.ghost)) |
| .disabled(carrying) |
| - Text(BaseText.text("assistant.job.carry_on_note")) |
| - .font(BaseFont.body(13, relativeTo: .footnote)).foregroundStyle(p[.haze]) |
| + // A held job (stopped) carries on on the same plan: no note. |
| + if job.card.jobState == .paused { |
| + Text(BaseText.text("assistant.job.carry_on_note")) |
| + .font(BaseFont.body(13, relativeTo: .footnote)).foregroundStyle(p[.haze]) |
| + } |
| if let carryOnError { |
| Text(verbatim: carryOnError) |
| .font(BaseFont.body(13, relativeTo: .footnote)) |
diff --git a/native/apple/Tests/BaseKitTests/LookupTests.swift b/native/apple/Tests/BaseKitTests/AbilitiesTests.swift| similarity index 83% |
| rename from native/apple/Tests/BaseKitTests/LookupTests.swift |
| rename to native/apple/Tests/BaseKitTests/AbilitiesTests.swift |
| index f5a8090..3efa44e 100644 |
| --- a/native/apple/Tests/BaseKitTests/LookupTests.swift |
| +++ b/native/apple/Tests/BaseKitTests/AbilitiesTests.swift |
| @@ -5,9 +5,10 @@ import RastrilloTestSupport |
| import SwiftUI |
| import XCTest |
| -/// What the Assistant looked up for a reply (docs/api/base-native-v1.md, |
| -/// Lookup), drawn as the web draws it (chat.html `ask-lookup`). |
| -final class LookupTests: XCTestCase { |
| +/// The Assistant's abilities in the app: what it looked up for a reply |
| +/// (docs/api/base-native-v1.md, Lookup), drawn as the web draws it |
| +/// (chat.html `ask-lookup`), and a held job's Carry on now. |
| +final class AbilitiesTests: XCTestCase { |
| /// A reply's lookups decode with https sources only; one left without |
| /// a source, or without an answer, is dropped; a person's message has |
| /// none. The Sources line is the label, then each title (a link) and |
| @@ -90,4 +91,18 @@ final class LookupTests: XCTestCase { |
| try? await client.events(after: 7) { _, _ in } |
| XCTAssertEqual(inner.calls.map(\.path), ["/ask/state?client_caps=lookup_answers", "/ask/messages", "/ask/events?after=7&client_caps=lookup_answers"]) |
| } |
| + |
| + /// A job held while building was off, once it is on again, offers |
| + /// Carry on now as a paused one does (plan AD4); without carry_on, or |
| + /// in any other state, it doesn't. |
| + func testStoppedCarryOn() throws { |
| + func card(_ state: String, _ carryOn: Bool) throws -> AskCard { |
| + try JSONDecoder().decode(AskCard.self, from: Data(#"{"id":"c1","revision":3,"kind":"job","state":"\#(state)","question":"Bakery website","result":"Stopped","carry_on":\#(carryOn)}"#.utf8)) |
| + } |
| + XCTAssertTrue(try card("stopped", true).offersCarryOn) |
| + XCTAssertTrue(try card("paused", true).offersCarryOn) |
| + XCTAssertFalse(try card("stopped", false).offersCarryOn) |
| + XCTAssertFalse(try card("ready", true).offersCarryOn) |
| + XCTAssertFalse(try card("working", true).offersCarryOn) |
| + } |
| } |