Skip to content

Comments

fix(local-auth): persist apps row for /local/generate_uri#382

Open
DevDesai444 wants to merge 1 commit intomorphik-org:mainfrom
DevDesai444:codex/fix-local-generate-uri-app-persistence-380
Open

fix(local-auth): persist apps row for /local/generate_uri#382
DevDesai444 wants to merge 1 commit intomorphik-org:mainfrom
DevDesai444:codex/fix-local-generate-uri-app-persistence-380

Conversation

@DevDesai444
Copy link

Summary

  • persist an apps table row in /local/generate_uri before returning a URI
  • ensure local non-UUID names are stored via created_by_user_id while keeping apps.user_id UUID-safe
  • mark freshly generated local tokens as active in Redis cache after successful persistence
  • add unit tests for local app-record create/update behavior

Why

/local/generate_uri generated JWTs but did not persist matching apps rows, causing auth middleware to reject tokens as invalid/revoked.

Closes #380
Issue: #380

- persist app record before returning URI so auth can validate app_id\n- store UUID-safe user_id plus created_by_user_id for non-UUID local names\n- mark generated local app token as active in redis cache\n- add unit tests for local app record persistence\n\nRefs: morphik-org#380
@CLAassistant
Copy link

CLAassistant commented Feb 16, 2026

CLA assistant check
All committers have signed the CLA.

@BloggerBust
Copy link

I reviewed this against the current AppModel schema and auth flow in ensure_app_is_active().

This looks correct:

  • app_id is persisted before return
  • name and uri satisfy not NULL constraints
  • token_version aligns with JWT payload
  • user_id safely handles non-UUID local names via NULL and created_by_user_id

This should resolve #380 because database.get_app_record(app_id) will now return a row instead of None.

Nice fix!

@DevDesai444 DevDesai444 deleted the codex/fix-local-generate-uri-app-persistence-380 branch February 19, 2026 17:13
@DevDesai444 DevDesai444 restored the codex/fix-local-generate-uri-app-persistence-380 branch February 19, 2026 17:13
@DevDesai444 DevDesai444 reopened this Feb 19, 2026
@Tyrannius
Copy link

Tyrannius commented Feb 19, 2026

Just a note: the root cause analysis and fix for this issue were already provided in #380 by me (@Tyrannius). It would be appreciated if that contribution is acknowledged.

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.

Bug: generate_uri endpoint creates JWT tokens but does not persist app records to database

4 participants