feat: MCP support for profiles.json v2 contexts schema with enabled enforcement #120

Closed
opened 2026-07-03 01:02:12 -05:00 by jcwalker3 · 0 comments
Owner

Problem

The merged v2 parser (#103) implements version: 2 as environments → services → identities. The canonical live config at ~/.config/gitea-tools/profiles.json uses the contexts shape (contexts / profiles / projects / rules) with enabled flags. Result today:

  • gitea_config.load_config() rejects the live file (version 2 config requires a non-empty 'environments' object).
  • gitea_auth.get_auth_header() swallows the ConfigError and silently falls back to env/keychain auth — violating the no_silent_fallback rule.
  • The enabled flag is not understood anywhere in the parser.

Required behavior

  1. Load profiles.json version 2 in the contexts shape: contexts, profiles, projects, per-context services, rules.
  2. Enforce enabled flags: refuse to select/act with disabled profiles, contexts, projects, or services. Disabled entries are reported in audits but never used.
  3. Resolve the active identity from GITEA_MCP_PROFILE.
  4. Never silently fall back to another profile or service; when GITEA_MCP_CONFIG is set and the config or selected profile is unusable, fail closed with a clear, secret-free error.
  5. Resolve the Gitea base URL from the selected profile/context.
  6. Resolve Jenkins and GlitchTip/Sentry service configs from the active context (Keychain ID references only).
  7. Keep backward compatibility with version 1 configs and with the existing v2 environments shape (#103).
  8. Add validation/audit output that reports enabled/disabled profiles and services without printing secrets.

Tests (acceptance)

  • v1 config still loads and resolves (compatibility).
  • v2 contexts shape: active profile resolution via GITEA_MCP_PROFILE.
  • Disabled profile refusal (fail closed, no fallback).
  • Disabled context refusal (enabled profile in disabled context refused).
  • Disabled service refusal.
  • Project-to-context mapping resolution.
  • Auth references are Keychain IDs only; inline token/password values rejected; no secret values in errors or audit output.

Notes

  • MDCPS GlitchTip currently uses https://git.dadeschools.net as a temporary endpoint — intentional; carry a description noting it should be replaced with the final GlitchTip URL later. Not a blocker.
  • No production mutations; author/reviewer separation applies (no self-review, no self-merge).
## Problem The merged v2 parser (#103) implements `version: 2` as `environments → services → identities`. The canonical live config at `~/.config/gitea-tools/profiles.json` uses the **contexts shape** (`contexts` / `profiles` / `projects` / `rules`) with `enabled` flags. Result today: - `gitea_config.load_config()` rejects the live file (`version 2 config requires a non-empty 'environments' object`). - `gitea_auth.get_auth_header()` swallows the `ConfigError` and silently falls back to env/keychain auth — violating the `no_silent_fallback` rule. - The `enabled` flag is not understood anywhere in the parser. ## Required behavior 1. Load `profiles.json` version 2 in the contexts shape: `contexts`, `profiles`, `projects`, per-context `services`, `rules`. 2. Enforce `enabled` flags: refuse to select/act with disabled profiles, contexts, projects, or services. Disabled entries are reported in audits but never used. 3. Resolve the active identity from `GITEA_MCP_PROFILE`. 4. Never silently fall back to another profile or service; when `GITEA_MCP_CONFIG` is set and the config or selected profile is unusable, fail closed with a clear, secret-free error. 5. Resolve the Gitea base URL from the selected profile/context. 6. Resolve Jenkins and GlitchTip/Sentry service configs from the active context (Keychain ID references only). 7. Keep backward compatibility with version 1 configs and with the existing v2 environments shape (#103). 8. Add validation/audit output that reports enabled/disabled profiles and services without printing secrets. ## Tests (acceptance) - v1 config still loads and resolves (compatibility). - v2 contexts shape: active profile resolution via `GITEA_MCP_PROFILE`. - Disabled profile refusal (fail closed, no fallback). - Disabled context refusal (enabled profile in disabled context refused). - Disabled service refusal. - Project-to-context mapping resolution. - Auth references are Keychain IDs only; inline token/password values rejected; no secret values in errors or audit output. ## Notes - MDCPS GlitchTip currently uses `https://git.dadeschools.net` as a **temporary** endpoint — intentional; carry a `description` noting it should be replaced with the final GlitchTip URL later. Not a blocker. - No production mutations; author/reviewer separation applies (no self-review, no self-merge).
jcwalker3 added the status:in-progress label 2026-07-03 01:02:24 -05:00
sysadmin removed the status:in-progress label 2026-07-03 01:36:23 -05:00
Sign in to join this conversation.