The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(feedback): cover the type-pill guard that keeps warned-submission advice\n\nThe guard added in the previous commit is a deliberate behaviour change with no\ntest, which is fair to object to: re-clicking the already-selected type pill used\nto call `setSubmittedQuality(null)` and discard the advice from an\naccepted-with-warning submission, and now it does not.\n\nIt was intentional. The advice outlives the draft it was about, so the only thing\nthat should discard it is an edit, and selecting the type you are already on is\nnot one. This PR also made it far easier to hit: the control went from two\nfull-width buttons, where re-clicking the active one was an unlikely misclick, to\nadjacent pills where it is an easy one.\n\nTwo tests, because the guard has two halves and only one of them is the change:\n\n- `keeps warned-submission advice when the already-selected type is re-clicked`\n is the new behaviour. Revert-checked: with both guards removed it fails on\n "Unable to find an element with the text: Add steps to reproduce.", naming the\n assertion rather than erroring in setup.\n- `discards warned-submission advice when the type actually changes` pins the\n behaviour the guard must NOT swallow. It passes either way by design -- a\n guard that skipped the reset outright would leave stale advice on a draft\n whose type just changed, and this is what would catch that.\n\nClaude-Session: https://claude.ai/code/session_016mWvL5s6eJP7gUeaw5AsMT\n
M3gA-Mind0ed229ab8bf4
diff --git a/app/src/components/feedback/FeedbackSubmitForm.test.tsx b/app/src/components/feedback/FeedbackSubmitForm.test.tsxindex 8d334ed903..22ebd6cba2 100644--- a/app/src/components/feedback/FeedbackSubmitForm.test.tsx+++ b/app/src/components/feedback/FeedbackSubmitForm.test.tsx@@ -215,6 +215,56 @@ describe('<FeedbackSubmitForm /> quality tiers', () => {expect(await screen.findByText('Add steps to reproduce.')).toBeInTheDocument();});+ // The advice from an accepted-with-warning submission outlives the draft it+ // was about, so the only thing that should discard it is an edit. Selecting+ // the type you are already on is not an edit -- and it went from an unlikely+ // misclick on a full-width button to an easy one on an adjacent pill.+ it('keeps warned-submission advice when the already-selected type is re-clicked', async () => {+ mockValidate.mockResolvedValue({ tier: 'warn', reason: 'Add steps to reproduce.' });+ mockSubmit.mockResolvedValueOnce({+ accepted: true,+ reason: 'ok',+ feedback: makeItem(),+ quality: { tier: 'warn', reason: 'Add steps to reproduce.' },+ });++ render(<FeedbackSubmitForm onAccepted={() => {}} />);+ fillForm('Crash', 'It crashes.');+ await screen.findByTestId('feedback-quality-hint');+ fireEvent.click(screen.getByRole('button', { name: 'Submit' }));+ expect(await screen.findByText('Add steps to reproduce.')).toBeInTheDocument();++ // `feature` is the default, so this is the pill that is already active.+ fireEvent.click(screen.getByRole('button', { name: 'Feature' }));++ expect(screen.getByText('Add steps to reproduce.')).toBeInTheDocument();+ });++ // The other half of the same guard: it must skip the reset only when the type+ // is unchanged. A guard that swallowed the reset outright would leave stale+ // advice attached to a draft whose type just changed.+ it('discards warned-submission advice when the type actually changes', async () => {+ mockValidate.mockResolvedValue({ tier: 'warn', reason: 'Add steps to reproduce.' });+ mockSubmit.mockResolvedValueOnce({+ accepted: true,+ reason: 'ok',+ feedback: makeItem(),+ quality: { tier: 'warn', reason: 'Add steps to reproduce.' },+ });++ render(<FeedbackSubmitForm onAccepted={() => {}} />);+ fillForm('Crash', 'It crashes.');+ await screen.findByTestId('feedback-quality-hint');+ fireEvent.click(screen.getByRole('button', { name: 'Submit' }));+ expect(await screen.findByText('Add steps to reproduce.')).toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Bug' }));++ await waitFor(() =>+ expect(screen.queryByText('Add steps to reproduce.')).not.toBeInTheDocument()+ );+ });+// apiClient rejects with a plain `{ success, error }` object, not an Error.// Without handling that shape the server's reason is replaced by the generic// failure copy, and a blocked submitter is told nothing useful.