Skip to main content

Pack · source-control

scm.change

packs/source-control/blocks/change.yaml

packsource-control
2entities
12commands
13events
2views
45refusals
4KPIs

A change request: the ask to bring the revisions of a source reference into a target reference of one repository, what a forge calls a merge request or a pull request. It is opened at a head revision; every push moves the head. Checks and reviews are about one head: a check verdict or a review for an older head is refused, and an approval stays bound to the head it was given for. A merge names the head it saw and the authority grant it acts under, and is refused unless that is still the head, it is not a draft, the head is approved, its checks passed and the grant is active. A merge may be armed to happen when the checks pass; the passed verdict then makes it due. A change request carries the forge's own reference, whether a review was requested and the change requests it depends on. It may carry a proposal of a workspace (agentic.workspace) and deliver a task (agentic.work).

Depends on​

Used by​

Entities​

ChangeRequest​

The ask to merge a source reference into a target reference, at a head revision, with the checks verdict and the approval of that head.

Identified by change_request_id (ChangeRequestId).

fieldtypemeaning
repository_idRepositoryId
source_referenceReferenceName
target_referenceReferenceName
headRevisionThe revision the source reference pointed at when last pushed.
titleContent
opened_byPrincipalId
opened_attimestamp
checksChecksVerdict
approved_headoptional RevisionThe head the last approval was given for; a later push leaves it on the older head.
approved_byoptional PrincipalId
proposal_idoptional ProposalIdThe workspace proposal this change request carries to the forge, when it came from one.
task_idoptional TaskIdThe task the change delivers, when it delivers one.
merged_revisionoptional Revision
merged_byoptional PrincipalId
merged_underoptional GrantId
review_refoptional stringThe forge's own reference of the change request, such as !42.
draftbooleanA draft is not merged and no merge is armed for it until it is marked ready.
review_requestedbooleanA review of the change request was requested.
depends_onoptional list of ChangeRequestIdThe change requests that must merge first; recorded and shown, a merge does not read them.
armedbooleanA merge is armed to happen when the checks of the head pass.
armed_byoptional PrincipalIdWho armed the merge, while it is armed.

Relations:

  • repository references Repository of scm.repository (one, by repository_id)
  • opener references Principal of principal (one, by opened_by)
  • approver references Principal of principal (one, by approved_by)
  • merger references Principal of principal (one, by merged_by)
  • armer references Principal of principal (one, by armed_by)
  • proposal references Proposal of workspace (one, by proposal_id)
  • task references Task of work (one, by task_id)
  • grant references Grant of authority (one, by merged_under)
  • reviews owns Review (many, by change_request_id)

Lifecycle of ChangeRequest

ClosedMergedOpenmergeclosereopenClosedMergedOpenmergeclosereopen
Ends in Merged.

Review​

One principal's review of one head of a change request.

Identified by review_id (ReviewId).

fieldtype
change_request_idChangeRequestId
reviewerPrincipalId
headRevision
verdictReviewVerdict
bodyContent
submitted_attimestamp

Relations:

  • reviewer_principal references Principal of principal (one, by reviewer)

Lifecycle: one state, Submitted; a recorded Review does not change.

Commands​

ApproveHead​

Approve a head on the strength of a review. Binds the change request's approval to the head an approving review of it was given for. The approval stays on that head; a later push leaves it behind.

Called by: Reviewer.

fieldtype
change_request_idChangeRequestId
review_idReviewId
headRevision
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
stale-head refusedhead != input.headStaleHead: The request names a head that is no longer the change request's head: someone pushed since. A check verdict, a review or a merge is about one head only.
no-such-review refusedno Review for review_idReviewNotFound: No review of this identity exists.
review-of-other-change-request refusedthe Review of review_id has change_request_id != input.change_request_idReviewNotApproving: The review is not an approval of this head of this change request.
review-of-other-head refusedthe Review of review_id has head != input.headReviewNotApproving: The review is not an approval of this head of this change request.
review-not-approving refusedthe Review of review_id has verdict != ApproveReviewNotApproving: The review is not an approval of this head of this change request.
approvedotherwiseupdates the ChangeRequest; emits HeadApproved

ArmMerge​

Arm a merge for when the checks pass. Arms the change request to be merged when the checks of its head pass: RecordChecks then answers merge-due and emits MergeDue. A draft is not armed.

Called by: Merger.

fieldtype
change_request_idChangeRequestId
armed_byPrincipalId
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
draft refuseddraft == trueChangeRequestIsDraft: The change request is a draft; it is neither merged nor armed for a merge until marked ready.
armedotherwiseupdates the ChangeRequest; emits MergeArmed

CloseChangeRequest​

Close a change request without merging.

Called by: Contributor, Merger.

fieldtype
change_request_idChangeRequestId
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
closedotherwisemoves the ChangeRequest Open → Closed; emits ChangeRequestClosed
wrong-state refusedthe ChangeRequest is in a state that does not allow itChangeRequestStateConflict: The change request is not in a state this command acts from.

DisarmMerge​

Disarm an armed merge.

Called by: Merger.

fieldtype
change_request_idChangeRequestId
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
disarmedotherwiseupdates the ChangeRequest; emits MergeDisarmed

MergeChangeRequest​

Merge a change request. Brings the head into the target reference. Refused unless the named head is still the head, the change request is not a draft, an approval was given for exactly that head, its checks passed, and the grant the merger acts under is active.

Called by: Merger.

fieldtype
change_request_idChangeRequestId
headRevision
merged_revisionRevision
merged_byPrincipalId
merged_underGrantId
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
stale-head refusedhead != input.headStaleHead: The request names a head that is no longer the change request's head: someone pushed since. A check verdict, a review or a merge is about one head only.
draft refuseddraft == trueChangeRequestIsDraft: The change request is a draft; it is neither merged nor armed for a merge until marked ready.
not-approved refusednot (defined(approved_head))NotApproved: No approval was given for any head of the change request.
approval-for-other-head refusedapproved_head != input.headApprovalForOtherHead: The approval was given for another head than the one to merge; a push after the approval needs a new approval.
checks-not-passed refusedchecks != PassedChecksNotPassed: The checks of the current head are pending, running or failed.
unknown-grant refusedno Grant for merged_underUnknownGrant: No authority grant of this identity exists.
grant-not-active refusedthe Grant of merged_under has state != ActiveGrantNotActive: The authority grant the merge names is revoked.
mergedotherwisemoves the ChangeRequest Open → Merged; emits ChangeRequestMerged

OpenChangeRequest​

Open a change request.

Called by: Contributor.

fieldtype
change_request_idChangeRequestId
repository_idRepositoryId
source_referenceReferenceName
target_referenceReferenceName
headRevision
titleContent
opened_byPrincipalId
proposal_idoptional ProposalId
task_idoptional TaskId
review_refoptional string
draftoptional boolean
depends_onoptional list of ChangeRequestId
attimestamp
outcomewhenresult
already-open refusedthe ChangeRequest exists alreadyChangeRequestExists: A change request of this identity exists.
unknown-repository refusedno Repository for repository_idUnknownRepository: No repository of this identity exists.
unknown-opener refusedno Principal for opened_byUnknownPrincipal: No principal of this identity is registered.
unknown-proposal refusedno Proposal for proposal_idUnknownProposal: No workspace proposal of this identity exists.
unknown-task refusedno Task for task_idUnknownTask: No task of this identity exists.
archived refusedthe Repository of repository_id has state == ArchivedRepositoryArchived: The repository is archived; it takes no new change request.
openedotherwisecreates a ChangeRequest in Open; emits ChangeRequestOpened

PushHead​

Push a new head to a change request.

Called by: Contributor.

fieldtype
change_request_idChangeRequestId
headRevision
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
pushedotherwiseupdates the ChangeRequest; emits HeadPushed

RecordChecks​

Record the checks verdict of a head.

Called by: Check reporter.

fieldtype
change_request_idChangeRequestId
headRevision
verdictChecksVerdict
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
stale-head refusedhead != input.headStaleHead: The request names a head that is no longer the change request's head: someone pushed since. A check verdict, a review or a merge is about one head only.
merge-duearmed == true and input.verdict == Passedupdates the ChangeRequest; emits ChecksRecorded, MergeDue
recordedotherwiseupdates the ChangeRequest; emits ChecksRecorded

ReopenChangeRequest​

Reopen a closed change request.

Called by: Contributor.

fieldtype
change_request_idChangeRequestId
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
reopenedotherwisemoves the ChangeRequest Closed → Open; emits ChangeRequestReopened
wrong-state refusedthe ChangeRequest is in a state that does not allow itChangeRequestStateConflict: The change request is not in a state this command acts from.

RequestReview​

Request a review of a change request.

Called by: Contributor.

fieldtype
change_request_idChangeRequestId
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
review-requestedotherwiseupdates the ChangeRequest; emits ReviewRequested

SetDraft​

Mark a change request as a draft or as ready.

Called by: Contributor.

fieldtype
change_request_idChangeRequestId
draftboolean
attimestamp
outcomewhenresult
no-such-change-request refusedno such ChangeRequestChangeRequestNotFound: No change request of this identity exists.
not-open refusedstate != OpenChangeRequestNotOpen: The change request is merged or closed.
draft-setotherwiseupdates the ChangeRequest; emits DraftSet

SubmitReview​

Submit a review of a head.

Called by: Reviewer.

fieldtype
review_idReviewId
change_request_idChangeRequestId
reviewerPrincipalId
headRevision
verdictReviewVerdict
bodyContent
attimestamp
outcomewhenresult
already-submitted refusedthe Review exists alreadyReviewExists: A review of this identity exists.
no-such-change-request refusedno ChangeRequest for change_request_idChangeRequestNotFound: No change request of this identity exists.
unknown-reviewer refusedno Principal for reviewerUnknownPrincipal: No principal of this identity is registered.
not-open refusedthe ChangeRequest of change_request_id has state != OpenChangeRequestNotOpen: The change request is merged or closed.
stale-head refusedthe ChangeRequest of change_request_id has head != input.headStaleHead: The request names a head that is no longer the change request's head: someone pushed since. A check verdict, a review or a merge is about one head only.
reviewedotherwisecreates a Review in Submitted; emits ReviewSubmitted

Events​

eventfieldsemitted by
ChangeRequestClosedchange_request_id ChangeRequestId, at timestampCloseChangeRequest
ChangeRequestMergedchange_request_id ChangeRequestId, repository_id RepositoryId, target_reference ReferenceName, head Revision, merged_revision Revision, merged_by PrincipalId, merged_under GrantId, at timestampMergeChangeRequest
ChangeRequestOpenedchange_request_id ChangeRequestId, repository_id RepositoryId, source_reference ReferenceName, target_reference ReferenceName, head Revision, opened_by PrincipalId, proposal_id optional ProposalId, task_id optional TaskId, at timestampOpenChangeRequest
ChangeRequestReopenedchange_request_id ChangeRequestId, at timestampReopenChangeRequest
ChecksRecordedchange_request_id ChangeRequestId, head Revision, verdict ChecksVerdict, at timestampRecordChecks
DraftSetchange_request_id ChangeRequestId, draft boolean, at timestampSetDraft
HeadApprovedchange_request_id ChangeRequestId, review_id ReviewId, head Revision, approved_by PrincipalId, at timestampApproveHead
HeadPushedchange_request_id ChangeRequestId, from Revision, to Revision, at timestampPushHead
MergeArmedchange_request_id ChangeRequestId, armed_by PrincipalId, at timestampArmMerge
MergeDisarmedchange_request_id ChangeRequestId, at timestampDisarmMerge
MergeDue
The checks of an armed change request's head passed; the armed merge may now be made.
change_request_id ChangeRequestId, head Revision, armed_by optional PrincipalId, at timestampRecordChecks
ReviewRequestedchange_request_id ChangeRequestId, at timestampRequestReview
ReviewSubmittedreview_id ReviewId, change_request_id ChangeRequestId, reviewer PrincipalId, head Revision, verdict ReviewVerdict, at timestampSubmitReview

Views​

viewrowsfields
ChangeRequests
Change requests
each ChangeRequestchange_request_id ChangeRequestId, repository_id RepositoryId, source_reference ReferenceName, target_reference ReferenceName, head Revision, title Content, opened_by PrincipalId, opened_at timestamp, checks ChecksVerdict, approved_head optional Revision, approved_by optional PrincipalId, proposal_id optional ProposalId, task_id optional TaskId, merged_revision optional Revision, merged_by optional PrincipalId, merged_under optional GrantId, review_ref optional string, draft boolean, review_requested boolean, depends_on optional list of ChangeRequestId, armed boolean, armed_by optional PrincipalId, state State
Reviews
Reviews
each Reviewreview_id ReviewId, change_request_id ChangeRequestId, reviewer PrincipalId, head Revision, verdict ReviewVerdict, body Content, submitted_at timestamp, state State

Types​

typeisvalues or fields
ChangeRequestIdan identifier or valueuuid
ChecksVerdict
The combined verdict of the checks a merge requires, for the current head. Pending while no pipeline has started, Running while one runs and has not completed; a push makes it Pending again. A merge needs Passed.
one ofPending, Running, Passed, Failed
ReviewIdan identifier or valueuuid
ReviewVerdict
Approve binds an approval to the reviewed head; RequestChanges and Comment are recorded and approve nothing.
one ofApprove, RequestChanges, Comment

KPIs​

4 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
merge_without_head_approval
Change requests merged at a head no approval was given for.
How: ChangeRequestMerged events whose head is not the head of a HeadApproved event of the same change request after its last HeadPushed. Must be 0.
countlowergateplanned
source: design
merge_without_green_checks
Change requests merged while the checks of their head had not passed.
How: ChangeRequestMerged events whose head has no ChecksRecorded with verdict Passed for that head after the last HeadPushed. Must be 0.
countlowergateplanned
source: design

Quality​

KPIunitbettergatestatus
change_request_cycle_seconds
Seconds from a change request being opened to it being merged.
How: Median of ChangeRequestMerged time minus ChangeRequestOpened time over merged change requests; closed ones are counted apart.
secondslower–planned
source: design
approval_invalidated_share
Share of approvals left behind by a later push to the change request.
How: HeadApproved events followed by a HeadPushed of the same change request before it merged, divided by all HeadApproved events. Each one costs a second review.
sharelower–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.change:

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.