Skip to content

[Hackathon] test flaky should propagate auth failures instead of scoring them as flaky #199

Description

@JerryNee

Discord Username / User ID

JerryNee / jerry_nee

What does this improvement do?

testsprite test flaky documents auth failures as exit code 3, but the current rerun trigger path records most API errors as non-fatal flaky attempts. If the rerun trigger returns AUTH_REQUIRED or AUTH_FORBIDDEN, the command can emit a stability report and exit 1 instead of surfacing the standard auth error envelope / exit 3. That makes CI and agents misdiagnose a credentials problem as a flaky or failing test.

Details / implementation notes

Observed in current main:

  • src/commands/test.ts documents test flaky exit code 3 for auth errors in the command help.
  • In runFlaky, the client.triggerRerun(...) catch block only rethrows NOT_FOUND. Every other ApiError is pushed into attempts as { outcome: "error", failureKind: code }.
  • flakyExitCode then maps the resulting non-stable report to exit 1.

Expected behavior:

  • AUTH_REQUIRED and AUTH_FORBIDDEN from the rerun trigger should propagate as normal auth errors (exit 3), matching the help text and the rest of the CLI's run/wait behavior.
  • In --output json, credentials failures should produce the standard error envelope, not a flaky stability report.
  • NOT_FOUND for a missing replayable run should keep the current exit-4 behavior.

Suggested implementation:

  • In the rerun-trigger catch block, rethrow fatal API errors before recording a non-fatal attempt error. At minimum this should include AUTH_REQUIRED and AUTH_FORBIDDEN.
  • Add focused coverage in src/commands/test.flaky.spec.ts for auth errors during the rerun trigger.
  • Keep transient per-attempt behavior unchanged for genuinely non-fatal trigger/transport blips.

Confirmations

  • I have searched existing issues and this is not a duplicate.
  • I have provided my Discord identity above for reward coordination.

Metadata

Metadata

Assignees

Labels

hackathonCLI hackathon submissionsin-progressAssigned and actively being worked on

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions