background-agents
background-agents copied to clipboard
fix(types): validate Linear classifier boundaries
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
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