Publish a withheld city reply from the mail reader (#138) - #37
Conversation
…tion # Conflicts: # apps/admin/src/features/mail/mail-page.tsx # apps/admin/src/features/mail/mail-presentation.test.ts # apps/admin/src/features/mail/mail-presentation.ts
|
| } | ||
| .mail-bounce-note { background: var(--bloom-50); color: var(--bloom-700); border: 1px solid color-mix(in oklab, var(--bloom) 18%, transparent); } | ||
| .mail-action-note { background: var(--sky-50); color: var(--sky-700); border: 1px solid color-mix(in oklab, var(--sky) 20%, transparent); } | ||
| .mail-withheld-note { margin-top: 8px; } |
There was a problem hiding this comment.
This new rule uses a raw 8px margin even though the frontend styling directive requires design tokens. Use the existing var(--space-2) token instead. This repository requirement must be satisfied before merging.
| .mail-withheld-note { margin-top: 8px; } | |
| .mail-withheld-note { margin-top: var(--space-2); } |
Rule Used: # civfix review rules civfix is a live civic-tech platform that will hold government contracts. Review every PR for correctness, security and performance. Flag real defects with evidence; skip style nits that lint already covers. ## Repos - **... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/admin/src/styles/admin.css
Line: 2847
Comment:
**Use the spacing token**
This new rule uses a raw `8px` margin even though the frontend styling directive requires design tokens. Use the existing `var(--space-2)` token instead. This repository requirement must be satisfied before merging.
```suggestion
.mail-withheld-note { margin-top: var(--space-2); }
```
**Rule Used:** # civfix review rules civfix is a live civic-tech platform that will hold government contracts. Review every PR for **correctness, security and performance**. Flag real defects with evidence; skip style nits that lint already covers. ## Repos - **... ([source](https://app.greptile.com/civfix/-/custom-context?memory=39a53925-3d93-4c82-980e-27b67393717d))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| it("asks the operator to confirm before publishing", () => { | ||
| const source = readFileSync(new URL("./withheld-reply-note.tsx", import.meta.url), "utf8") | ||
| const confirm = source.indexOf("await confirmDialog(") | ||
| expect(confirm).toBeGreaterThan(-1) | ||
| expect(source.indexOf("if (!ok) return")).toBeGreaterThan(confirm) | ||
| expect(source.indexOf("publish.mutate(")).toBeGreaterThan(source.indexOf("if (!ok) return")) | ||
| }) |
There was a problem hiding this comment.
This test only checks the order of strings in the component source. It never renders the publish button or verifies that cancelling avoids publication and confirming sends the selected reply. The current interaction works, but this test can still pass if that irreversible behavior regresses, allowing accidental publication or preventing intended publication without test detection. Replace or supplement it with a rendered interaction test for both paths.
Artifacts
- The executable harness transpiles and renders the production withheld-reply component with controlled dialog and mutation collaborators, then records both operator paths; it provides focused behavioral coverage.
- Running `node trex-artifacts/withheld-reply-flow-validation.mjs` from `/home/user/repo` exited 0; cancel made no publish call and confirm published the expected thread and message IDs.
- The rendered component opens its irreversible publish confirmation and the operator cancels it; no publication occurs.
Poster frame after canceling withheld reply publication
- The cancel-path poster shows the rendered validation state after dismissal with an empty publish-call list; cancellation prevents publication.
- The rendered component accepts confirmation and invokes publication for `thread-7` and `message-9`; confirmation triggers the irreversible action.
Poster frame after confirming withheld reply publication
- The confirm-path poster shows the expected publish payload and success toast after dialog acceptance; confirmation publishes the selected reply.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/admin/src/features/mail/use-mail.test.ts
Line: 39-45
Comment:
**Cover publish confirmation**
This test only checks the order of strings in the component source. It never renders the publish button or verifies that cancelling avoids publication and confirming sends the selected reply. The current interaction works, but this test can still pass if that irreversible behavior regresses, allowing accidental publication or preventing intended publication without test detection. Replace or supplement it with a rendered interaction test for both paths.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comments Outside DiffThese findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.
|
Part of civfix/issue-tracker#138
What changed
An operator can publish a city reply the server held back, from the mail reader, after a confirmation. It then reaches the report chat or the event timeline. Admin.
Before you start
mainpushVerify
[Admin]
Regression
Needs-action thread with no withheld reply — [Admin]
Leaving a reply withheld — [Admin]
Replying to the city — [Admin]
Published replies — [Admin]
Not covered