Skip to content

fix(verify): add generic type params to dict annotation#20

Open
Coding-Dev-Tools wants to merge 25 commits into
mainfrom
improve/apiauth-20260630175513
Open

fix(verify): add generic type params to dict annotation#20
Coding-Dev-Tools wants to merge 25 commits into
mainfrom
improve/apiauth-20260630175513

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Summary

Update check_expiry signature from dict to dict[str, object] for stricter type checking and modern Python style.

Changes

  • src/apiauth/verify.py: Add generic type parameters to dict annotation

Testing

CI will run test/coverage/security jobs on this branch.

Senior Dev Rotation and others added 25 commits May 29, 2026 08:46
…xit-on-revoked

- verify command now auto-detects JWT tokens (3 dot-separated segments)
  and dispatches to verify_jwt_token; previously all tokens were checked
  as API keys, making JWT verification silently return INVALID
- audit command now accepts --exit-on-expired and --exit-on-revoked flags
  for CI/CD pipeline use (documented in README but not implemented)
- add 9 new tests covering the above; 67 tests pass (was 58)
* pin actions to SHAs, add CI/PyPI badges

* fix: correct author email TOML syntax; update CI workflow

* refactor(keygen): pre-compute datetime.now before loops in verify_api_key/verify_jwt_token; remove repeated inner imports
* fix: add MIT license classifier to pyproject.toml

* fix: resolve mypy type errors (keygen now_str rename, cli list→list_keys)

* chore: add .gitattributes to normalize line endings

* feat: add return type annotations to public functions

* feat: add py.typed marker and package-data for PEP 561 type checking support
…tes and .editorconfig (#5)

- Fix AttributeError when check_expiry receives a non-string expires_at
  value (e.g. int). Added isinstance check before calling .replace().
- Add tests for malformed and non-string expiry date handling
  (verify.py now at 100% coverage, was 89%).
- Add .gitattributes for consistent line endings across platforms.
- Add .editorconfig matching existing ruff config (4-space indent,
  LF line endings, 2-space for YAML/TOML).

Co-authored-by: DevForge Engineer <engineer@devforge.dev>
Resolves the merge of cowork/improve-apiauth into master:

- src/apiauth/cli.py: kept the @cli.command() decorator (uses function
  name) over the broken @cli.command(name="list") variant that
  mis-registered 8 subcommands under a single "list" name. All 69
  tests pass.
- Normalized CRLF -> LF across 8 files (dependabot.yml,
  auto-code-review.yml, CHANGELOG.md, LICENSE, README.md, SECURITY.md,
  __init__.py, keystore.py) per the new .gitattributes and .editorconfig.
- Stripped trailing whitespace from src/apiauth/cli.py.

Verification: ruff check clean, pytest 69/69 pass.
…it/stats) and fix Windows UTF-8 encoding

- 7 commands were registered with name='list' instead of their proper names,
  causing silent overwrites — only the last registered 'list' command worked
- Add sys.stdout/stderr.reconfigure(encoding='utf-8') on Windows to prevent
  cp1252 encoding crashes with Rich library Unicode symbols
No content changes. Pure CRLF->LF normalization for:
- .github/workflows/auto-code-review.yml
- .gitignore, LICENSE, CHANGELOG.md, README.md, SECURITY.md
- src/apiauth/__init__.py, src/apiauth/keystore.py

Required because the merge commit ee08ecf stored CRLF blobs despite
the repo's eol=lf rule, causing perpetual dirty working tree.
Repin to current release v3.95.6 (30d5bb91af1a771378349dbbb0c82129392acf70) to fix broken SHA reference that was preventing security CI from running.
Align tracked files with the repo's declared standards:
- .editorconfig sets insert_final_newline = true
- the end-of-file-fixer pre-commit hook enforces a single trailing newline

Add a missing final newline to AGENTS.md, CONTRIBUTING.md, and
requirements.txt; collapse a stray trailing blank line in README.md
and .gitignore. No code or logic changes; ruff clean and all tests pass.

Co-authored-by: repo-improver[bot] <repo-improver-bot@users.noreply.github.com>
…+ fallback for apiauth (#18)

Co-authored-by: Senior Dev Rotation <senior-dev@devforge.dev>
Automated batch commit.

Files changed:
  UU .gitignore
  UU README.md
  ?? .github/workflows/release-audit.yml
  ?? Makefile
  ?? uv.lock
Update check_expiry signature from dict to dict[str, object] for
stricter type checking and modern Python style.
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🤖 Automated Code Review

✅ Ruff Lint — No issues

⚠️ Ruff Format — Formatting needed

Would reformat: src/apiauth/cli.py
Would reformat: src/apiauth/keygen.py
Would reformat: tests/conftest.py
Would reformat: tests/test_cli.py
4 files would be reformatted, 4 files already formatted

✅ Secret Detection — Clean

✅ Large Files — Within limits

📊 Diff Stats — 25 file(s) changed

 .editorconfig                          |  22 ++
 .gitattributes                         |  38 ++
 .github/CODEOWNERS                     |   1 +
 .github/dependabot.yml                 |   2 +-
 .github/workflows/auto-code-review.yml |  28 ++
 .github/workflows/ci.yml               |  58 ++-
 .github/workflows/cowork-auto-pr.yml   |  28 ++
 .github/workflows/publish.yml          |   6 +-
 .github/workflows/release-audit.yml    |  64 ++++
 .gitignore                             |  38 ++
 .pre-commit-config.yaml                |  17 +
 AGENTS.md                              |  30 ++
 CONTRIBUTING.md                        |  26 +-
 Makefile                               |  14 +
 README.md                              |  20 +-
 SECURITY.md                            |  34 +-
 pyproject.toml                         |   9 +-
 requirements.txt                       |   5 +
 src/apiauth/cli.py                     |  65 +++-
 src/apiauth/keygen.py                  |  15 +-
 src/apiauth/py.typed                   |   0
 src/apiauth/verify.py                  |   4 +-
 tests/conftest.py                      |  14 +
 tests/test_cli.py                      |  93 +++++
 uv.lock                                | 642 +++++++++++++++++++++++++++++++++
 25 files changed, 1227 insertions(+), 46 deletions(-)

Verdict: ⚠️ Warnings — Lint/format issues found. Recommend fixing before merge.

Automated by Coding-Dev-Tools/.github reusable workflow.

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