Skip to content

spp_api_v2: If-Match is optional on PUT/PATCH although api-design.md requires it #561

Open

Description

@gonzalesedwin1123

Problem

docs/principles/api-design.md says PUT and PATCH require If-Match for optimistic locking. Every v2 write
endpoint treats it as optional (if if_match: ...), so a client that omits it can silently overwrite a concurrent
change:

  • spp_api_v2/routers/individual.py (PUT ~395, PATCH ~470)
  • spp_api_v2/routers/group.py (PUT ~368, PATCH ~444)
  • spp_api_v2_change_request/routers/change_request.py (~369)
  • spp_api_v2_programs/routers/program_membership.py (PUT)

Proposal

Decide between (a) enforcing the principle (428 Precondition Required when If-Match is missing — a breaking change
for existing clients, e.g. the OpenFn adaptor does not send it by default), or (b) amending the principle to "optional,
checked when present". Either way, add a shared "current version of a record" helper so the microsecond versionId
format cannot drift again (the ProgramMembership PUT drifted to float seconds and always 409'd, fixed in PR #555).

Context

Noted during #554 / PR #555.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions