Stop logging a warning per webhook delivery by aiolibsbot · Pull Request #83 · sanitizers/patchback-github-app · GitHub
Skip to content

Stop logging a warning per webhook delivery - #83

Draft
aiolibsbot wants to merge 2 commits into
sanitizers:masterfrom
aiolibsbot:koan/fix-issue-82
Draft

aiolibsbot wants to merge 2 commits into
sanitizers:masterfrom
aiolibsbot:koan/fix-issue-82

Conversation

@aiolibsbot

@aiolibsbot aiolibsbot commented Sep 29, 2026 •

Copy link
Copy Markdown

Summary

Every webhook delivery logs WARNING:octomachinery.utils.asynctools:Excessive arguments passed to callback <class 'octomachinery.github.models.GitHubAppInstallation'>
because GitHub added client_id and contact_email to the
/app/installations/{id} response and the pinned octomachinery's model does
not declare them — dict_to_kwargs_cb() drops the unknown keys and warns. This
widens the model with those two fields, so the payload maps onto it exactly and
the values are kept instead of discarded.

Stopgap in the app because octomachinery is what lags behind the API; it
becomes redundant once an upstream release declares these fields.

Refs #82

Changes

  • patchback/octomachinery_compat.py: an installation model subclass adding
    client_id and contact_email (both defaulting to None, so pre-client_id
    payloads still deserialize), plus
    patch_github_app_installation_model() rebinding
    octomachinery.github.api.app_client.GitHubAppInstallationModel.
  • patchback/__main__.py: applies the patch at startup.
  • tests/test_octomachinery_compat.py: covers the warning and the mapping.

Test plan

  • python -m pytest tests/test_octomachinery_compat.py — 3 passed. The tests
    assert that today's GitHub payload maps onto the patched model with no
    WARNING records and both values retained, that a payload without the new
    keys still works, and that the unpatched upstream model is what warns.
  • Imported patchback.__main__ with octomachinery installed and confirmed
    app_client.GitHubAppInstallationModel is the widened model.
  • Note: this branch adds the repo's first test module but no runner — there is
    no test workflow on master and pytest is not in requirements.txt, so CI
    does not execute it yet.

Quality Report

Changes: 3 files changed, 165 insertions(+)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan

`octomachinery` maps the `/app/installations/{id}` API response onto its
`GitHubAppInstallation` model through `dict_to_kwargs_cb()`, which drops the
payload keys the model does not declare and logs `Excessive arguments passed to
callback` when it does so. GitHub has since added `client_id` and
`contact_email` to that response, so the model no longer covers it and every
webhook delivery — each one looks the installation up — emits that warning.

Widen the model with the two fields instead of silencing the logger: the
payload then maps onto it exactly, which also keeps the values instead of
throwing them away. Both fields default to `None`, so an older payload that
omits them still deserializes.

This is a stopgap in the app because the pinned `octomachinery` is what lags
behind the API; the patch becomes redundant once an upstream release declares
these fields.

Refs sanitizers#82
@webknjaz

Copy link
Copy Markdown
Member

@aiolibsbot

Copy link
Copy Markdown
Author

This branch has not been deployed

No deployments
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