Skip to content

fix(linear-app): coerce search_issues limit instead of binding null to $first (#14270) - #14271

Merged
kodjima33 merged 2 commits into
BasedHardware:mainfrom
boai-maker:fix/linear-search-coerce-limit
Sep 18, 2026
Merged

kodjima33 merged 2 commits into
BasedHardware:mainfrom
boai-maker:fix/linear-search-coerce-limit

Conversation

@boai-maker

@boai-maker boai-maker commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14270

Problem

plugins/omi-linear-app/main.py:880 bound the caller's limit straight into GraphQL:

limit = body.get("limit", 5)

dict.get returns None — not the default — when the key is present with a JSON null, which is what the backend sends for an omitted optional parameter. The module's own coerce_limit docstring (line 574) documents this case.

That None is bound as first against a non-nullable variable on both query paths:

  • primary, line 893 — query($term: String!, $first: Int!)
  • fallback, line 920 — query($filter: IssueFilter!, $first: Int!)

Linear rejects null for Int! at validation, and because the issues(filter:) fallback binds the same value it fails identically — no recovery path. Every search where the model omits limit returned Search failed: .... Non-numeric and over-cap limits ("7", 999, -4, {"n": 5}) were forwarded unclamped as well.

The #13920 coerce-limit pass fixed tool_list_my_issues and tool_list_recent_issues; tool_search_issues was missed.

Fix

One line, through the helper already in the file, matching lines 603 and 686:

limit = coerce_limit(body.get("limit"), default=5, min_val=1, max_val=50)

Tests

New plugins/omi-linear-app/test_search_issues_params.py — hermetic, standard library only, mirroring test_list_issues_params.py so it runs in the manifest lane under plain python3.

  • test_limit_arrives_as_bounded_int_variable — absent / null / string / over-cap / negative / zero / float / bool / list / dict / injection-shaped all arrive as a bounded int
  • test_fallback_query_also_binds_a_coerced_limit — forces the primary query to fail and asserts the fallback binds a coerced limit too
  • test_search_never_sends_null_first — direct regression guard

Fails 13 assertions against main, headline first must never be null against $first: Int!. Passes with the fix. test_list_issues_params.py, test_graphql_errors.py and test_issue_lookup.py remain green.

$ python3 test_search_issues_params.py   # OK (3 tests)
$ python3 test_list_issues_params.py     # OK
$ python3 test_graphql_errors.py         # OK
$ python3 test_issue_lookup.py           # OK

Failure-Class: none

🤖 Generated with Claude Code

Review in cubic

…o $first

The BasedHardware#13920 coerce-limit pass covered tool_list_my_issues and
tool_list_recent_issues but left tool_search_issues on a raw
`body.get("limit", 5)`. dict.get returns None -- not the default -- when
the key is present and null, which is what the backend sends for an
omitted optional parameter, so `first` reached Linear as null against a
non-nullable `$first: Int!`. The issues(filter:) fallback binds the same
value, so the tool had no recovery path and every limit-less search
failed. Non-numeric and over-cap limits were forwarded unclamped too.

Route the caller-supplied limit through the existing coerce_limit()
helper, matching the two list tools.

Adds test_search_issues_params.py: a hermetic, standard-library-only
suite mirroring test_list_issues_params.py so it runs in the manifest
lane. It fails 13 assertions against the previous behaviour and covers
both the primary and fallback query paths.

Co-Authored-By: Claude Opus 5 <[email protected]>

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified fix for #14270 — both the diagnosis and the one-line repair check out. Requesting changes only for two metadata items; the code itself needs no changes.

Code review on ed6053a:

  • plugins/omi-linear-app/main.py — the change routes body.get("limit") through the module's existing coerce_limit (line 574), exactly matching the sibling call sites at line 603 (tool_list_my_issues) and line 686 (tool_list_recent_issues). That closes the gap the #13920 pass left: dict.get("limit", 5) returns None — not the default — when the key is present as JSON null (what the backend sends for an omitted optional), and that None was bound against non-nullable $first: Int! on both paths — the primary searchIssues query (line 893) and the issues(filter:) fallback (line 920) — so every limit-less search failed with no recovery path. I confirmed no un-coerced body.get("limit" binding remains in the file.
  • plugins/omi-linear-app/test_search_issues_params.py — genuinely hermetic (standard library only; the stubbed requests.post and db functions raise on unexpected use, os.environ is cleared at load). I ran it three ways: on this head 3/3 pass; against the pre-fix module the same suite reproduces the reported failure with exactly the 13 failed assertions documented in the description, headline first must never be null against $first: Int!; and the full plugin suite (test_graphql_errors, test_issue_lookup, test_list_issues_params, plus this file) is 22/22 green when invoked from the repo root, which is how the manifest lane runs it.

Two items before merge, both metadata:

  1. Blocking for the required hygiene check: the commit subject begins with fix(, and the failure-class protocol requires exactly one Failure-Class: declaration in the PR body. The body currently has none, so the failure-class-protocol check will fail with missing_declaration. Adding a single line Failure-Class: none to the PR body resolves it — no registry class matches this fix, so none is the right form here.
  2. Please register the new suite in .github/checks-manifest.yaml next to linear-list-issues-params-tests — an entry like linear-search-issues-params-tests running plugins/omi-linear-app/test_search_issues_params.py with the same plugins/omi-linear-app/** triggers. Without it the new regression guard never runs in CI, and the #13920 sibling suite is registered exactly this way.

Once the body trailer is added and the suite is registered, this should be ready to merge — the remaining sign-off is left to the human maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution python labels Sep 17, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code fix verified correct for #14270 (reviewer confirmed diagnosis + tests), but CHANGES_REQUESTED for two metadata items (Failure-Class trailer, checks-manifest registration) are still missing — approve only, not merging until resolved.

Adds linear-search-issues-params-tests alongside the BasedHardware#13920 sibling so the
new regression guard runs in the local and CI lanes on any
plugins/omi-linear-app change.

Co-Authored-By: Claude Opus 5 <[email protected]>
@boai-maker

boai-maker commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review. Both items addressed:

  1. Added Failure-Class: none to the PR body.
  2. Registered linear-search-issues-params-tests in .github/checks-manifest.yaml next to linear-list-issues-params-tests, with the same triggers and lanes (follow-up commit). All four linear-app suites pass from the repo root.

@Git-on-my-level
Git-on-my-level dismissed their stale review September 18, 2026 06:06

Both items from this change request are verified resolved on 8299823: the PR body now declares 'Failure-Class: none' exactly once, and linear-search-issues-params-tests is registered in .github/checks-manifest.yaml with matching triggers and lanes (the follow-up commit touches only the manifest, so the reviewed fix is unchanged). The suite was re-run on this head: 3/3 pass. Clearing this change request; nothing further is outstanding from automation.

@kodjima33
kodjima33 merged commit 891223f into BasedHardware:main Sep 18, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty proposal] fix(linear-app): search_issues sends null first against a non-nullable $first: Int! when the backend omits limit ($25 proposed)

3 participants