background-agents icon indicating copy to clipboard operation
background-agents copied to clipboard

fix(types): validate Linear classifier boundaries

Open open-inspect opened this issue 5 months ago • 1 comments

This is an automated nightly unsafe-cast remediation sweep. It replaces unsafe assertions at Linear classifier trust boundaries with Zod parsing, following the TypeScript Coding Standards unsafe-cast / parse-don't-assert guidance and the Zod boundary-validation pattern established in PR #807.

Findings Fixed

file:line risk cast removed fix
packages/linear-bot/src/classifier/index.ts:145 HIGH (await response.json()) as AnthropicResponse for the Anthropic messages API response feeding repo classification Added package-local Zod response schema and safeParse before reading content blocks
packages/linear-bot/src/classifier/index.ts:153 HIGH toolBlock.input as Record<string, unknown> plus input.confidence as ConfidenceLevel for Anthropic tool input feeding repo/session routing Added package-local Zod tool-input schema with repoId nullable and z.infer as the source of truth
packages/linear-bot/src/classifier/repos.ts:63,110 HIGH/MEDIUM (await response.json()) as ControlPlaneReposResponse and cached as RepoConfig[] for control-plane repo inventory and KV cache Added shared Zod schemas for repo inventory/cache shapes and safeParse at both boundaries

Verification

command result
npm install Passed; lockfile diff is the single expected @open-inspect/linear-bot zod entry
npm run build -w @open-inspect/shared Passed
npm test -w @open-inspect/shared Passed, 309 tests
npm run build -w @open-inspect/linear-bot Passed
npm test -w @open-inspect/linear-bot Passed, 132 tests
npm run typecheck Passed
npm run format Passed
npm run lint -w @open-inspect/shared Passed
npm run lint -w @open-inspect/linear-bot Passed
npm run lint -- --ignore-pattern ".opencode/**" Passed for tracked repo files; plain npm run lint was blocked only by the pre-existing untracked local .opencode/ tooling directory in this workspace

Created with Open-Inspect

open-inspect avatar Jul 04 '26 06:07 open-inspect

Terraform Validation Results

Step Status
Format ✅
Init ✅
Validate ✅

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @open-inspect[bot], Action: pull_request

github-actions[bot] avatar Jul 04 '26 06:07 github-actions[bot]