Skip to main content

Pack · source-control

scm.repository

packs/source-control/blocks/repository.yaml

packsource-control
4entities
9commands
9events
4views
28refusals
2KPIs

A history of files kept by a forge. A repository holds revisions, each a snapshot of files named by the version control system (agentic.workspace.Revision) with the digest of its tree and its parent revisions; and references, the names that point at a revision. A movable reference (what a version control system calls a branch) is moved only from the revision its mover last saw, so two writers never overwrite each other; a fixed reference (a tag) never moves. A checkout binds a workspace (agentic.workspace) to a repository and a reference, which is how an agent's files come from and go back to a repository. An archived repository takes no new revision, reference or checkout.

Depends on​

Used by​

  • scm.change · pack source-control · 9 references
  • scm.check · pack source-control · 9 references

Entities​

Checkout​

A workspace that holds a repository's files at a reference. Its writes leave the workspace as a proposal (agentic.workspace) or as a revision pushed to a reference.

Identified by checkout_id (CheckoutId).

fieldtype
repository_idRepositoryId
workspace_idWorkspaceId
referenceReferenceName
checked_out_attimestamp

Relations:

  • repository references Repository (one, by repository_id)
  • workspace references Workspace of workspace (one, by workspace_id)

Lifecycle of Checkout

ActiveRemovedremoveActiveRemovedremove
Ends in Removed.

Reference​

A name in the repository that points at one revision.

Identified by reference_id (ReferenceId).

fieldtype
repository_idRepositoryId
nameReferenceName
kindReferenceKind
targetRevision
moved_byPrincipalId
moved_attimestamp

Relations:

  • mover references Principal of principal (one, by moved_by)

Lifecycle of Reference

DeletedLivedeleteDeletedLivedelete
Ends in Deleted.

Repository​

One repository on one forge.

Identified by repository_id (RepositoryId).

fieldtypemeaning
forge_idForgeId
nameName
default_referenceReferenceNameThe reference a new checkout and a new change request target unless told otherwise.
created_byPrincipalId
created_attimestamp

Relations:

  • forge references Forge of scm.forge (one, by forge_id)
  • creator references Principal of principal (one, by created_by)
  • revisions owns Revision (many, by repository_id)
  • references owns Reference (many, by repository_id)

Lifecycle of Repository

ActiveArchivedarchiveunarchiveActiveArchivedarchiveunarchive

Revision​

One snapshot of the repository's files. It is recorded once and never changes; its name is the version control system's, its tree digest says what files it holds.

Identified by revision_id (RevisionId).

fieldtype
repository_idRepositoryId
revisionRevision
tree_digestTreeDigest
treelist of TreeEntry
parentslist of Revision
authored_byPrincipalId
messageContent
recorded_attimestamp

Relations:

  • author references Principal of principal (one, by authored_by)

Lifecycle: one state, Recorded; a recorded Revision does not change.

Commands​

ArchiveRepository​

Archive a repository.

Called by: Repository manager.

fieldtype
repository_idRepositoryId
attimestamp
outcomewhenresult
no-such-repository refusedno such RepositoryRepositoryNotFound: No repository of this identity exists.
archivedotherwisemoves the Repository Active → Archived; emits RepositoryArchivedEvent
wrong-state refusedthe Repository is in a state that does not allow itRepositoryStateConflict: The repository is not in a state this command acts from.

CheckOut​

Check a repository out into a workspace.

Called by: Repository manager.

fieldtype
checkout_idCheckoutId
repository_idRepositoryId
workspace_idWorkspaceId
referenceReferenceName
attimestamp
outcomewhenresult
no-such-repository refusedno Repository for repository_idRepositoryNotFound: No repository of this identity exists.
unknown-workspace refusedno Workspace for workspace_idUnknownWorkspace: No workspace of this identity exists.
archived refusedthe Repository of repository_id has state == ArchivedRepositoryArchived: The repository is archived; it takes no new revision, reference or checkout.
checked-outotherwisecreates a Checkout in Active; emits CheckedOut

CreateReference​

Create a reference.

Called by: Committer.

fieldtype
reference_idReferenceId
repository_idRepositoryId
nameReferenceName
kindReferenceKind
targetRevision
byPrincipalId
attimestamp
outcomewhenresult
already-exists refusedthe Reference exists alreadyReferenceExists: A reference of this identity exists.
no-such-repository refusedno Repository for repository_idRepositoryNotFound: No repository of this identity exists.
unknown-principal refusedno Principal for byUnknownPrincipal: No principal of this identity is registered.
archived refusedthe Repository of repository_id has state == ArchivedRepositoryArchived: The repository is archived; it takes no new revision, reference or checkout.
createdotherwisecreates a Reference in Live; emits ReferenceCreated

CreateRepository​

Create a repository on a forge.

Called by: Repository manager.

fieldtype
repository_idRepositoryId
forge_idForgeId
nameName
default_referenceReferenceName
created_byPrincipalId
attimestamp
outcomewhenresult
unknown-forge refusedno Forge for forge_idUnknownForge: No forge of this identity is registered.
unknown-creator refusedno Principal for created_byUnknownPrincipal: No principal of this identity is registered.
forge-retired refusedthe Forge of forge_id has state == RetiredForgeNotActive: The forge is retired; it hosts no new repository.
createdotherwisecreates a Repository in Active; emits RepositoryCreated

DeleteReference​

Delete a reference.

Called by: Committer.

fieldtype
reference_idReferenceId
attimestamp
outcomewhenresult
no-such-reference refusedno such ReferenceReferenceNotFound: No reference of this identity exists.
fixed refusedkind == FixedReferenceFixed: The reference is fixed; it never moves and is never deleted.
deletedotherwisemoves the Reference Live → Deleted; emits ReferenceDeleted
wrong-state refusedthe Reference is in a state that does not allow itReferenceStateConflict: The reference is deleted.

MoveReference​

Move a reference to another revision. Compare and set: the reference moves only when it still points at expected, the revision the mover last saw.

Called by: Committer.

fieldtype
reference_idReferenceId
expectedRevision
toRevision
byPrincipalId
attimestamp
outcomewhenresult
no-such-reference refusedno such ReferenceReferenceNotFound: No reference of this identity exists.
deleted refusedstate == DeletedReferenceStateConflict: The reference is deleted.
fixed refusedkind == FixedReferenceFixed: The reference is fixed; it never moves and is never deleted.
moved-since refusedtarget != input.expectedReferenceMoved: The reference no longer points where the mover saw it: someone moved it since. The mover reads it again and decides.
unknown-principal refusedno Principal for byUnknownPrincipal: No principal of this identity is registered.
movedotherwiseupdates the Reference; emits ReferenceMovedEvent

RecordRevision​

Record a revision.

Called by: Committer.

fieldtype
revision_idRevisionId
repository_idRepositoryId
revisionRevision
tree_digestTreeDigest
treelist of TreeEntry
parentslist of Revision
authored_byPrincipalId
messageContent
attimestamp
outcomewhenresult
already-recorded refusedthe Revision exists alreadyRevisionExists: A revision of this identity is already recorded; a revision never changes.
no-such-repository refusedno Repository for repository_idRepositoryNotFound: No repository of this identity exists.
unknown-author refusedno Principal for authored_byUnknownPrincipal: No principal of this identity is registered.
archived refusedthe Repository of repository_id has state == ArchivedRepositoryArchived: The repository is archived; it takes no new revision, reference or checkout.
recordedotherwisecreates a Revision in Recorded; emits RevisionRecorded

RemoveCheckout​

Remove a checkout.

Called by: Repository manager.

fieldtype
checkout_idCheckoutId
attimestamp
outcomewhenresult
no-such-checkout refusedno such CheckoutCheckoutNotFound: No checkout of this identity exists.
removedotherwisemoves the Checkout Active → Removed; emits CheckoutRemoved
wrong-state refusedthe Checkout is in a state that does not allow itCheckoutStateConflict: The checkout is removed.

UnarchiveRepository​

Take a repository out of the archive.

Called by: Repository manager.

fieldtype
repository_idRepositoryId
attimestamp
outcomewhenresult
no-such-repository refusedno such RepositoryRepositoryNotFound: No repository of this identity exists.
unarchivedotherwisemoves the Repository Archived → Active; emits RepositoryUnarchived
wrong-state refusedthe Repository is in a state that does not allow itRepositoryStateConflict: The repository is not in a state this command acts from.

Events​

eventfieldsemitted by
CheckedOutcheckout_id CheckoutId, repository_id RepositoryId, workspace_id WorkspaceId, reference ReferenceName, at timestampCheckOut
CheckoutRemovedcheckout_id CheckoutId, at timestampRemoveCheckout
ReferenceCreatedreference_id ReferenceId, repository_id RepositoryId, name ReferenceName, kind ReferenceKind, target Revision, by PrincipalId, at timestampCreateReference
ReferenceDeletedreference_id ReferenceId, at timestampDeleteReference
ReferenceMovedEventreference_id ReferenceId, from Revision, to Revision, by PrincipalId, at timestampMoveReference
RepositoryArchivedEventrepository_id RepositoryId, at timestampArchiveRepository
RepositoryCreatedrepository_id RepositoryId, forge_id ForgeId, name Name, default_reference ReferenceName, created_by PrincipalId, at timestampCreateRepository
RepositoryUnarchivedrepository_id RepositoryId, at timestampUnarchiveRepository
RevisionRecordedrevision_id RevisionId, repository_id RepositoryId, revision Revision, tree_digest TreeDigest, parents list of Revision, authored_by PrincipalId, at timestampRecordRevision

Views​

viewrowsfields
Checkouts
Checkouts
each Checkoutcheckout_id CheckoutId, repository_id RepositoryId, workspace_id WorkspaceId, reference ReferenceName, checked_out_at timestamp, state State
References
References
each Referencereference_id ReferenceId, repository_id RepositoryId, name ReferenceName, kind ReferenceKind, target Revision, moved_by PrincipalId, moved_at timestamp, state State
Repositories
Repositories
each Repositoryrepository_id RepositoryId, forge_id ForgeId, name Name, default_reference ReferenceName, created_by PrincipalId, created_at timestamp, state State
Revisions
Revisions
each Revisionrevision_id RevisionId, repository_id RepositoryId, revision Revision, tree_digest TreeDigest, tree list of TreeEntry, parents list of Revision, authored_by PrincipalId, message Content, recorded_at timestamp, state State

Types​

typeisvalues or fields
CheckoutIdan identifier or valueuuid
ReferenceIdan identifier or valueuuid
ReferenceKind
Movable is moved to later revisions (a branch); Fixed names one revision for good (a tag).
one ofMovable, Fixed
ReferenceName
The name of a reference inside its repository, such as main or release/1.2.
an identifier or valuestring
RepositoryIdan identifier or valueuuid
RevisionIdan identifier or valueuuid
TreeDigest
The digest of a revision's tree: every path and the digest of its content, in path order. Two revisions with the same tree digest hold the same files.
an identifier or valuestring
TreeEntrya recordpath Path, content Content, executable boolean

KPIs​

2 KPIs from the pack's catalogue, packs/source-control/kpis.yaml. A gate must be zero for a variant of an architecture to count.

Correctness​

KPIunitbettergatestatus
reference_lost_update
Reference moves that dropped a revision another writer had moved the reference to.
How: ReferenceMovedEvent events whose from is not the reference's target at that moment, by the preceding ReferenceCreated or ReferenceMovedEvent. The compare-and-set of MoveReference refuses these; any found is an implementation defect. Must be 0.
countlowergateplanned
source: design

Quality​

KPIunitbettergatestatus
revision_to_reference_seconds
Seconds from a revision being recorded to a reference pointing to it.
How: Median over revisions of the time from RevisionRecorded to the first ReferenceCreated or ReferenceMovedEvent whose target is that revision. Revisions no reference reaches are counted apart.
secondslower–planned
source: design

Settings​

The settings a part of this block carries in an architecture document. agenticspec sim check refuses any other setting (setting_unknown) and a value outside its type (setting_invalid), and a part that lacks a setting marked required in the default column; the contract copies a setting into the ports it narrows. The last rows of each table are the settings every part takes. What no setting here types (a file, a path, an audience, the use of a model) goes into the part's notes, a map with free keys and values that the check takes as written and nothing reads.

A part scm.repository:

settingtypeunitdefaultcontractwhat
countinteger of at least 11How many copies of the part run.
perpartOne copy of the part for each copy of the named part.
notesnotesFree notes on the part, a map with keys and values of any kind: what no setting of its block types. The check takes any map; the simulator, the search and the contract never read it.