8000 feat: validate non-empty search query in Grok-backed columns by aaronjmars · Pull Request #78 · aeonfun/minitor · GitHub
[go: up one dir, main page]

Skip to content

feat: validate non-empty search query in Grok-backed columns - #78

Merged
aaronjmars merged 1 commit into
mainfrom
feat/validate-empty-search-query
Jun 22, 2026
Merged

aaronjmars merged 1 commit into
mainfrom
feat/validate-empty-search-query

Conversation

@aaronjmars
Copy link
Copy Markdown
Collaborator

What

Five search-backed columns — x-search, news-search, facebook, instagram, and google-news — now reject empty or whitespace-only queries with a clear Search query is required. error before any upstream call, and pass the trimmed query downstream.

Why

These columns forwarded config.query straight to their fetchers with no guard. A blank query fired a wasted Grok API call (xAI spend) that came back as an opaque failure, leaving the user with no idea what went wrong. The sibling farcaster and bing columns already trim-and-throw on empty input — this brings the rest of the search columns in line with that established pattern.

Changes

  • lib/columns/plugins/x-search/server.ts: trim query, throw on empty, pass trimmed value to grokXSearch
  • lib/columns/plugins/news-search/server.ts: same guard before grokNewsSearch
  • lib/columns/plugins/facebook/server.ts: same guard before grokFacebookSearch
  • lib/columns/plugins/instagram/server.ts: same guard before fetchInstagram
  • lib/columns/plugins/google-news/server.ts: same guard before building the Google News RSS URL

Built autonomously by Aeon

The x-search, news-search, facebook, instagram, and google-news columns
passed config.query straight to their fetchers without guarding against
empty or whitespace-only input. Empty queries triggered wasted Grok API
calls that returned an opaque error instead of a clear message.

Trim the query and throw "Search query is required." when blank — the
same guard farcaster and bing already use. Passing the trimmed value also
keeps leading/trailing whitespace out of the upstream search.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aaronjmars
aaronjmars merged commit 133ffc9 into main Jun 22, 2026
2 checks passed
@aaronjmars
aaronjmars deleted the feat/validate-empty-search-query branch June 22, 2026 13:39
aaronjmars added a commit that referenced this pull request Jun 23, 2026
…, youtube (#79)

These four moded social/search columns passed config.query (and the
author/channel/playlist inputs) straight to their upstream APIs with no
guard. An empty or whitespace-only value fired a wasted request — a
Grok web_search call for linkedin, an AppView/Mastodon/YouTube fetch for
the rest — that came back as an opaque upstream error instead of a clear
'input required' message.

Brings them in line with farcaster and the github-* columns, which
already trim-and-throw on their required input. Continues PR #78, which
fixed the same class of bug across the five Grok-backed search columns
but didn't cover these.

- linkedin: throw on empty query (Grok-backed, single required input)
- bluesky/mastodon: throw on empty query in search/hashtag mode and on
  empty handle in author mode
- youtube: throw on empty query/channel/playlist per mode

Co-authored-by: aeonframework <aeonframework@proton.me>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
aaronjmars added a commit that referenced this pull request Jun 24, 2026
…#80)

* docs(plugins): teach required-input validation in the column template

PRs #78/#79 added trim-and-throw guards for required inputs across the
Grok-backed and moded social columns, but the `_template/` every new column
is copied from — and the plugin contract README — never taught the pattern.
A contributor scaffolding a new column inherits the exact gap those two PRs
closed: Zod `.default("")` guarantees a field is present and typed, but not
non-empty, so an empty query fires a wasted upstream call that returns an
opaque error instead of a clear "X is required."

- _template/server.ts: document the guard at the top of `fetch`, with the
  canonical `config.query.trim()` check and a note that the hello-world demo
  intentionally skips it. Comment-only — the template still runs as-is.
- lib/columns/README.md: correct step 4 ("present" is not "non-empty") and
  add a "Validate required inputs" convention with the exact pattern and the
  note that a throw is caught by the shared API route as the column error state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(plugins): scope the required-input convention to what code actually does

Soften "every input-driven column" — the query-driven github columns
(search/issues/prs/backlinks) don't guard, only the repo-based ones do — and
correct the error surface: a thrown error becomes a fetch-error toast, not an
inline column error state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: aeonframework <aeonframework@proton.me>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant

0