Skip to content

test(Common): add tests for Types/AI/CodeFixTaskTypeHelper#2681

Merged
simlarsen merged 1 commit into
OneUptime:masterfrom
suvvvv:test/code-fix-task-type
Jul 14, 2026
Merged

test(Common): add tests for Types/AI/CodeFixTaskTypeHelper#2681
simlarsen merged 1 commit into
OneUptime:masterfrom
suvvvv:test/code-fix-task-type

Conversation

@suvvvv

@suvvvv suvvvv commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

Adds unit tests for CodeFixTaskTypeHelper in Common/Types/AI/CodeFixTaskType.ts, which previously had no test coverage. These values are a wire contract (returned as taskType by /ai-agent-task/get-pending-task) and the helper drives which recipes are user-triggerable, which context record a queued run must carry, and how legacy null columns are normalized — all worth pinning down.

Covered:

  • getUserTriggerableTaskTypes / isUserTriggerable — only FixException and WriteRegressionTest are triggerable from the exception page; ImproveInstrumentation, FixPerformance and FixFromIncident are not (they have their own triggers).
  • getContextKind — the full mapping (TelemetryException, IncidentOrAlertSubject, TaskContext), plus a check that every task type resolves to a known context kind, so a newly added recipe can't silently fall through.
  • requiresTelemetryException — the per-type expectations, that it stays in sync with getContextKind, and the invariant that every user-triggerable recipe is exception-based.
  • isValidTaskType — accepts every enum value; rejects empty, unknown, and wrong-cased strings.
  • fromDatabaseValue — normalizes legacy null/undefined (and unrecognized values) to FixException, and round-trips every valid task type including its raw wire string.

Why

Improves test coverage for the Common/Types utilities (part of the broader test-coverage effort). The invariant tests guard the wire contract as new recipes get added.

Testing

node node_modules/.bin/jest --runInBand ./Tests/Types/AI/CodeFixTaskType.test.ts

All 27 tests pass. The file is Prettier-clean.

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

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@simlarsen simlarsen merged commit 9949de9 into OneUptime:master Jul 14, 2026
36 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