Skip to content

fix: accept null issue_url in prescreen callback validation - #825

Merged
neuromechanist merged 1 commit into
nemarOrg:devfrom
bruAristimunha:fix/prescreen-callback-null-issue-url
Jun 27, 2026
Merged

neuromechanist merged 1 commit into
nemarOrg:devfrom
bruAristimunha:fix/prescreen-callback-null-issue-url

Conversation

@bruAristimunha

Copy link
Copy Markdown
Contributor

Problem

The prescreen workflow (nemarDatasets/.github) sets ISSUE_URL="" (advisory mode since #756) and the jq expression converts this to null:

issue_url:(if $iu=="" then null else $iu end)

Server validation at validatePrescreenCallbackBody:

if (b.issue_url !== undefined && typeof b.issue_url !== "string") {
  return "issue_url must be a string";
}

null !== undefined is true, and typeof null === "object" — so every prescreen callback returns HTTP 400 since #756. No prescreen results reach the Worker.

Fix

Accept null as equivalent to the field being absent (undefined), since:

  • The field is typed issue_url?: string (optional)
  • The DB handler already does const issueUrl = body.issue_url || null — null is handled correctly
// Before
if (b.issue_url !== undefined && typeof b.issue_url !== "string") {
// After
if (b.issue_url !== undefined && b.issue_url !== null && typeof b.issue_url !== "string") {

Also adds a test case for null to match the existing test for non-string numbers.

Related

A companion PR fixing the workflow to omit the field instead of sending null: nemarDatasets/.github#60

Either fix alone is sufficient; both together are belt-and-suspenders.

The run-prescreen workflow sends issue_url: null when ISSUE_URL="" via jq
(if $iu=="" then null else $iu end). The server validation checked
`b.issue_url !== undefined` but not `b.issue_url !== null`, so null triggered
'issue_url must be a string' and every prescreen callback returned 400.

The DB handler already handles null correctly (`body.issue_url || null`), so
accepting null here is safe and consistent with the field being truly optional.

Fixes: all prescreen callbacks failing with HTTP 400 since nemarOrg#756 advisory change.
@bruAristimunha

Copy link
Copy Markdown
Contributor Author

CI failure analysis — fork secrets, not a code bug

tl;dr: unit-pure and lint both pass. The api-test and integration-dev failures are a GitHub Actions fork-security limitation, not caused by this PR.

Root cause

This PR is submitted from a fork (bruAristimunha/nemar-cli). GitHub Actions does not pass repository secrets to workflows triggered by fork PRs. The tests that fail both need TEST_ADMIN_API_KEY and TEST_USER_API_KEY:

  • api-test: first call is POST /auth/login with the admin API key → receives 400 (empty string fails key-format validation) → all 28 subsequent tests cascade-fail
  • integration-dev: CLI auth commands attempt to hit the dev backend with no credentials → fail all 3 retries

These exact jobs pass on every dev branch push (e.g. run 27896148203), where secrets are available.

Tests that actually cover this change

unit-pure — the tier-1 required check — runs test/prescreen-decision.test.ts, which now includes the new accepts null issue_url case. It passes. ✅

What to do

Either:

  1. Approve-and-re-run the workflow from the Actions tab ("Approve and run" button for fork PRs) — CI will pass with secrets
  2. Merge as-is — unit-pure + lint are the required checks for dev per the tier docs; integration-dev is explicitly SOFT on dev

@neuromechanist
neuromechanist changed the base branch from main to dev June 27, 2026 05:12
@neuromechanist
neuromechanist merged commit a2cc1bc into nemarOrg:dev Jun 27, 2026
7 of 9 checks passed
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.

2 participants