Skip to content

feat(control): project member quota control (ISSUE-507) - #504

Merged
thomasboni merged 2 commits into
mainfrom
feat/project-member-quota
Dec 3, 2026
Merged

thomasboni merged 2 commits into
mainfrom
feat/project-member-quota

Conversation

@thomasboni

@thomasboni thomasboni commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds numberOfProjectMembersMustRespectQuota (CTRL-507, ISSUE-507), a GitLab-only access control that checks how many people hold each role on a project against per-role bounds the policy sets. A standalone run reads GET /projects/:id/members/all with the run's own token, only when a policy enables the control. Everyone with effective access counts once at their highest level (direct members, members inherited from ancestor groups, invited groups); access-token bots are excluded (usernames of the shape project_<id>_bot_<random> and group_<id>_bot_<random>, plus the legacy project_<id>_bot and project_<id>_bot1 forms). The listing stops after 20 pages: past that cap the count is unknown and the control does not evaluate. A platform run reads the counts from the snapshot's members lane and never calls the members API itself. Whenever the counts are unknown (a 403/404 on the listing, the page cap, a server error, a degraded lane, a platform that does not serve the lane) the control reports not_evaluable with a reason (collection_failed, snapshot_lane_degraded, lane_not_served) rather than a verdict; only a network failure degrades the run. One finding per role outside its bounds, identity code + role; a role never yields two findings (on inverted bounds the maximum finding wins).

This brings back the v1 platform's "Number of project members must respect a quota" control with the v1 keys, so v1 policies map onto it 1:1. Severity medium, category Access and Authorization, every GitLab plan.

Configuration

All eight keys are optional integers, bounds inclusive. An unset key asserts nothing. Enabled with no bound set is config_required. A negative bound or a minimum above its maximum is refused at config load.

Key Bound
ownerMin / ownerMax Owners (access level 50)
maintainerMin / maintainerMax Maintainers (40)
developerMin / developerMax Developers (30)
totalMin / totalMax Every member at any role, bots excluded
gitlab:
  controls:
    numberOfProjectMembersMustRespectQuota:
      enabled: true
      ownerMax: 3
      maintainerMax: 5
      totalMax: 30

The shipped default declares the control disabled with the eight keys documented. The init wizard is not extended: the control has no product defaults (same as mergeRequestSettingsMustBeCompliant).

Commits

  1. feat(control): add numberOfProjectMembersMustRespectQuota (ISSUE-507): config struct and load-time validation, registry, issue code, catalog, IR, the Rego rule and its tests, identity {role}.
  2. feat(gitlab): collect project member counts per role: the paginated fetcher, bots excluded, page cap, 403/404 classification.
  3. feat(platform): read the members snapshot lane: snapshot.data.members and degraded_fields: members.
  4. feat(control): wire the member quota control through the collection lanes: the gated lane, engine config, status, lane bookkeeping, collection_failed on a non-network error, the network carve-out in the whole-run status loop, the call inventory (standalone 18 requests, platform 3).
  5. feat(cmd): report the member quota control in the terminal, JSON and shipped default.

E2E evidence

Standalone, gitlab.com thomasboni/test2, config ownerMax: 0, totalMin: 1:

plumber analyze --provider gitlab --gitlab-url https://gitlab.com --project thomasboni/test2 --branch master --config mq.plumber.yaml --print --verbose

level=debug msg="Fetched project member counts" developers=0 maintainers=1 owners=2 total=3

  ✗ Number of project members must respect a quota (1 issue)
      Owners: 2
      Maintainers: 1
      Developers: 0
      Total Members: 3
      Roles Out Of Quota: 1
      Issues Found:
         MED   [ISSUE-507] The project has 2 owners, above the quota maximum of 0.

  │ Number of project members must respect a quota │ ISSUE-507 │ Medium │ 1 │

JSON (--output): projectMemberQuotaResult has status: failed, metrics {owners: 2, maintainers: 1, developers: 0, total: 3, rolesOutOfQuota: 1}, and one ISSUE-507 issue with role: owner, currentCount: 2, authorizedMax: 0.

Unreadable listing (nil or Known=false): the terminal block renders a single caveat line ("Project members not evaluated ..."), JSON status error, the count metrics omitted. Without GITLAB_TOKEN the CLI stops before any request, as today.

Platform mode, in process (the GitLab lab project has no platform job to drive from this session). The recorded GitLab ledger stays at 3 requests (GET /projects/:id, repository/commits, repository/files/:file/raw), never members/all:

  • lane absent (every platform today): not_evaluable / lane_not_served, no ISSUE-507 (TestPlatformRunWithoutMembersLaneAbstains);
  • lane served: standalone and platform reach the same ISSUE-507 verdict (TestSwitchedLanesReportTheSameVerdicts);
  • lane degraded: snapshot_lane_degraded (TestDegradedNewLanesAbstainEndToEnd).

go test ./... green (14 packages), golangci-lint run 0 issues. make deadcode reports configuration.ConfigSchemas, which CI already filters and which is not touched here.

Platform lane

The platform collector for the members lane ships in a separate monorepo PR (pin bump, contract, collector, frontend editor, docs). Until it lands, every platform run reports this control as not_evaluable with reason lane_not_served: honest abstention, never a pass.

🤖 Generated with Claude Code

@thomasboni
thomasboni marked this pull request as ready for review September 29, 2026 04:08
Comment thread gitlab/members.go Resolved
Comment thread cmd/legacy_json_gitlab_test.go Resolved
@thomasboni
thomasboni force-pushed the feat/project-member-quota branch from af70d25 to e9fd989 Compare September 29, 2026 04:19
Comment thread configuration/plumberconfig.go Resolved
@thomasboni
thomasboni force-pushed the feat/project-member-quota branch from e9fd989 to 9640bfd Compare September 29, 2026 04:26
Comment thread control/task.go Resolved
Comment thread gitlab/members.go Resolved
@thomasboni
thomasboni force-pushed the feat/project-member-quota branch from 9640bfd to 6cc7ed6 Compare September 29, 2026 04:37
@thomasboni
thomasboni force-pushed the feat/project-member-quota branch from 6cc7ed6 to ac474b4 Compare October 8, 2026 02:04
@thomasboni
thomasboni force-pushed the feat/project-member-quota branch from ac474b4 to 7912e56 Compare December 2, 2026 10:18
@thomasboni

Copy link
Copy Markdown
Contributor Author

Standalone run after the 2026-12-02 rebase on main. The control was enabled with ownerMax 1, developerMin 1000, totalMax 2 against getplumber/plumber on gitlab.com (thomasboni/test2 has no main branch). The baseline is a build of origin/main (v0.7.24), which lacks the control, so the only difference is the new control. Diff baseline vs this branch:

1,2d0
< Configuration validation warnings:
<   - Unknown control in gitlab.controls: "numberOfProjectMembersMustRespectQuota"
20,23d17
<   ⚠ WARNING: No controls could be evaluated!
<   Data collection failed: no checks could run.
<   Re-run with --verbose for details.
< 
54a49,62
> ✗ Individual findings (2)
> ────────────────────
> 
>  MED   ISSUE-507  Project member count is outside its role quota (2 findings)
>        │
>        ├──▶ The project has 3 developers, below the quota minimum of 1000.
>        └──▶ The project has 5 members, above the quota maximum of 2.
> 
>        Fix    review the project's members in Settings > Members: remove or downgrade members of a
>               role that is over its quota, or add members of a role that is under it, so each role
>               count falls within the configured bounds
>        ↳ docs: https://getplumber.io/docs/cli/issues/ISSUE-507
> 
> ────────────────────
58,63c66,71
<  ██████╗   Plumber Score  withheld
<  ╚════██╗  Status: NOTHING CHECKED (no control was evaluated)
<    ███╔═╝
<    ╚══╝    Why: every enabled control needs configuration or was skipped
<    ██╗     Next: enable or configure at least one control, then re-run
<    ╚═╝
---
>   █████╗   Plumber Score  90 / 100  █████████████████████████░░░
>  ██╔══██╗  Status: FAILED (gate blocks at 100 pts)
>  ███████║
>  ██╔══██║  Best fix: see the documentation of the finding, +10 pts, 100 / 100 (A)
>  ██║  ██║
>  ╚═╝  ╚═╝

@thomasboni

Copy link
Copy Markdown
Contributor Author

Documentation PR: getplumber/getplumber.io#579

@Exypte Exypte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two fixes before merge (the CI early return and awaiting members), plus three nits inline.

Comment thread control/task.go Resolved
Comment thread gitlab/members.go Resolved
Comment thread cmd/legacy_json.go Resolved
Comment thread configuration/plumberconfig.go Resolved
Comment thread control/task.go Resolved
Comment thread cmd/legacy_json_gitlab_test.go Resolved
thomasboni added a commit to getplumber/getplumber.io that referenced this pull request Dec 3, 2026
…s no CI file

Follows the review of getplumber/plumber#504: awaiting memberships and blocked or banned accounts are not counted, a deactivated account is, and the control is checked on a project without a valid CI file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR
Comment thread control/task.go Resolved
@thomasboni
thomasboni requested a review from Exypte December 3, 2026 15:48
@thomasboni
thomasboni force-pushed the feat/project-member-quota branch from 4dc8609 to b139654 Compare December 3, 2026 15:49
Comment thread control/task.go Resolved
Comment thread cmd/analyze_shared.go Resolved
Adds numberOfProjectMembersMustRespectQuota (CTRL-507, GitLab only): eight optional inclusive
bounds (min and max for Owner, Maintainer, Developer and the total), one ISSUE-507 finding per
role outside its bounds.

Who is counted: everyone with effective access (direct, inherited and invited-group members),
each once at their highest role. Access-token bots are excluded, and so are memberships awaiting
approval and blocked, banned or pending accounts. A deactivated account is counted.

Collection: one members listing per run, capped at 20 pages, fetched only when a bound is set;
in platform mode the counts come from the snapshot's members lane. An unreadable listing or a
project over the cap reports not evaluable, never a pass. The control does not need a CI file:
on a project with none, or an invalid one, it is evaluated on its own and its finding is listed.

Reported in the terminal, the JSON (projectMemberQuotaResult) and the shipped default config.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR
@thomasboni
thomasboni force-pushed the feat/project-member-quota branch from 30be41e to ddef0fb Compare December 3, 2026 16:01
…mited run

attachMemberQuotaOnly marked the member quota control collection_failed on
every limited analysis (missing or invalid CI file, image network failure),
even when the control was disabled or filtered out by --controls or
--skip-controls. Since the default config ships it disabled, any project
without a valid CI file reported a failed collection for a control nobody
turned on. The helper now returns early unless the control is active.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread gitlab/members.go Resolved

@Exypte Exypte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed 8adf756 so a disabled or filtered-out member quota control is no longer marked collection_failed on a run without a valid CI file.

@thomasboni
thomasboni merged commit a031f89 into main Dec 3, 2026
18 checks passed
@thomasboni
thomasboni deleted the feat/project-member-quota branch December 3, 2026 17:11
plumber-release Bot pushed a commit that referenced this pull request Dec 3, 2026
## [0.7.25](v0.7.24...v0.7.25) (2026-12-03)

### ✨ Features

* **control:** project member quota control (ISSUE-507) ([#504](#504)) ([a031f89](a031f89))

### 📚 Documentation

* **readme:** open-source scanner description, Agent line and the scanner vs agent table ([#674](#674)) ([95b78ab](95b78ab))
thomasboni added a commit to getplumber/getplumber.io that referenced this pull request Dec 3, 2026
* docs(issues): document ISSUE-507, project member quota (CTRL-507)

The project member quota control returns under its original id: the ISSUE-507 page leaves the removed state, the control gets its catalog row and CTRL-507 id, and the configuration reference documents the eight optional bounds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR

* docs(controls): who the member quota control counts, and that it needs no CI file

Follows the review of getplumber/plumber#504: awaiting memberships and blocked or banned accounts are not counted, a deactivated account is, and the control is checked on a project without a valid CI file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
thomasboni added a commit that referenced this pull request Dec 3, 2026
Brings in the project member quota control (ISSUE-507, #504) and the 0.7.25 release. Conflicts
were additive on both sides and keep both controls; the catalog golden is regenerated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmKdDgroztPWz5N5LBCVzR
thomasboni added a commit that referenced this pull request Dec 3, 2026
Conflicts with the member quota control (#504) and the merge gates (#677),
both sides kept everywhere:

- control/task.go: the engine config goes through engineConfigFor then
  omitUnreadMergeGates; the two GitLab early returns attach the member
  quota verdict and mark mise-en-place not evaluated; runRegoEngine keeps
  its error return and takes membersData; the end of the run marks the
  merge gates gap and the mise gap.
- control/packagemanagers_run_test.go: runRegoEngine call updated to the
  new signature (a compile break git did not flag).
- control/platform_call_inventory_test.go: recorder fields of both sides.
- test lists and the fingerprint golden: both controls listed.
- cmd/testdata/catalog_golden.json: regenerated with -update-catalog.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UuPoP4xPXZ8rLEDYRiKznq
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.

2 participants