Skip to content

fix(app): require review notes to contain readable text - #382

Open
GamingDragonwastaken wants to merge 1 commit into
bluelearn-org:mainfrom
GamingDragonwastaken:fix/require-meaningful-review-notes
Open

fix(app): require review notes to contain readable text#382
GamingDragonwastaken wants to merge 1 commit into
bluelearn-org:mainfrom
GamingDragonwastaken:fix/require-meaningful-review-notes

Conversation

@GamingDragonwastaken

@GamingDragonwastaken GamingDragonwastaken commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #341.

The client checked notes.length === 0, while createDecisionSchema requires z.string().trim().min(1). A whitespace-only note therefore passed the client gate and failed at the API, showing a generic error instead of the sidebar's own message.

Now checks that the note contains a letter or number, so whitespace and bare punctuation are caught before submitting. The check moved to lib/reviewValidation.ts so it can be unit tested; the call site is otherwise unchanged.

One question: this is deliberately stricter than the schema — "..." passes zod but fails here — matching "at least one word" from the issue. Happy to relax it to a plain trim, or to tighten createDecisionSchema so both match. Say which and I'll push a follow-up.

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Build / tooling / CI
  • Other: _________

Verification

  • pnpm -r typecheck passes
  • pnpm -r build passes
  • Manually verified in a browser (for UI / behavior changes) — see below
  • Followed the app layout conventions
  • No new dependencies, or new dependencies are justified and AGPL-compatible
  • Change does not violate any non-negotiable principle
  • Documentation only, no changes to the codebase, so no tests required

41 tests pass (13 new). I couldn't exercise the sidebar in a browser — reaching a case needs a local Supabase and I don't have Docker on this machine — so the logic is covered by unit tests instead.

@andyrodrigues30

Copy link
Copy Markdown
Collaborator

@GamingDragonwastaken - we appreciate the work you have done on this.

In order for our PR reviews to be more efficient please can you keep the summary short and concise.

Thank you!

@GamingDragonwastaken

Copy link
Copy Markdown
Contributor Author

Apologies, and thanks for the feedback — that's fair. I've trimmed the description down to the problem, the change, and the one open question. I'll keep summaries short going forward and let the diff speak for itself.

Rejecting a guide is supposed to carry a note the author can act on, but
the client only checked `notes.length === 0`. A note of pure whitespace
cleared that check and was submitted, where `createDecisionSchema`
rejected it against `z.string().trim().min(1)`. The reviewer got a
generic API error instead of the guidance the sidebar already knows how
to give, after a needless round trip.

Validate on whether the note contains a letter or a number instead, so
whitespace and bare punctuation are caught before submitting. The
character class is Unicode-aware, so notes written in non-Latin scripts
count as text.

The check moves to `lib/reviewValidation.ts` alongside the existing
`reviewDeadline` helper. It was previously a closure inside the
component, which meant it could not be tested without mounting the whole
review sidebar and its router and revision data.

No copy changes: a blank note still reports "Rejections require a note",
matching what the field already asked for.

Closes bluelearn-org#341

Signed-off-by: Anas Hasanin <98191932+GamingDragonwastaken@users.noreply.github.com>
@GamingDragonwastaken
GamingDragonwastaken force-pushed the fix/require-meaningful-review-notes branch from 7577ed7 to b809b68 Compare August 29, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Make review notes required for rejected

2 participants