[follow-up] app password issuance swallows Stalwart notCreated reason
closedContext
Found while diagnosing the order-dependent TestIntegrationAppViewUI 500 (bug 1344bf0): the dev harness held a stale account at Stalwart’s 5-app-password quota, so x:AppPassword/set answered notCreated: {ap0: {type: "overQuota", ...}} — but neither issuance path decodes notCreated, so both surfaced the opaque server returned no created app password and the UI returned a bare 500. The real reason was only visible via a manual JMAP probe.
Task
- Decode
notCreatedin thex:AppPassword/setresponses ininternal/appwd/appwd.go(Issue) andinternal/account/account.go(IssuePassword); whencreated.ap0is absent butnotCreated.ap0is present, return an error carrying its type + description (keep the existing message as the fallback when neither is present). - Cover with unit tests using the existing stub-server pattern (
internal/account/account_test.gonewStub; newinternal/appwd/appwd_test.go— the package has none): anotCreated/overQuotaresponse must surfaceoverQuotaand the server description in the returned error. - Re-run
go test ./internal/appwd/ ./internal/account/plus the full integration package to green.
Acceptance
- Unit tests prove a
notCreatedrefusal surfaces its type/description instead of the generic message; suites green. No behavior change on the success path.
1 Comment
Fixed (commit
cc18d45f, TDD: failing tests first)internal/appwd/appwd.go(Issue) andinternal/account/account.go(IssuePassword) now decodenotCreatedon thex:AppPassword/setresponse. Whencreated.ap0is absent butnotCreated.ap0is present, the error carries the server type + description, e.g.appwd: app password not created (overQuota): You have exceeded your quota of 5 app passwords.The old generic message remains as the fallback when neither map has the key. No behavior change on the success path.Tests: new
internal/appwd/appwd_test.go(package previously had none; minimal stub server) plusTestIssuePasswordNotCreatedSurfacesReasonininternal/account/account_test.go— both watched fail with the swallowed message before the fix.Verification:
go test ./...(unit) green, fullSOVRN_INTEGRATION=1integration package 8⁄8 PASS, gofmt/vet clean. Left open for your review.