Skip to content

test(github): the error-path tests of the GitHub App identity check the whole error - #2493

Merged
dan-petty merged 3 commits into
mainfrom
test/2486-app-identity-error-assertions
Oct 28, 2026
Merged

dan-petty merged 3 commits into
mainfrom
test/2486-app-identity-error-assertions

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The error-path tests and the log test in tests/test_github_app_identity.py follow docs/TESTING.md, section "Names and assertions": an assertion compares whole values, and a test of an error path checks the error code and the exit code.

  • The tests of HTTP 422, of the missing App settings and of a key that is no RSA key compare to_dict() of the raised error with the whole expected value: the error code, the whole message, the exit code and the details.
  • The log test compares the token, and the whole record of the logger devops_cli.github.app_installation: the logger, the level and the message. The whole message shows that the log holds no token and no permission level.
  • The test of HTTP 401 keeps its assertion. Its whole message tells the operator to run gh auth login or to set GH_TOKEN, which is wrong for a process that acts as the App, and it drops the reason that GitHub gives. Issue fix(github): a refused JWT exchange of the GitHub App names GitHub's reason, not a gh login #2491 changes that message, and its test then compares the whole error.

Before this change, the tests passed when the error code or the log message changed. Now they fail.

The change alters tests only, so its OpenSpec change has no spec delta.

Closes #2486

…he whole error

The tests of HTTP 422, of the missing App settings and of a key that is no RSA key compare to_dict() of the raised error with the whole expected value, so they check the error code, the exit code, the whole message and the details. The log test compares the token and the whole record of the App's logger.

The test of HTTP 401 keeps its assertion: its whole message tells the operator to run gh auth login, which is wrong for the App. #2491 fixes that message.
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence, from the devcontainer, at origin/main daaffc6:

  • uv run devops ci test tests/test_github_app_identity.py tests/test_swallowed_failures_ratchet.py tests/test_architectural_invariants.py tests/test_change_folders.py: 130 passed.
  • uv run mypy src: no issues in 562 source files.
  • Mutation check: with CONST_GITHUB_UNAUTHENTICATED_ERROR_CODE set to GITHUB_OPERATION_FAILED and a word added to the log message of mint_installation_token, the test file of origin/main gives 11 passed. The changed test file fails 3 tests: the HTTP 422 test, the test of the key that is no RSA key and the log test. The source was restored after the check.

Context: this item comes from the review of #2482, which merged before the review findings arrived. The review also found that the old branch of #2482 held two commits that added and deleted the change folder again with no net diff. That branch was not pushed, so nothing on main needs a change for that finding.

@dan-petty
dan-petty marked this pull request as ready for review October 28, 2026 18:43
@dan-petty
dan-petty merged commit eaacf5e into main Oct 28, 2026
17 checks passed
@dan-petty
dan-petty deleted the test/2486-app-identity-error-assertions branch October 28, 2026 18:52
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.

test(github): the error-path tests of the GitHub App identity check the whole error

1 participant