[Bug] Metadata org field should be derived from the org profile, not stored/editable #771

Closed
opened 2026-07-12 23:10:47 +00:00 by jmiller · 0 comments
Owner

Summary

The repository metadata Organization field (RepoMetadata.Org, DB column repo_manifest.org) is a manually-entered, stored value that can silently drift from the actual organization (the repository owner / org profile). It should instead be derived from the org profile wherever it is consumed, including the update-server feed.

Current behavior

  • Org is a first-class stored column (models/repo/repo_manifest.go).
  • All three write paths accept org as input and persist a snapshot of the owner name:
    • API: routers/api/v1/repo/manifest.go (setStr("org", &m.Org), defaults to OwnerName).
    • Web UI: routers/web/repo/setting/metadata.go (Org: ctx.FormString("org")).
    • MCP: mcp-mokogitea-api metadata_update exposes org as settable.
  • The update server (services/updateserver/joomla.go) never reads Org at all — it already derives the maintainer from repo.Owner. The stored Org is therefore redundant and a drift hazard: rename the org and every repo's stored org is stale.

Expected behavior

Organization is derived from the org profile (the repo owner) on every read and is read-only across all surfaces:

  • Derivation source: repo.Owner.FullName, falling back to repo.Owner.Name when blank (same rule the update-server maintainer already uses).
  • Not accepted on write via API, web form, or MCP (treated like the already-derived display_name).

Fix (approved approach)

  1. Drop the org column from repo_manifest via a new DB migration.
  2. Remove Org from the RepoMetadata struct.
  3. Derive org from the owner in the API response, the web view, and the update-server metadata resolution.
  4. Make the web template field read-only (display derived value).
  5. Update mcp-mokogitea-api to mark org server-derived / read-only in metadata_update.

Affected files

  • models/repo/repo_manifest.go
  • models/migrations/… (new migration to drop repo_manifest.org)
  • routers/api/v1/repo/manifest.go
  • routers/web/repo/setting/metadata.go + templates/repo/settings/metadata.tmpl
  • services/updateserver/joomla.go
  • mcp-mokogitea-api (separate repo): src/index.ts metadata_update

/kind bug

## Summary The repository metadata `Organization` field (`RepoMetadata.Org`, DB column `repo_manifest.org`) is a **manually-entered, stored** value that can silently drift from the actual organization (the repository owner / org profile). It should instead be **derived from the org profile** wherever it is consumed, including the update-server feed. ## Current behavior - `Org` is a first-class stored column (`models/repo/repo_manifest.go`). - All three write paths accept `org` as input and persist a snapshot of the owner name: - API: `routers/api/v1/repo/manifest.go` (`setStr("org", &m.Org)`, defaults to `OwnerName`). - Web UI: `routers/web/repo/setting/metadata.go` (`Org: ctx.FormString("org")`). - MCP: `mcp-mokogitea-api` `metadata_update` exposes `org` as settable. - The update server (`services/updateserver/joomla.go`) never reads `Org` at all — it already derives the maintainer from `repo.Owner`. The stored `Org` is therefore redundant and a drift hazard: rename the org and every repo's stored `org` is stale. ## Expected behavior `Organization` is **derived from the org profile** (the repo owner) on every read and is **read-only** across all surfaces: - Derivation source: `repo.Owner.FullName`, falling back to `repo.Owner.Name` when blank (same rule the update-server maintainer already uses). - Not accepted on write via API, web form, or MCP (treated like the already-derived `display_name`). ## Fix (approved approach) 1. Drop the `org` column from `repo_manifest` via a new DB migration. 2. Remove `Org` from the `RepoMetadata` struct. 3. Derive `org` from the owner in the API response, the web view, and the update-server metadata resolution. 4. Make the web template field read-only (display derived value). 5. Update `mcp-mokogitea-api` to mark `org` server-derived / read-only in `metadata_update`. ## Affected files - `models/repo/repo_manifest.go` - `models/migrations/…` (new migration to drop `repo_manifest.org`) - `routers/api/v1/repo/manifest.go` - `routers/web/repo/setting/metadata.go` + `templates/repo/settings/metadata.tmpl` - `services/updateserver/joomla.go` - `mcp-mokogitea-api` (separate repo): `src/index.ts` `metadata_update` /kind bug
Sign in to join this conversation.