BrokerError.Error() drops the broker Stage — provision-stage rent faults reach the S4a card unlabelled (rent-fails-clean passes /provision/i only by coincidence) #673

Closed
opened 2026-08-22 17:31:41 +00:00 by matou-build-agent · 4 comments

Symptom

internal/founding/access.go:169 — func (e *BrokerError) Error() string { return e.Message } — discards the Stage field ("claim" / "provision"). A correctly-surfaced provision-stage rent failure therefore reaches the S4a data-status="rent-error" card as its bare Message only, with no mention of the stage it failed at.

The rent-fails-clean honesty leg asserts the rent-error text matches /provision/i (tests/e2e/journey.rented.spec.ts:179-184). Today that assertion only passes by coincidence — the broker's literal fault string for the rehearsal fault happens to contain the word "provision". Any other provision-stage failure whose message does not contain that word would fail the same honesty check for the same underlying reason: the stage never actually reaches the UI.

Surfaced while fixing #672 (the transient post-create 404 that masked this leg's intended fault). Per #672's own note this is a separate, lower-severity gap and was deliberately NOT folded into #672's broker pollActive retry fix.

Why this needs a decision, not a mechanical patch

BrokerError.Error() is used as a plain error; the natural mechanical fix (prefix Stage into the string) changes an error message consumed in several places and is a blunt instrument. The real question is how Stage should reach the Vue S4a card — as a distinct field the card renders (a labelled "stage: provision" chip) vs. a formatted message vs. the test asserting on a data-status/data-field stage attribute rather than the free-text message. That's a small design/UX-contract call (DDR 0190's rent-error block), best made by a session/human, not guessed by a swarm agent.

Proposed direction (for triage to confirm)

Carry Stage to the S4a card explicitly — e.g. a data-field on the rent-error block populated from BrokerError.Stage — and change the rent-fails-clean assertion to check that structured stage rather than fishing for /provision/i in the free-text message. Then the honesty leg proves the stage genuinely propagated, not that a literal string happened to contain a word.

Found while working #672.

## Symptom `internal/founding/access.go:169` — `func (e *BrokerError) Error() string { return e.Message }` — discards the `Stage` field (`"claim"` / `"provision"`). A correctly-surfaced provision-stage rent failure therefore reaches the S4a `data-status="rent-error"` card as its bare `Message` only, with no mention of the stage it failed at. The `rent-fails-clean` honesty leg asserts the rent-error text matches `/provision/i` (`tests/e2e/journey.rented.spec.ts:179-184`). Today that assertion only passes by coincidence — the broker's literal fault string for the rehearsal fault happens to contain the word "provision". Any other provision-stage failure whose message does not contain that word would fail the same honesty check for the same underlying reason: the stage never actually reaches the UI. Surfaced while fixing #672 (the transient post-create 404 that masked this leg's intended fault). Per #672's own note this is a **separate, lower-severity gap** and was deliberately NOT folded into #672's broker `pollActive` retry fix. ## Why this needs a decision, not a mechanical patch `BrokerError.Error()` is used as a plain `error`; the natural mechanical fix (prefix `Stage` into the string) changes an error message consumed in several places and is a blunt instrument. The real question is **how `Stage` should reach the Vue S4a card** — as a distinct field the card renders (a labelled "stage: provision" chip) vs. a formatted message vs. the test asserting on a `data-status`/`data-field` stage attribute rather than the free-text message. That's a small design/UX-contract call (DDR 0190's `rent-error` block), best made by a session/human, not guessed by a swarm agent. ## Proposed direction (for triage to confirm) Carry `Stage` to the S4a card explicitly — e.g. a `data-field` on the `rent-error` block populated from `BrokerError.Stage` — and change the `rent-fails-clean` assertion to check that structured stage rather than fishing for `/provision/i` in the free-text message. Then the honesty leg proves the stage genuinely propagated, not that a literal string happened to contain a word. Found while working #672.
Author
Member

This was generated by AI during triage.

Verified. BrokerError.Error() returns e.Message only, dropping Stage. Confirmed by reading the struct and its sole Error() implementation, and by tracing that nothing between there and the frontend (the wasm bridge's draft() call, which surfaces err.Error() as the JS Error.message the S4a card renders into data-field="fault-line") ever reads Stage either. The rent-fails-clean e2e leg's /provision/i assertion (s4aRentExpectFail in the wizard fixtures) passes today only because the rehearsal broker's literal fault message happens to contain the word "provision" — exactly the coincidence the issue describes.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: this is not an open design question — DDR 0190 (accepted 2026-08-21) already answers it. The accepted p1-s4a-rent-a-server.html wireframe's data-field="fault-line" example content is literally provision — the broker couldn't create your server; nothing was left running. Try again. — i.e. the design contract is a single free-text line in {stage} — {message} form, not a separate structured data-field="stage" chip. The issue's "proposed direction" (a distinct stage field/attribute) would reopen an already-accepted design decision rather than implement it. The correct fix is the mechanical one the issue's own body calls "blunt" but is in fact exactly what the wireframe specifies: format Stage into the string in that shape, and stop relying on an incidental substring match to prove it.

Why this is a two-way door: it's a formatting change inside one method plus one test-assertion tightening — revertible with a follow-up commit, touches no security posture, no credentials, no member-facing trust surface, and destroys nothing.

What proves it:

  • The existing Go tests (TestRentServer_... in the founding package, TestClient_RentProvisionErrorIsBrokerError in the brokerclient package) assert on the *BrokerError's .Stage/.Message fields directly via errors.As, never on .Error()'s string shape — so they stay green through this change untouched.
  • The rent-fails-clean e2e leg already exercises exactly this path end-to-end against a real broker-reported provision failure, and its assertion is what needs tightening — from an incidental /provision/i substring match to an assertion that the fault-line genuinely carries the stage (e.g. anchored at the start of the string), so the leg proves the stage propagated rather than proving a lucky word collision.

Labelling bug + ready-for-agent with the brief below.

> *This was generated by AI during triage.* **Verified.** `BrokerError.Error()` returns `e.Message` only, dropping `Stage`. Confirmed by reading the struct and its sole `Error()` implementation, and by tracing that nothing between there and the frontend (the wasm bridge's `draft()` call, which surfaces `err.Error()` as the JS `Error.message` the S4a card renders into `data-field="fault-line"`) ever reads `Stage` either. The `rent-fails-clean` e2e leg's `/provision/i` assertion (`s4aRentExpectFail` in the wizard fixtures) passes today only because the rehearsal broker's literal fault message happens to contain the word "provision" — exactly the coincidence the issue describes. **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** this is not an open design question — DDR 0190 (accepted 2026-08-21) already answers it. The accepted `p1-s4a-rent-a-server.html` wireframe's `data-field="fault-line"` example content is literally `provision — the broker couldn't create your server; nothing was left running. Try again.` — i.e. the design contract is a single free-text line in **`{stage} — {message}`** form, not a separate structured `data-field="stage"` chip. The issue's "proposed direction" (a distinct stage field/attribute) would *reopen* an already-accepted design decision rather than implement it. The correct fix is the mechanical one the issue's own body calls "blunt" but is in fact exactly what the wireframe specifies: format `Stage` into the string in that shape, and stop relying on an incidental substring match to prove it. **Why this is a two-way door:** it's a formatting change inside one method plus one test-assertion tightening — revertible with a follow-up commit, touches no security posture, no credentials, no member-facing trust surface, and destroys nothing. **What proves it:** - The existing Go tests (`TestRentServer_...` in the founding package, `TestClient_RentProvisionErrorIsBrokerError` in the brokerclient package) assert on the `*BrokerError`'s `.Stage`/`.Message` fields directly via `errors.As`, never on `.Error()`'s string shape — so they stay green through this change untouched. - The `rent-fails-clean` e2e leg already exercises exactly this path end-to-end against a real broker-reported provision failure, and its assertion is what needs tightening — from an incidental `/provision/i` substring match to an assertion that the fault-line genuinely carries the stage (e.g. anchored at the start of the string), so the leg proves the stage propagated rather than proving a lucky word collision. Labelling `bug` + `ready-for-agent` with the brief below.
Author
Member

Agent Brief

Category: bug
Summary: BrokerError's error string drops the broker's failure Stage, so the S4a rent-error card can't reliably show which stage (claim vs provision) a rent failed at, and the leg that's supposed to prove this only passes by coincidence.

Current behavior:
A rent failure carries a Stage ("claim" or "provision") and a plain-language Message, but the error's string form — the thing that ultimately reaches the S4a card's single fault-line paragraph — surfaces Message alone. Stage is silently discarded between the broker boundary and the UI. The rent-fails-clean rehearsal leg asserts the rendered fault-line matches /provision/i, and today that only passes because the rehearsal broker's specific fault message happens to contain the literal word "provision" — any other provision-stage message without that word would fail the same check for the same underlying reason.

Desired behavior:
The error string reaching the S4a card's fault-line renders as {stage} — {message} (em dash), matching the accepted DDR 0190 wireframe contract's example content exactly (p1-s4a-rent-a-server.html's data-field="fault-line" block: provision — the broker couldn't create your server; nothing was left running. Try again.). This applies uniformly to both failure stages (claim and provision) — the type carries both today and the fix is generic, not provision-specific. No new DOM field or attribute is introduced; the existing single data-field="fault-line" paragraph is where the stage now visibly appears.

The rent-fails-clean leg's assertion should be tightened so it proves the stage genuinely propagated, not that a message happened to contain a matching word — e.g. assert the fault-line starts with the stage token, rather than a bare unanchored /provision/i substring search anywhere in the text.

Key interfaces:

  • The rent-failure error type's string form (Error() string) — currently returns the message field alone; should compose stage + message in the wireframe's established "{stage} — {message}" shape.
  • The rent-fails-clean e2e leg's fault-line assertion (currently an unanchored /provision/i match against the data-status="rent-error" block) — tighten to check the stage is actually what's driving the match, e.g. anchor the pattern at the start of the fault-line text.

Acceptance criteria:

  • A claim-stage rent failure's rendered fault-line text begins with claim — .
  • A provision-stage rent failure's rendered fault-line text begins with provision — .
  • Existing Go unit tests that assert on the error's Stage/Message struct fields directly (via errors.As) continue to pass unmodified — they don't depend on the string form's shape.
  • The rent-fails-clean e2e leg's fault-line assertion is provably keyed on the stage (e.g. anchored match), not an incidental substring anywhere in the message — a mutation test (temporarily change the rehearsal fault message to not contain "provision" while keeping Stage: "provision") would still pass with the new assertion and would have failed the old one.
  • No new data-field/data-status DOM attribute is added to the S4a wireframe or component — the fix stays inside the existing single fault-line paragraph, per DDR 0190's accepted contract.

Out of scope:

  • Reopening the DDR 0190 design decision itself (a distinct stage chip/attribute) — that contract is accepted; this ticket implements it, not redesigns it.
  • Any change to the claim-stage message wording beyond the stage prefix (e.g. "That community name is already taken…" stays as-is, just prefixed).
  • The broker service side (broker/) — it already reports {error, stage} correctly; the gap is entirely on the consuming side.
## Agent Brief **Category:** bug **Summary:** `BrokerError`'s error string drops the broker's failure `Stage`, so the S4a rent-error card can't reliably show which stage (`claim` vs `provision`) a rent failed at, and the leg that's supposed to prove this only passes by coincidence. **Current behavior:** A rent failure carries a `Stage` ("claim" or "provision") and a plain-language `Message`, but the error's string form — the thing that ultimately reaches the S4a card's single fault-line paragraph — surfaces `Message` alone. `Stage` is silently discarded between the broker boundary and the UI. The `rent-fails-clean` rehearsal leg asserts the rendered fault-line matches `/provision/i`, and today that only passes because the rehearsal broker's specific fault message happens to contain the literal word "provision" — any other provision-stage message without that word would fail the same check for the same underlying reason. **Desired behavior:** The error string reaching the S4a card's fault-line renders as `{stage} — {message}` (em dash), matching the accepted DDR 0190 wireframe contract's example content exactly (`p1-s4a-rent-a-server.html`'s `data-field="fault-line"` block: `provision — the broker couldn't create your server; nothing was left running. Try again.`). This applies uniformly to both failure stages (`claim` and `provision`) — the type carries both today and the fix is generic, not provision-specific. No new DOM field or attribute is introduced; the existing single `data-field="fault-line"` paragraph is where the stage now visibly appears. The `rent-fails-clean` leg's assertion should be tightened so it proves the stage genuinely propagated, not that a message happened to contain a matching word — e.g. assert the fault-line starts with the stage token, rather than a bare unanchored `/provision/i` substring search anywhere in the text. **Key interfaces:** - The rent-failure error type's string form (`Error() string`) — currently returns the message field alone; should compose stage + message in the wireframe's established `"{stage} — {message}"` shape. - The `rent-fails-clean` e2e leg's fault-line assertion (currently an unanchored `/provision/i` match against the `data-status="rent-error"` block) — tighten to check the stage is actually what's driving the match, e.g. anchor the pattern at the start of the fault-line text. **Acceptance criteria:** - [ ] A `claim`-stage rent failure's rendered fault-line text begins with `claim — `. - [ ] A `provision`-stage rent failure's rendered fault-line text begins with `provision — `. - [ ] Existing Go unit tests that assert on the error's `Stage`/`Message` struct fields directly (via `errors.As`) continue to pass unmodified — they don't depend on the string form's shape. - [ ] The `rent-fails-clean` e2e leg's fault-line assertion is provably keyed on the stage (e.g. anchored match), not an incidental substring anywhere in the message — a mutation test (temporarily change the rehearsal fault message to not contain "provision" while keeping `Stage: "provision"`) would still pass with the new assertion and would have failed the old one. - [ ] No new `data-field`/`data-status` DOM attribute is added to the S4a wireframe or component — the fix stays inside the existing single fault-line paragraph, per DDR 0190's accepted contract. **Out of scope:** - Reopening the DDR 0190 design decision itself (a distinct stage chip/attribute) — that contract is accepted; this ticket implements it, not redesigns it. - Any change to the `claim`-stage message wording beyond the stage prefix (e.g. "That community name is already taken…" stays as-is, just prefixed). - The broker service side (`broker/`) — it already reports `{error, stage}` correctly; the gap is entirely on the consuming side.
Author
Member

swarm-claim host=matou-dev-server-01 run=8917
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=8917 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #673 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 673,
  "status": "success",
  "commits": [
    "6a1b0cb9"
  ],
  "changed_files": [
    "STATUS.md",
    "app/tests/e2e/fixtures/wizard.ts",
    "internal/founding/access.go",
    "internal/founding/access_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go test ./internal/founding/ ./internal/brokerclient/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command bash -c 'gofmt -l internal/founding/access.go internal/founding/access_test.go && go vet ./internal/founding/ && go build ./...'",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A claim-stage rent failure's rendered fault-line text begins with 'claim — '": "internal/founding/access.go Error() composes '{stage} — {message}'; TestBrokerError_ErrorCarriesStage asserts claim case yields 'claim — that community name is already taken'",
    "A provision-stage rent failure's rendered fault-line text begins with 'provision — '": "same Error() path; TestBrokerError_ErrorCarriesStage asserts provision case; the fault-line renders err.message via the wasm bridge into FoundingAccess.vue data-field=fault-line",
    "Existing Go unit tests asserting on Stage/Message struct fields via errors.As continue to pass unmodified": "TestStory6_RentFailureLeavesNoHalfRentedServerAndReturnsToS4 and TestRentServer_BrokerErrorLeavesDraftUntouched unchanged; go test ./internal/founding green (exit 0)",
    "rent-fails-clean e2e assertion provably keyed on the stage (anchored match), a mutation of the fault message would still pass with the new assertion and fail the old": "app/tests/e2e/fixtures/wizard.ts s4aRentExpectFail now asserts [data-field=fault-line] toHaveText /^\\s*provision\\s+—\\s/i — anchored on the stage token, not an unanchored /provision/i substring",
    "No new data-field/data-status DOM attribute added to S4a wireframe or component": "no change to FoundingAccess.vue or p1-s4a-rent-a-server.html; fix stays inside the existing single data-field=fault-line paragraph — changed_files contains no .vue or wireframe .html"
  },
  "summary": "BrokerError.Error() composes the failure Stage into '{stage} — {message}' per DDR 0190 so the S4a fault-line carries the stage honestly, and the rent-fails-clean leg's assertion is anchored on the stage instead of an incidental /provision/i substring.",
  "blockers": []
}
**close-report** for #673 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 673, "status": "success", "commits": [ "6a1b0cb9" ], "changed_files": [ "STATUS.md", "app/tests/e2e/fixtures/wizard.ts", "internal/founding/access.go", "internal/founding/access_test.go" ], "tests": [ { "command": "nix develop .#go-ci --command go test ./internal/founding/ ./internal/brokerclient/", "exit_code": 0 }, { "command": "nix develop .#go-ci --command bash -c 'gofmt -l internal/founding/access.go internal/founding/access_test.go && go vet ./internal/founding/ && go build ./...'", "exit_code": 0 } ], "criteria": { "A claim-stage rent failure's rendered fault-line text begins with 'claim — '": "internal/founding/access.go Error() composes '{stage} — {message}'; TestBrokerError_ErrorCarriesStage asserts claim case yields 'claim — that community name is already taken'", "A provision-stage rent failure's rendered fault-line text begins with 'provision — '": "same Error() path; TestBrokerError_ErrorCarriesStage asserts provision case; the fault-line renders err.message via the wasm bridge into FoundingAccess.vue data-field=fault-line", "Existing Go unit tests asserting on Stage/Message struct fields via errors.As continue to pass unmodified": "TestStory6_RentFailureLeavesNoHalfRentedServerAndReturnsToS4 and TestRentServer_BrokerErrorLeavesDraftUntouched unchanged; go test ./internal/founding green (exit 0)", "rent-fails-clean e2e assertion provably keyed on the stage (anchored match), a mutation of the fault message would still pass with the new assertion and fail the old": "app/tests/e2e/fixtures/wizard.ts s4aRentExpectFail now asserts [data-field=fault-line] toHaveText /^\\s*provision\\s+—\\s/i — anchored on the stage token, not an unanchored /provision/i substring", "No new data-field/data-status DOM attribute added to S4a wireframe or component": "no change to FoundingAccess.vue or p1-s4a-rent-a-server.html; fix stays inside the existing single data-field=fault-line paragraph — changed_files contains no .vue or wireframe .html" }, "summary": "BrokerError.Error() composes the failure Stage into '{stage} — {message}' per DDR 0190 so the S4a fault-line carries the stage honestly, and the rent-fails-clean leg's assertion is anchored on the stage instead of an incidental /provision/i substring.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#673
No description provided.