Expand description
Forge-neutral adapter layer for VGI git namespaces.
A VTC governs who may create, own, maintain and commit to repositories in
a namespace; the forge (GitHub, Forgejo, …) is where that is enforced.
This crate is the seam between the two: the Forge trait an adapter
implements, the ForgeHooks it may add, and the data both sides
exchange — Resources, EffectiveRights, Capabilities,
bootstrap plans, ForgeEvents and Drift.
Nothing here talks to a forge. Adapters live in their own crates
(vgi-forge-github first), so the core compiles without any forge’s
HTTP stack, and a forge’s limitations reach the core only as
Capabilities — never as a branch on which forge it is.
Three rules hold across every adapter:
- Resources are forge-qualified and normalised by the one grammar in
vgi_core::resource, so a grant, a registry tuple and a verify-trust query name a repository with the same bytes. - Roles round down. A forge with fewer role levels gives less than
the community asked for, never more (
collapse_to_ladder). - Accounts are numeric ids. Logins are display-only; a renamed and re-registered login must never inherit a role.
Structs§
- Apply
Report - Result of converging a repository’s roles.
- Bind
Callback - The forge’s redirect back to the bridge after a bind.
- Bind
Request - Start binding a namespace (§4.1 step 1).
- Bootstrap
Report - Result of
run_plan. In-process only (it carriesForgeError); the bridge reports it to the VTC in its own job-result shape. - Bootstrap
Step - One step of a bootstrap plan.
- Capabilities
- What a forge — and one namespace on it — can do (§5.8).
- Collaborator
- A collaborator as observed on the forge.
- Effective
Rights - The rights one subject holds on one resource, closed under implication.
- Extra
File - A community-supplied file to commit during bootstrap.
- Forge
Account - A person’s account on a forge. The numeric id is authoritative; the login is for display and can be renamed and re-registered (§4.4).
- Forge
Event - A verified, translated webhook delivery.
- Namespace
- A bound namespace, as the adapter needs it (§4.1). The VTC’s record has
more (
id,boundBy,boundAt); the adapter needs only what locates the owner on the forge and the credential that acts on it. - Namespace
Binding - A completed bind.
- NoHooks
- Hooks that do nothing.
- Projection
- What the VTC says a repository should look like on the forge: the enforced projection of §2.
- Protection
Spec - Branch protection to enforce on the default branch.
- Protection
State - The default-branch protection that makes the check mean something, as
observed. Each flag is the protective state, so
Defaultis “nothing protected”. - Repo
Settings - Repository settings a bootstrap enforces alongside the protection.
- Repo
Spec - A repository to create (§5.2
git-ns/repo/create). - Repo
State - A repository as observed on the forge.
- Resource
- A normalised forge-qualified resource:
github.com/acmeorgithub.com/acme/widgets. - Role
Assignment - One person’s desired role on one repository.
- Role
Change - What happened to one person in
crate::Forge::apply_roles. - RoleMap
- Which forge role each repository tier asks for, before the forge’s ladder is applied (§4.2’s “GitHub projection (org)” column is the default).
- VgiConfig
- Forge-neutral inputs to a bootstrap plan.
Enums§
- Bind
Step - Where to send the admin next.
- Bootstrap
Component - Which part of the VTC’s bootstrap status (§4.3
bootstrap) a step satisfies — the four dots on the Repos page. - Check
Source Guard - What keeps a repository’s check out of reach of the pull request it checks (§9), as observed.
- Drift
- A difference between forge state and the VTC projection (§5.6 table).
- Forge
Error - A failed forge operation.
- Forge
Event Kind - What a
ForgeEventreports. - Forge
Kind - Which forge software an adapter speaks.
- Forge
Role - A person’s role on a repository, on the forge’s side, as a point on the
common ladder. Ordered:
None < Read < … < Admin. - Hook
Decision - What a hook wants the core to do.
- Installation
Change - How an automation installation changed.
- Link
Callback - Completion input for a link.
Debugredacts the device code, as forLinkStep. - Link
Method - How a member links their forge account (§4.4).
- Link
Step - Where a member goes to link their account.
- Member
Change - How a membership or collaborator changed.
- Merge
Method - A way a pull request can land on the default branch.
- Namespace
Kind - Whether a namespace is an organisation or a personal account (§3, §8).
- Protection
Gap - One way the protection falls short of §5.3.
- Required
Check Kind - How a forge makes a status check required (§5.8 table).
- Right
- One of the five git rights a VTC grants (§4.2), by registry action.
- Role
Outcome - Outcome of one role change.
- Step
Action - What a step does.
- Step
Outcome - What running one step did.
- Unlisted
- What to do with direct collaborators the desired set does not mention.
- Visibility
- Repository visibility.
Constants§
- DEFAULT_
REQUIRED_ CHECK - The required status check’s default name: the verify-trust job’s
name. - OWNER_
REPO_ DEPTH - Path depth on forges whose paths are exactly
owner[/repo]— GitHub and Forgejo (§4.5).
Traits§
- Forge
- One forge implementation. Stateless apart from its credentials and the namespaces it has been told about; the core owns all desired state and hands the adapter a plan.
- Forge
Hooks - Optional per-adapter hooks. Every method defaults to
HookDecision::Continue; an adapter overrides only what its forge does differently.
Functions§
- collapse_
to_ ladder - Fit
requestedonto a forge’s ladder: the highest level on the ladder that does not exceed it, orForgeRole::Nonewhen every level does. - default_
diff - The default
crate::Forge::diff: compare observed state with the projection field by field. Roles are matched on the numeric account id, never the login; a pending invitation counts as present. - protection_
gaps - Protection shortfalls of
observedagainst a requiredcheck. - run_
plan - Run
stepsin order againstrepo, stopping at the first failure. - validate_
repo_ path - Validate a repository-relative path for a
StepAction::WriteFile: no absolute paths, no empty,.or..segments, no backslashes. Adapters call this before building a URL from it.
Type Aliases§
- Result
- Shorthand for adapter results.