fix(metadata): derive org from org profile instead of storing it (#771) #772

Merged
jmiller merged 2 commits from fix/metadata-org-derived-from-profile into main 2026-07-13 00:40:57 +00:00
Owner

Fixes #771.

The repo metadata org field was a stored, editable value that snapshotted the owner name and could silently drift when an organization was renamed. It is now derived from the org profile (repository owner) on read and is read-only everywhere.

Changes

  • models/repo/repo.go: new Repository.DerivedOrgName(ctx) — owner FullName, falling back to the handle (Name), then the denormalized OwnerName.
  • models/repo/repo_manifest.go: drop the Org struct field.
  • models/migrations/v1_27/v369.go + migrations.go: migration #368 drops the repo_manifest.org column (portable base.DropTableColumns).
  • routers/api/v1/repo/manifest.go: response derives org; PUT ignores it on write (read-only, like the already-derived display_name).
  • routers/web/repo/setting/metadata.go + templates/repo/settings/metadata.tmpl: Organization field shown read-only with the derived value.
  • services/updateserver/joomla.go: feed maintainer/organization now uses DerivedOrgName (single source of truth).

Companion

Verification

  • go build of all changed packages: pass (models/repo, models/migrations/..., routers/api/v1/repo, routers/web/repo/setting, services/updateserver).
Fixes #771. The repo metadata `org` field was a **stored, editable** value that snapshotted the owner name and could silently drift when an organization was renamed. It is now **derived from the org profile** (repository owner) on read and is read-only everywhere. ### Changes - `models/repo/repo.go`: new `Repository.DerivedOrgName(ctx)` — owner `FullName`, falling back to the handle (`Name`), then the denormalized `OwnerName`. - `models/repo/repo_manifest.go`: drop the `Org` struct field. - `models/migrations/v1_27/v369.go` + `migrations.go`: **migration #368** drops the `repo_manifest.org` column (portable `base.DropTableColumns`). - `routers/api/v1/repo/manifest.go`: response derives `org`; `PUT` ignores it on write (read-only, like the already-derived `display_name`). - `routers/web/repo/setting/metadata.go` + `templates/repo/settings/metadata.tmpl`: Organization field shown read-only with the derived value. - `services/updateserver/joomla.go`: feed maintainer/organization now uses `DerivedOrgName` (single source of truth). ### Companion - MCP: MokoConsulting/mcp-mokogitea#35 removes `org` as a settable `metadata_update` param. ### Verification - `go build` of all changed packages: **pass** (models/repo, models/migrations/..., routers/api/v1/repo, routers/web/repo/setting, services/updateserver).
jmiller added 1 commit 2026-07-12 23:36:37 +00:00
fix(metadata): derive org from org profile instead of storing it
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 29s
Universal: Build & Release / Promote to RC (pull_request) Failing after 8s
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Generic: Project CI / Lint & Validate (pull_request) Has been cancelled
Generic: Project CI / Tests (pull_request) Has been cancelled
PR RC Release / Build RC Release (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
Universal: PR Check / Require Docs Update (pull_request) Has been cancelled
Universal: PR Check / Wiki Update Reminder (pull_request) Has been cancelled
Universal: PR Check / Secret Scan (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Generic: Repo Health / Access control (pull_request) Has been cancelled
Generic: Repo Health / Site Health (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
7f436128fd
The repo metadata org field was a stored, editable value that snapshotted
the owner name and could drift when an organization was renamed. It is now
derived from the org profile (repository owner) on read and is read-only.

- models/repo/repo.go: add Repository.DerivedOrgName (owner FullName, falling
  back to the handle, then the denormalized OwnerName)
- models/repo/repo_manifest.go: drop the Org struct field
- models/migrations/v1_27/v369.go + migrations.go: migration #368 drops the
  repo_manifest.org column
- routers/api/v1/repo/manifest.go: derive org in the response, ignore it on write
- routers/web/repo/setting/metadata.go + templates: show org read-only (derived)
- services/updateserver/joomla.go: use DerivedOrgName for the feed maintainer

Closes #771
jmiller reviewed 2026-07-13 00:24:25 +00:00
jmiller left a comment
Author
Owner

Code review (targeting main): clean — approve on correctness.

  • Repository.DerivedOrgName: safe fallback FullName -> Name -> OwnerName, self-loads owner, never empty/erroring.
  • API manifest.go: all three response sites derive org; setStr("org") and the create-default removed (write is a no-op). Body still decodes into a raw map, so dropping the struct write is safe.
  • Web metadata.go + template: DerivedOrg exposed; form no longer reads org; input is readonly with no name attribute.
  • Migration #368 (v369.go): portable base.DropTableColumns, registered exactly once.
  • joomla.go: maintainer unified onto DerivedOrgName (superset of prior FullName->Name).

Verified go build passes for all changed packages. No code blockers.

⚠️ Do not merge yet — CI is red only because all ubuntu-latest runners are offline (jobs cancel at 0s); this diff is unrelated. Merge once a runner is back and checks are green.

**Code review (targeting `main`): clean — approve on correctness.** - `Repository.DerivedOrgName`: safe fallback `FullName -> Name -> OwnerName`, self-loads owner, never empty/erroring. - API `manifest.go`: all three response sites derive `org`; `setStr("org")` and the create-default removed (write is a no-op). Body still decodes into a raw map, so dropping the struct write is safe. - Web `metadata.go` + template: `DerivedOrg` exposed; form no longer reads `org`; input is `readonly` with no `name` attribute. - Migration #368 (`v369.go`): portable `base.DropTableColumns`, registered exactly once. - `joomla.go`: maintainer unified onto `DerivedOrgName` (superset of prior `FullName->Name`). Verified `go build` passes for all changed packages. No code blockers. :warning: Do not merge yet — CI is red only because all `ubuntu-latest` runners are offline (jobs cancel at 0s); this diff is unrelated. Merge once a runner is back and checks are green.
jmiller added 1 commit 2026-07-13 00:38:09 +00:00
ci: re-trigger checks after runner recovery
Generic: Project CI / Tests (pull_request) Successful in 30s
Generic: Project CI / Lint & Validate (pull_request) Successful in 32s
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
PR RC Release / Build RC Release (pull_request) Successful in 31s
Universal: PR Check / Wiki Update Reminder (pull_request) Successful in 1s
Universal: PR Check / Validate PR (pull_request) Successful in 8s
Generic: Repo Health / Access control (pull_request) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 55s
Universal: PR Check / Require Docs Update (pull_request) Failing after 34s
Universal: PR Check / Secret Scan (pull_request) Successful in 35s
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 1s
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Has been skipped
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Universal: Build & Release / Build & Release Pipeline (pull_request) Failing after 1m9s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
793e4885e8
No code change. The prior run was canceled at 0s because all ubuntu-latest
runners were offline; this re-fires CI now that a runner is back. Ref #771.
Author
Owner

Wiki reminder: docs are wiki-first -- if this PR changes behavior, usage, config, or standards, please update the repo wiki before/after merge. (non-blocking)

<!-- wiki-reminder --> **Wiki reminder:** docs are wiki-first -- if this PR changes behavior, usage, config, or standards, please update the repo wiki before/after merge. _(non-blocking)_
jmiller merged commit 6093300fbb into main 2026-07-13 00:40:57 +00:00
jmiller deleted branch fix/metadata-org-derived-from-profile 2026-07-13 00:40:58 +00:00
Sign in to join this conversation.
No Reviewers
Priority -
Type -
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea-Fork#772