refactor(service-config): relocate forgejo_url into operator_oauth_tokens.base_url (PR C) #828
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!828
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/forge-url-relocation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
PR C of the URL-consolidation series (
specs/service-config-url-consolidation.md). Stacks on top of PR #827 (refactor/service-config-consolidation) — base branch is set accordingly so the diff only shows PR C's net changes once #827 lands.Every URL now lives with its credentials. For Forgejo that means
operator_oauth_tokens.base_url(forge_type='forgejo') — the URL the operator actually authenticated against — becomes the single source of truth. The pre-#823 home (service_config.forgejo_url) gets dropped.What changes
Server
016-drop-service-config-forgejo-url.ts— logs a warning on divergence between the service-config value and the OAuth row'sbase_url, thenALTER TABLE service_config DROP COLUMN forgejo_url. Idempotent via PRAGMA table_info.getForgejoUrl()switches source:operator_oauth_tokens.base_url→FORGEJO_URLenv (bootstrap-only) → hardcoded default. Cheap base_url-only lookup avoids decrypting tokens. Fresh on every call (no in-memory cache).WebhookConfig.forgejoUrlfield deleted; every priorcfg.forgejoUrlreader switches togetForgejoUrl().ServiceConfigRow/ServiceConfigRowRaw/SERVICE_CONFIG_DEFAULTS/PresetServiceOverrides/ service-config HTTP handler all trimforgejo_url.SPA
/settings/service. Tab bar collapses to Container · Watchdogs · Design. Page subtitle now points operators at/login(the OAuth dance). The proper editor surface returns in PR D once the sub-routes restructure (specs/settings-service-subroutes.md) lands.ServiceConfigSettingsRow/ServiceConfigSettingsPatchtypes loseforgejo_url.Tests
service_config.forgejo_urlswitches to seedingoperator_oauth_tokens(forgejo row).webhook-config.test.tsSVC-2 block becomes a PR C block: covers (1) operator_oauth_tokens.base_url winning, (2)FORGEJO_URLenv fallback, (3) hardcoded default fallback.Bootstrap path
For fresh installs without an OAuth row yet, the loader falls back to the
FORGEJO_URLenv var (then the hardcoded default). PR D adds the inline editor that lets the operator change the URL post-OAuth.Test plan
just qa— 3135/3135 server tests + web typecheck greenjust restart— service running on the new helper; live DB'sservice_configno longer carriesforgejo_url,operator_oauth_tokens.base_urlis the single sourcemainand verify the diff stays cleanoperator_oauth_tokens.base_urlFollow-up
PR D — surface the per-forge OAuth client/secret editors in the Forge sub-route, with the URL editable inline alongside the credentials. Spec'd in
specs/service-config-url-consolidation.mdPR D section.🤖 Generated with Claude Code
CI still pending at review time (no run found for sha
402056fe). Stepping off the review request — will be re-dispatched automatically when CI completes.Migration, fallback chain, WebhookConfig field removal, SPA tab removal, test coverage — all correct.
nit:
main.ts:2379comment says "static config forgejoUrl" but that field no longer exists on WebhookConfig. Update to "getForgejoUrl()" or drop the comment.Migration 016 is idempotent (PRAGMA check), logs divergence warnings correctly, and drops the column cleanly.
getForgejoUrl()3-tier fallback (oauth row →FORGEJO_URLenv → hardcoded default) is correct; bootstrap/first-sign-in path works becauseforgejoBaseUrl()in the OAuth handler uses the same helper to build the authorize URL and then stores that URL asbase_url— no circularity.All tests updated to seed
operator_oauth_tokensinstead ofservice_config.forgejo_url; env-var fallback test added. SPA Forge tab removal is clean.CI does not run for stacked PRs targeting non-main — expected; author reports 3135/3135 green locally. Will run after rebase onto main.
402056fe36toa6b5b70f2a