fix(safe): seed default Safe Apps so Transaction Builder appears in UI#16
Open
owenwahlgren wants to merge 1 commit intomainfrom
Open
fix(safe): seed default Safe Apps so Transaction Builder appears in UI#16owenwahlgren wants to merge 1 commit intomainfrom
owenwahlgren wants to merge 1 commit intomainfrom
Conversation
The SAFE_APPS feature flag only controls whether the UI renders the Apps tab. The actual app list (Tx Builder, Drain Account, CSV Airdrop) comes from safe_apps_safeapp rows scoped by chain_id. The CFG initial migration creates the schema without any seed data, so self-hosted deployments had an empty Apps tab and no way to reach Transaction Builder. Seed the three hosted Safe Apps at chain init time in both paths: - ansible/roles/safe/files/init-cfg-chain.py uses the SafeApp ORM - kubernetes/helm/safe/templates/init-job.yaml uses an UPSERT via psycopg2 (consistent with the existing CFG init pattern) Both are idempotent: re-running adds the current chain_id to existing rows without duplicating, so existing deployments pick up Tx Builder on the next ansible/helm apply.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Transaction Builder (and other Safe Apps) were never reachable from the self-hosted Safe UI because the CFG database's
safe_apps_safeapptable was never seeded. TheSAFE_APPSfeature flag we already set only controls whether the UI renders the Apps tab — the actual list of apps comes from database rows scoped bychain_id.safe-config-service's initial migration creates the schema with no seed data and there are no shipped fixtures, so self-hosted deployments get an empty Apps page until rows are inserted manually through Django admin (which isn't exposed through our nginx conf).
Changes
ansible/roles/safe/files/init-cfg-chain.py— importsSafeAppand adds aseed_default_apps(chain_id)helper thatget_or_creates three hosted apps (Transaction Builder, Drain Account, CSV Airdrop) using the Django ORM. Called on both the "chain exists" and "chain created" paths so re-running the script back-fills apps onto existing deployments.kubernetes/helm/safe/templates/init-job.yaml— adds a Step 4 inside the existing CFG psycopg2 block that UPSERTs the same three app rows. UsesON CONFLICT (url) DO UPDATEwith anunnest + DISTINCTmerge so the chain's ID is added to any existing row without duplicating.Both inserts write to
safe_apps_safeappwith the schema from the current safe-config-servicemainbranch:url(unique) /name/description/chain_ids(bigint[]) /listed=TRUE/featured=FALSEicon_urldefaults to'safe_apps/icon_url.jpg'(the model default); UI renders a placeholder.Apps are hosted at
apps-portal.safe.global/{tx-builder,drain-safe,csv-airdrop}— we only register metadata, no self-hosting.Test plan
helm lint kubernetes/helm/safepasseshelm template ... | ast.parseof the embeddedmanage.py shellPython parses cleanlypython3 -m py_compile ansible/roles/safe/files/init-cfg-chain.pymake deploy-safeagainst a fresh L1 and verifyGET /cgw/v1/chains/<id>/safe-appsreturns Transaction Builder, then confirm the Apps tab in the UI renders the tile and loads the iframe