Skip to content

feat(etl): index oauth_redirect_uris on developer app create/update (parity 5E)#252

Open
raymondjacobson wants to merge 1 commit intoetl/parity-5c-comment-threading-auditfrom
etl/parity-5e-developer-app-redirect
Open

feat(etl): index oauth_redirect_uris on developer app create/update (parity 5E)#252
raymondjacobson wants to merge 1 commit intoetl/parity-5c-comment-threading-auditfrom
etl/parity-5e-developer-app-redirect

Conversation

@raymondjacobson
Copy link
Copy Markdown
Contributor

Summary

Stack 5E. Picks up apps#13863. Adds the `oauth_redirect_uris` table from apps' SQLAlchemy model and wires `redirect_uris` indexing into developer_app create/update handlers.

Migration 0025:

  • `oauth_redirect_uris` (id serial PK, client_id varchar(255), redirect_uri text, created_at) with index on client_id.

`extractRedirectURIs()` validates the `metadata.redirect_uris` field per apps:

  • must be a list
  • each entry must be a string under `MAX_REDIRECT_URI_LENGTH` (2000)
  • list capped at `MAX_REDIRECT_URIS` (50)
  • explicit `null` → "clear all"
  • missing key → "no change"

`replaceRedirectURIs()` implements apps' delete-then-insert pattern.

Wired into `developer_app_create` (writes if non-empty list) and `developer_app_update` (writes when key is present, including the explicit-null clear case).

Note: pre-existing developer_app_update bug

`developer_app_update` has a pre-existing bug — its INSERT-of-a-new-row pattern violates `UNIQUE(address)` constraint (the schema has both `PRIMARY KEY (address, txhash)` AND `UNIQUE (address)` which are incompatible with versioning). Out of scope for this PR. The update test covers `replaceRedirectURIs` directly via the helper rather than going through the broken handler path.

Stack context

Stacked on #251 (5C — comment threading). Last PR in the parity stack.

Test plan

  • `TestExtractRedirectURIs` (6 sub-cases) — happy path, missing, null, type checks, length cap.
  • `TestDeveloperAppCreate_IndexesRedirectURIs` — DB-backed end-to-end through the create handler.
  • `TestReplaceRedirectURIs_DeletesAndInserts` — helper deletes prior rows and inserts new.
  • `go build ./...` clean.

🤖 Generated with Claude Code

…parity 5E)

Stack 5E. Picks up apps#13863. Adds the oauth_redirect_uris table from
apps' SQLAlchemy model and wires create/update of redirect_uris into the
developer_app handlers.

Migration 0025:
- oauth_redirect_uris (id, client_id varchar(255), redirect_uri text,
  created_at) with index on client_id.

extractRedirectURIs() validates the metadata.redirect_uris field per apps:
- must be a list
- each entry must be a string under MAX_REDIRECT_URI_LENGTH (2000)
- list capped at MAX_REDIRECT_URIS (50)
- explicit null treated as "clear all"
- missing key treated as "no change"

replaceRedirectURIs() implements apps' delete-then-insert pattern.

Wired into developer_app_create (writes if non-empty list provided) and
developer_app_update (writes when key is present, including the explicit-
null clear case).

Note: developer_app_update has a pre-existing bug where its second INSERT
violates UNIQUE(address) — out of scope for this PR. Test for the
update flow covers the redirect-uris helper directly via replaceRedirectURIs.

Tests:
- TestExtractRedirectURIs (6 sub-cases)
- TestDeveloperAppCreate_IndexesRedirectURIs
- TestReplaceRedirectURIs_DeletesAndInserts

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant