Skip to content

feat(gates): MaxImpact cap, --allow-major, and dogfood the API surface gate - #1

Merged
manuc66 merged 6 commits into
mainfrom
feat/safety-gates-and-api-surface-dogfooding
Aug 22, 2026
Merged

feat(gates): MaxImpact cap, --allow-major, and dogfood the API surface gate#1
manuc66 merged 6 commits into
mainfrom
feat/safety-gates-and-api-surface-dogfooding

Conversation

@manuc66

@manuc66 manuc66 commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

ChangeSharp documented API-impact detection gates (--api-min-level floor and the new MaxImpact cap) without ever applying them to itself. This PR implements and dogfoods both gates on the real public surfaces: CLI, MCP, and the library.

What changed

1. MaxImpact cap (new symmetric guard)

  • SemverPolicy.MaxImpact (patch | minor | major, default major = cap disabled) — single source of truth in ChangeSharpConfig.cs
  • Enforced at creation (new, interactive + flags) and release (release), both requiring the explicit --allow-major flag
  • Interactive menu marks blocked categories (⚠ blocked (MaxImpact)) and re-prompts
  • Actionable error messages (required level vs configured cap)
  • Self-verifying demo: samples/maximpact-gate/run-demo.sh (11/11, CLI + MCP)

2. Dogfood the API Surface Gate on ChangeSharp itself

  • Committed baselines in tests/public-api/: cli-help.txt (CLI), mcp-tools.json (MCP), public-api.txt (library via PublicApiGenerator)
  • scripts/update-public-api.sh to regenerate
  • CI job api-surface: regenerates → verifies the committed baselines → derives impact (additions = minor, removals = major) → runs changesharp validate --api-min-level <impact>
  • PublicApiBaselineTests also enforces the library baseline at dotnet test time

3. MCP aligned with the CLI

  • create_fragment: allowMajor
  • validate_fragments: apiMinLevel
  • perform_release: allowMajor + apiMinLevel

4. Single gate orchestration in the library

  • WorkspaceManager.GetCreateFragmentError and GetReleaseGateResult centralize the gate sequence (floor then cap) so the CLI and MCP cannot drift
  • --allow-major decisions are recorded in the release output (audit trail)

5. Tests & docs

  • 22 new unit tests (WorkspaceManagerTests) + 1 baseline test → 114 tests green
  • Docs updated: SemVer Rules, ApiSurfaceGate, McpIntegration, Roadmap, README, index
  • 6 fragments created before commits (per AGENTS.md)

Verification

  • dotnet build ChangeSharp.sln -c Release: 0 errors
  • dotnet test: 114/114
  • samples/maximpact-gate/run-demo.sh: 11/11 (CLI + MCP gate scenarios)

Known limits

  • The prerelease create/promote path bypasses the gates (pre-existing, shared with --api-min-level); documented in SemVer Rules.
  • The repo keeps MaxImpact: major (cap not enabled here), as agreed; the mechanism is exercised on the sample workspace.

…e gate

- SemverPolicy.MaxImpact (default major = cap off): fragments/releases that
  would force a Major bump are refused at new and release unless --allow-major
  is passed. Interactive menu marks blocked categories and re-prompts.
- MCP tools expose the gates: validate_fragments apiMinLevel, perform_release
  allowMajor/apiMinLevel.
- Dogfood the API Surface Gate on ChangeSharp itself: committed baselines
  (tests/public-api: cli-help, mcp-tools, public-api via PublicApiGenerator),
  scripts/update-public-api.sh, api-surface CI job, PublicApiBaselineTests.
- Demo workspace samples/maximpact-gate with self-verifying run-demo.sh.
- Docs updated (SemVer Rules, ApiSurfaceGate, McpIntegration, Roadmap).
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

- MCP create_fragment now enforces SemverPolicy.MaxImpact with an allowMajor
  opt-in, matching the CLI new command (review finding).
- Regenerate mcp-tools.json baseline (create_fragment schema).
- Document that prerelease create/promote bypass the gates (pre-existing
  behavior, shared with --api-min-level), that cli-help rewording is treated
  conservatively as major by the api-surface heuristic, and that
  scripts/update-public-api.sh requires jq (now checked up front).
…-major

- Add WorkspaceManager.GetCreateFragmentError and GetReleaseGateResult so the
  CLI and MCP share the exact same gate sequence (floor then cap), removing the
  CLI/MCP orchestration drift (create_fragment had been missed initially; gate
  vs security precedence differed).
- Add NextVersionComputer.ImpactName; drop the duplicated CLI/MCP helpers.
- Record the explicit --allow-major decision in release output (CLI warning +
  JSON warnings; MCP response text) as an audit trail.
- Extend samples/maximpact-gate/run-demo.sh with MCP e2e gate scenarios (11/11).
- Note the MaxImpact/Mappings interaction (Changed->Major + minor cap blocks
  Changed) in SemVer Rules.
- Regenerate public-api.txt baseline (+ImpactName, +GetCreateFragmentError,
  +GetReleaseGateResult).
- Extract RenderCategoryMenu and ApplyCategoryKey out of PromptForCategory.
- Extract BumpForImpact out of ComputeVersionWithWarning (behavior preserved,
  covered by the existing SemVer tests).
@manuc66
manuc66 merged commit 828cedf into main Aug 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant