Skip to content

fix/feat: OCPI audit fixes and improvements#19

Merged
alfonsosastre merged 10 commits intomainfrom
feat/claude-md
Feb 23, 2026
Merged

fix/feat: OCPI audit fixes and improvements#19
alfonsosastre merged 10 commits intomainfrom
feat/claude-md

Conversation

@alfonsosastre
Copy link
Copy Markdown
Contributor

@alfonsosastre alfonsosastre commented Feb 21, 2026

Summary

Audit-driven fixes and new features based on a full OCPI implementation review.

Test plan

  • All 450 tests pass
  • 8 new EMSP payments tests
  • 4 new hub routing header tests
  • 9 new environment alias tests
  • 4 new push scenario tests
  • Coverage at 86%

🤖 Generated with Claude Code

Alfonso Sastre and others added 10 commits February 21, 2026 10:59
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CANCEL_RESERVATION was introduced in OCPI 2.2.1, not 2.1.1.
The else branch was dead code since FastAPI validates the CommandType
enum before the handler is invoked.

Closes #17

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The crud.update call was using id="" instead of id=auth_token,
inconsistent with crud.get and crud.delete which both use auth_token
as the credential identifier. This caused incorrect credential targeting
in multi-credential scenarios.

Closes #15

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The EMSP sender interface allows pulling terminal and financial advice
confirmation data from the CPO. Adds GET endpoints for both resources
and registers the router in the v2.3.0 EMSP router map.

Closes #14

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds HubRequestIdMiddleware that echoes X-Request-ID (generating one
if absent) and X-Correlation-ID (when provided) in every response,
as required by the OCPI spec for Hub deployments.

Closes #16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
get_modules and get_authenticator overrides were calling the functions
immediately and storing the result, instead of storing the callables.
FastAPI dependency_overrides expects a callable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Normalize prod/dev/staging/test aliases before validation so
deployments using short names don't raise ValueError at startup.
Aliases map as: prod→production, dev/staging→development, test→testing.

Closes #10

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Auth: document that missing header returns 422 (FastAPI validation)
  and wrong token returns 403
- CDR module: verify POST method is used and base_url is not appended
- Tokens module: verify EMSP role is used for crud.get

Closes #18

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alfonsosastre alfonsosastre merged commit 5999dc9 into main Feb 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment