[WIP] Fix mypy type-check errors for PR #3#5
Merged
Conversation
Agent-Logs-Url: https://github.com/uscient/mboxer/sessions/a453f47c-be57-4a63-89ba-cc4ac287ba44 Co-authored-by: xormania <127287135+xormania@users.noreply.github.com>
Copilot stopped work on behalf of
xormania due to an error
May 2, 2026 20:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
types-PyYAMLto dev dependencies inpyproject.tomllimits.py: replace dynamicreplace(limits, **updates)with explicitreplace()callsnormalize.py: narrowbytestype before calling.decode()classify.py: correct return type annotation for_run_rule_classification_threadandrun_rule_classificationtodict[str, int | str]ingest.py: guardcursor.lastrowidagainstNonewithRuntimeErrorSuccess: no issues found in 23 source filesOriginal prompt
Fix the failing mypy check for PR #3 in
uscient/mboxerby addressing the current type-check errors on the PR head. The failing CI job is theType Check (mypy)job from workflow.github/workflows/ci.ymlon PR #3 (https://github.com/uscient/mboxer/pull/3).Repository:
uscient/mboxerBase branch:
masterObserved mypy failures from CI:
src/mboxer/config.py:6: missing type stubs foryaml(types-PyYAMLsuggested)src/mboxer/limits.py:94:replace(limits, **updates)uses dynamically-typed kwargs that mypy rejectssrc/mboxer/normalize.py:59and:61:.decode()called on a union value fromget_payload(decode=True)without narrowing tobytessrc/mboxer/classify.py:294and:387: function return type is annotated asdict[str, int]but returns{..., "level": "thread"}src/mboxer/ingest.py:342and:347:cursor.lastrowidis treated asint | Noneand passed to functions expectingintPlease make code changes to fix these typing issues with minimal, clean changes. Preferred guidance:
pip install -e ".[dev]"in CI installs them.limits.py, replace the dynamicupdates/replace(limits, **updates)pattern with a mypy-friendly approach using explicitreplace(...)calls or another type-safe pattern.normalize.py, narrow the payload returned bypart.get_payload(decode=True)before calling.decode().classify.py, correct the return typing for_run_rule_classification_threadso it matches the actual returned shape, ideally with a precise typed structure if reasonable.ingest.py, explicitly guard or assert thatmsg_db_idis notNonebefore passing it where anintis required.Requirements:
pyproject.toml,requirements-dev.txt, etc.), update the correct file rather than hardcoding around the issue.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: @uscient/mboxer/pull/3
Assistant: This PR adds GitHub Actions CI/release automation, but it’s not merge-ready yet because it’s still marked as a draft and mergeability is currently blocked. It also includes a few small unrelated lint-cleanup changes in Python source files beyond the new workflow files.
#3— ci: add GitHub Actions workflowsCopilottrue, but mergeable state is blockedmaster←copilot/create-github-actions-workflowsxormaniaIn a nutshell
The PR primarily sets up repository automation with four new workflows under
.github/workflows/:ci.ymlforruff,mypy, andpyteston PRs/pushes tomasterschema.ymlfor SQLite schema validationrelease.ymlfor PyPI publishing on version tags via OIDCdependency-review.ymlfor PR dependency scanningIt also contains a small follow-up fix in CI to generate synthetic fixtures before running tests, plus a handful of unrelated source cleanups to satisfy linting.
Notable changes
.github/workflows/ci.yml.github/workflows/schema.yml.github/workflows/release.yml.github/workflows/dependency-review.ymlsrc/mboxer/cli.pysrc/mboxer/db/schema.pysrc/mboxer/ingest.pysrc/mboxer/security/policy.pyCommit story
The commit history suggests the PR evolved after initial generation:
#4) that resolved ruff issuesThat means the final PR is a bit broader than the original “add four workflow files exactly as specified” goal.
Merge-readiness assessment
Not ready yet, mainly because:
This pull request was created from Copilot chat.