Skip to content

test: fix low-value assertions in ado_script github-app-token tests#1553

Merged
jamesadevine merged 1 commit into
mainfrom
test-reducer/ado-script-section2-c0fc590fe2cd9f85
Jul 21, 2026
Merged

test: fix low-value assertions in ado_script github-app-token tests#1553
jamesadevine merged 1 commit into
mainfrom
test-reducer/ado-script-section2-c0fc590fe2cd9f85

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/compile/extensions/ado_script.rs

What was wrong

  • github_app_token_step_rejects_invalid_config: Asserted only is_err() — if the validation were accidentally removed, the test would fail with a panic on the subsequent unwrap(), but would give no signal about which invariant was violated. An is_err() assertion on a function that must reject a specific invalid shape (app_id containing a space) should also confirm the error message, to guard against a regression where the wrong validation fires (e.g. the config is rejected for a different reason).

  • github_app_token_revoke_step_rejects_invalid_config: Same problem — bare is_err() with no message check. The config uses an `(redacted) URL; the test should assert the rejection is specifically about the scheme, to prevent a regression where validation is reorganised and the wrong guard rejects the config for an unrelated reason.

  • github_app_token_eval_path_consistent_with_download_dir: Only asserted starts_with("/tmp/ado-aw-scripts/ado-script/"). The parallel test prepare_pr_base_path_consistent_with_download_dir asserts both starts_with and ends_with("prepare-pr-base.js"). Without the ends_with guard, a rename of the bundle file (e.g. github-app-token.jsgh-app-token.js) would compile and pass all tests while silently breaking the bundle invocation path.

Changes

Test Action Reason
github_app_token_step_rejects_invalid_config Rewritten Bare is_err() — no error-message guard
github_app_token_revoke_step_rejects_invalid_config Rewritten Bare is_err() — no error-message guard
github_app_token_eval_path_consistent_with_download_dir Strengthened Missing ends_with — filename regression undetectable

Verification

  • cargo test: all tests pass ✅
  • cargo check: no errors ✅

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Test Reducer · 110 AIC · ⌖ 11.9 AIC · ⊞ 8.7K ·

- github_app_token_step_rejects_invalid_config: replace bare is_err()
  with unwrap_err() + assert error message contains 'app-id' so a
  regression that silently accepts invalid config cannot go unnoticed.

- github_app_token_revoke_step_rejects_invalid_config: same treatment;
  assert error message contains 'api-url' and 'https://' confirming the
  http-only URL is rejected for the right reason.

- github_app_token_eval_path_consistent_with_download_dir: add
  ends_with("github-app-token.js") assertion to match the style of the
  parallel prepare_pr_base_path_consistent_with_download_dir test;
  without it, a filename regression would pass unnoticed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine
jamesadevine marked this pull request as ready for review July 21, 2026 13:44
@jamesadevine
jamesadevine merged commit 6cd93d8 into main Jul 21, 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.

1 participant