From b00cf73d77d341fd8942faf59dacb8edf598328e Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 00:57:04 +0100 Subject: [PATCH] BM3 (sdk): an install is a StepAsk of the kind install, dispatched by RunAsk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit node-build-node accepts install as a StepAsk holding an install job (the InstallAsk's fields and the module's fingerprint) under the version its archive is published with; install is its own queue on that seat alone and its holder pulls it. RunAsk dispatches the kind to the module's install body, which publishes the archive :node-modules to the artifact store, and the install's end names the reference it answered. Builds: design 47 H2 §800; H-A-367 (4), H-A-379, H-A-399 (1) (2), H-A-403 --- .../go/seats/nodebuildgo/contract.go | 14 ++++-- .../go/seats/nodebuildimage/contract.go | 14 ++++-- .../go/seats/nodebuildnode/contract.go | 16 ++++--- .../go/seats/nodebuildnode/contract_test.go | 2 +- .../parts/build-step.json | 17 +++++-- .../node-build-node/fixtures/states.json | 20 ++++++-- .../seats/node-build-node/seat.json | 2 +- .../seats/nodebuildgo/parts/build-step.d.ts | 12 +++-- .../nodebuildimage/parts/build-step.d.ts | 12 +++-- .../ts/seats/nodebuildnode/index.d.ts | 2 +- .../seats/nodebuildnode/parts/build-step.d.ts | 12 +++-- modules/mesh-delivery-sdk/buildstep/ask.go | 40 ++++++++++++---- .../mesh-delivery-sdk/buildstep/ask_test.go | 47 +++++++++++++++++-- .../buildstep/pipelinestep.go | 45 +++++++++++++++--- modules/mesh-delivery-sdk/steprun/askrun.go | 7 ++- .../mesh-delivery-sdk/steprun/askrun_test.go | 25 +++++++++- modules/mesh-delivery-sdk/steprun/pull.go | 16 ++++--- .../mesh-delivery-sdk/steprun/pull_test.go | 9 ++++ modules/mesh-delivery-sdk/steprun/steprun.go | 31 +++++++++++- 19 files changed, 274 insertions(+), 69 deletions(-) diff --git a/modules/mesh-delivery-contracts/go/seats/nodebuildgo/contract.go b/modules/mesh-delivery-contracts/go/seats/nodebuildgo/contract.go index e801f0222..5971c434d 100644 --- a/modules/mesh-delivery-contracts/go/seats/nodebuildgo/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/nodebuildgo/contract.go @@ -23,7 +23,7 @@ const FormBuildStep = 2 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1 build-step:2" - generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckRunAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=9a8c9c8918b1 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613" + generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckRunAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613" ) const ( @@ -561,12 +561,14 @@ type FetchRefusal struct { Reason string `json:"reason"` } -// InstallAsk is an ask of the kind install (design 47 H2 §800, H-A-367 (4)): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, kept as an archive in the holder's outputs under the lock's digest. +// InstallAsk is the job of an ask of the kind install (design 47 H2 §800, H-A-367 (4), H-A-403): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, and published to the artifact store (the seat oci-artifact-registry) as the module's archive :node-modules under the ask's version, which the builder's reservation covers. type InstallAsk struct { // who asked it Asker string `json:"asker"` // the commit the lock is read at Commit string `json:"commit"` + // the module's build-input fingerprint at the commit + Fingerprint string `json:"fingerprint"` // the ask's id ID string `json:"id"` // the package lock's text at the commit @@ -800,7 +802,9 @@ type StepAsk struct { Check *StepAskCheck `json:"check,omitempty"` Compose *StepAskCompose `json:"compose,omitempty"` ID string `json:"id"` - // build, check, compose or step + // the install job of the accepted kind install of node-build-node alone (design 47 H2 §800, H-A-403): the module's npm tree its lock names, published as the module's archive :node-modules under the ask's version + Install *InstallAsk `json:"install,omitempty"` + // build, check, compose, step or install Kind string `json:"kind"` // go, typescript or image Language string `json:"language"` @@ -819,7 +823,7 @@ type StepAsk struct { // StepEnded is an ask's end, said by the build seat's holder on the node that ran it, whatever its asker (design 47 G section 602): a pipeline step's end names the pipeline, the commit and the fingerprint it was asked at, which the runner takes only from that holder's account (ADR 0666 sections 7, 21); the end of any other ask names its asker, the ask, the node, the outcome and when, and neither commit nor fingerprint (design 47 G section 548). type StepEnded struct { - // for an install, the name of the archive object in the holder's outputs that holds the installed tree (design 47 H2 §800) + // for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) Archive string `json:"archive,omitempty"` Artifact string `json:"artifact,omitempty"` // the ask's id, by which a reader takes only its own asks @@ -927,7 +931,7 @@ type StepResult struct { // StepRun is one pipeline step of one artifact at one commit (ADR 0666 sections 7, 8, 17): the step a build seat runs in its sandbox from the change's own heads, the names the lint step needs and the kept results it may skip. type StepRun struct { - // the install archive object the Go build module unpacks into the workspace before the step (design 47 H2 §800) + // the reference of the install archive in the artifact store, which the Go build module fetches and unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2)) Archive string `json:"archive,omitempty"` // the artifact reference, : Artifact string `json:"artifact"` diff --git a/modules/mesh-delivery-contracts/go/seats/nodebuildimage/contract.go b/modules/mesh-delivery-contracts/go/seats/nodebuildimage/contract.go index c4672c283..49b054789 100644 --- a/modules/mesh-delivery-contracts/go/seats/nodebuildimage/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/nodebuildimage/contract.go @@ -23,7 +23,7 @@ const FormBuildStep = 2 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1 build-step:2" - generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=9a8c9c8918b1 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613" + generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613" ) const ( @@ -559,12 +559,14 @@ type FetchRefusal struct { Reason string `json:"reason"` } -// InstallAsk is an ask of the kind install (design 47 H2 §800, H-A-367 (4)): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, kept as an archive in the holder's outputs under the lock's digest. +// InstallAsk is the job of an ask of the kind install (design 47 H2 §800, H-A-367 (4), H-A-403): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, and published to the artifact store (the seat oci-artifact-registry) as the module's archive :node-modules under the ask's version, which the builder's reservation covers. type InstallAsk struct { // who asked it Asker string `json:"asker"` // the commit the lock is read at Commit string `json:"commit"` + // the module's build-input fingerprint at the commit + Fingerprint string `json:"fingerprint"` // the ask's id ID string `json:"id"` // the package lock's text at the commit @@ -798,7 +800,9 @@ type StepAsk struct { Check *StepAskCheck `json:"check,omitempty"` Compose *StepAskCompose `json:"compose,omitempty"` ID string `json:"id"` - // build, check, compose or step + // the install job of the accepted kind install of node-build-node alone (design 47 H2 §800, H-A-403): the module's npm tree its lock names, published as the module's archive :node-modules under the ask's version + Install *InstallAsk `json:"install,omitempty"` + // build, check, compose, step or install Kind string `json:"kind"` // go, typescript or image Language string `json:"language"` @@ -817,7 +821,7 @@ type StepAsk struct { // StepEnded is an ask's end, said by the build seat's holder on the node that ran it, whatever its asker (design 47 G section 602): a pipeline step's end names the pipeline, the commit and the fingerprint it was asked at, which the runner takes only from that holder's account (ADR 0666 sections 7, 21); the end of any other ask names its asker, the ask, the node, the outcome and when, and neither commit nor fingerprint (design 47 G section 548). type StepEnded struct { - // for an install, the name of the archive object in the holder's outputs that holds the installed tree (design 47 H2 §800) + // for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) Archive string `json:"archive,omitempty"` Artifact string `json:"artifact,omitempty"` // the ask's id, by which a reader takes only its own asks @@ -925,7 +929,7 @@ type StepResult struct { // StepRun is one pipeline step of one artifact at one commit (ADR 0666 sections 7, 8, 17): the step a build seat runs in its sandbox from the change's own heads, the names the lint step needs and the kept results it may skip. type StepRun struct { - // the install archive object the Go build module unpacks into the workspace before the step (design 47 H2 §800) + // the reference of the install archive in the artifact store, which the Go build module fetches and unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2)) Archive string `json:"archive,omitempty"` // the artifact reference, : Artifact string `json:"artifact"` diff --git a/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract.go b/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract.go index 3a7717686..1855efe53 100644 --- a/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract.go @@ -23,7 +23,7 @@ const FormBuildStep = 2 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1 build-step:2" - generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAccept=6c42a0d3fe6d InstallAsk=7a855a79d290 KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=9a8c9c8918b1 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613" + generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAccept=ef89c6962ae4 InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613" ) const ( @@ -563,12 +563,14 @@ type FetchRefusal struct { Reason string `json:"reason"` } -// InstallAsk is an ask of the kind install (design 47 H2 §800, H-A-367 (4)): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, kept as an archive in the holder's outputs under the lock's digest. +// InstallAsk is the job of an ask of the kind install (design 47 H2 §800, H-A-367 (4), H-A-403): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, and published to the artifact store (the seat oci-artifact-registry) as the module's archive :node-modules under the ask's version, which the builder's reservation covers. type InstallAsk struct { // who asked it Asker string `json:"asker"` // the commit the lock is read at Commit string `json:"commit"` + // the module's build-input fingerprint at the commit + Fingerprint string `json:"fingerprint"` // the ask's id ID string `json:"id"` // the package lock's text at the commit @@ -802,7 +804,9 @@ type StepAsk struct { Check *StepAskCheck `json:"check,omitempty"` Compose *StepAskCompose `json:"compose,omitempty"` ID string `json:"id"` - // build, check, compose or step + // the install job of the accepted kind install of node-build-node alone (design 47 H2 §800, H-A-403): the module's npm tree its lock names, published as the module's archive :node-modules under the ask's version + Install *InstallAsk `json:"install,omitempty"` + // build, check, compose, step or install Kind string `json:"kind"` // go, typescript or image Language string `json:"language"` @@ -821,7 +825,7 @@ type StepAsk struct { // StepEnded is an ask's end, said by the build seat's holder on the node that ran it, whatever its asker (design 47 G section 602): a pipeline step's end names the pipeline, the commit and the fingerprint it was asked at, which the runner takes only from that holder's account (ADR 0666 sections 7, 21); the end of any other ask names its asker, the ask, the node, the outcome and when, and neither commit nor fingerprint (design 47 G section 548). type StepEnded struct { - // for an install, the name of the archive object in the holder's outputs that holds the installed tree (design 47 H2 §800) + // for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) Archive string `json:"archive,omitempty"` Artifact string `json:"artifact,omitempty"` // the ask's id, by which a reader takes only its own asks @@ -929,7 +933,7 @@ type StepResult struct { // StepRun is one pipeline step of one artifact at one commit (ADR 0666 sections 7, 8, 17): the step a build seat runs in its sandbox from the change's own heads, the names the lint step needs and the kept results it may skip. type StepRun struct { - // the install archive object the Go build module unpacks into the workspace before the step (design 47 H2 §800) + // the reference of the install archive in the artifact store, which the Go build module fetches and unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2)) Archive string `json:"archive,omitempty"` // the artifact reference, : Artifact string `json:"artifact"` @@ -1185,7 +1189,7 @@ type DeliveryStepAccept = StepAsk type RecheckAccept = StepAsk // InstallAccept is the body of install. -type InstallAccept = InstallAsk +type InstallAccept = StepAsk // StepEndedEvent is the body of the event step-ended. type StepEndedEvent = StepEnded diff --git a/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract_test.go b/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract_test.go index 3ce1d185d..8246b5c7e 100644 --- a/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract_test.go +++ b/modules/mesh-delivery-contracts/go/seats/nodebuildnode/contract_test.go @@ -89,7 +89,7 @@ func TestFixtures(t *testing.T) { }, subjectIs: nil}, {name: "a check's step whose answer is kept as an object (G A-290)", subject: "", given: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, - {name: "an install ask names the module's package lock at the commit", subject: "mesh.seat.node-build-node.accept.install", given: "{\"asker\":\"mesh-delivery-pipeline\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"id\":\"m2kx9a1b3c4d61\",\"lock\":\"{\\\"name\\\":\\\"mesh-forge\\\",\\\"lockfileVersion\\\":3,\\\"packages\\\":{}}\",\"module\":\"mesh-forge\",\"pipeline\":\"main.12.mesh-forge\"}", wire: "{\"asker\":\"mesh-delivery-pipeline\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"id\":\"m2kx9a1b3c4d61\",\"lock\":\"{\\\"name\\\":\\\"mesh-forge\\\",\\\"lockfileVersion\\\":3,\\\"packages\\\":{}}\",\"module\":\"mesh-forge\",\"pipeline\":\"main.12.mesh-forge\"}", + {name: "an install ask is a StepAsk of the kind install naming the module's package lock at the commit (H-A-403)", subject: "mesh.seat.node-build-node.accept.install", given: "{\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-22T00:56:00Z\",\"id\":\"m2kx9a1b3c4d61\",\"install\":{\"asker\":\"mesh-delivery-pipeline\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d61\",\"lock\":\"{\\\"name\\\":\\\"mesh-forge\\\",\\\"lockfileVersion\\\":3,\\\"packages\\\":{}}\",\"module\":\"mesh-forge\",\"pipeline\":\"main.12.mesh-forge\"},\"kind\":\"install\",\"language\":\"node\",\"v\":1,\"version\":\"0.1.4\"}", wire: "{\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-22T00:56:00Z\",\"id\":\"m2kx9a1b3c4d61\",\"install\":{\"asker\":\"mesh-delivery-pipeline\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d61\",\"lock\":\"{\\\"name\\\":\\\"mesh-forge\\\",\\\"lockfileVersion\\\":3,\\\"packages\\\":{}}\",\"module\":\"mesh-forge\",\"pipeline\":\"main.12.mesh-forge\"},\"kind\":\"install\",\"language\":\"node\",\"v\":1,\"version\":\"0.1.4\"}", decode: func(b []byte) (any, error) { var v InstallAccept; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-node\\.accept\\.install$")}, {name: "drop names the ask and why", subject: "", given: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}", decode: func(b []byte) (any, error) { var v DropInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, diff --git a/modules/mesh-delivery-contracts/parts/build-step.json b/modules/mesh-delivery-contracts/parts/build-step.json index 15d99a353..f17095edb 100644 --- a/modules/mesh-delivery-contracts/parts/build-step.json +++ b/modules/mesh-delivery-contracts/parts/build-step.json @@ -326,7 +326,7 @@ }, "kind": { "type": "string", - "description": "build, check, compose or step" + "description": "build, check, compose, step or install" }, "language": { "type": "string", @@ -471,6 +471,10 @@ "step": { "$ref": "#/defs/StepRun", "description": "a pipeline step: lint, unit tests or integration tests of one artifact at one commit, sent by the runner as the accepted kind step (design 47 *The steps and who serves them*)" + }, + "install": { + "$ref": "#/defs/InstallAsk", + "description": "the install job of the accepted kind install of node-build-node alone (design 47 H2 §800, H-A-403): the module's npm tree its lock names, published as the module's archive :node-modules under the ask's version" } }, "required": [ @@ -1604,7 +1608,7 @@ }, "archive": { "type": "string", - "description": "the install archive object the Go build module unpacks into the workspace before the step (design 47 H2 §800)" + "description": "the reference of the install archive in the artifact store, which the Go build module fetches and unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2))" } }, "required": [ @@ -1733,7 +1737,7 @@ }, "archive": { "type": "string", - "description": "for an install, the name of the archive object in the holder's outputs that holds the installed tree (design 47 H2 §800)" + "description": "for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2))" } }, "required": [ @@ -1950,7 +1954,7 @@ }, "InstallAsk": { "type": "object", - "description": "an ask of the kind install (design 47 H2 §800, H-A-367 (4)): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, kept as an archive in the holder's outputs under the lock's digest", + "description": "the job of an ask of the kind install (design 47 H2 §800, H-A-367 (4), H-A-403): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, and published to the artifact store (the seat oci-artifact-registry) as the module's archive :node-modules under the ask's version, which the builder's reservation covers", "properties": { "id": { "type": "string", @@ -1971,6 +1975,10 @@ "type": "string", "description": "the commit the lock is read at" }, + "fingerprint": { + "type": "string", + "description": "the module's build-input fingerprint at the commit" + }, "lock": { "type": "string", "description": "the package lock's text at the commit" @@ -1982,6 +1990,7 @@ "pipeline", "module", "commit", + "fingerprint", "lock" ] } diff --git a/modules/mesh-delivery-contracts/seats/node-build-node/fixtures/states.json b/modules/mesh-delivery-contracts/seats/node-build-node/fixtures/states.json index 9e6a0e660..79f4458c3 100644 --- a/modules/mesh-delivery-contracts/seats/node-build-node/fixtures/states.json +++ b/modules/mesh-delivery-contracts/seats/node-build-node/fixtures/states.json @@ -316,16 +316,26 @@ } }, { - "name": "an install ask names the module's package lock at the commit", + "name": "an install ask is a StepAsk of the kind install naming the module's package lock at the commit (H-A-403)", "of": "accept:install", "subject": "mesh.seat.node-build-node.accept.install", "given": { + "v": 1, "id": "m2kx9a1b3c4d61", + "kind": "install", + "language": "node", "asker": "mesh-delivery-pipeline", - "pipeline": "main.12.mesh-forge", - "module": "mesh-forge", - "commit": "0123456789abcdef0123456789abcdef01234567", - "lock": "{\"name\":\"mesh-forge\",\"lockfileVersion\":3,\"packages\":{}}" + "at": "2026-11-22T00:56:00Z", + "version": "0.1.4", + "install": { + "id": "m2kx9a1b3c4d61", + "asker": "mesh-delivery-pipeline", + "pipeline": "main.12.mesh-forge", + "module": "mesh-forge", + "commit": "0123456789abcdef0123456789abcdef01234567", + "fingerprint": "fp-0123", + "lock": "{\"name\":\"mesh-forge\",\"lockfileVersion\":3,\"packages\":{}}" + } } } ] diff --git a/modules/mesh-delivery-contracts/seats/node-build-node/seat.json b/modules/mesh-delivery-contracts/seats/node-build-node/seat.json index 3b62223b0..b49cbaa98 100644 --- a/modules/mesh-delivery-contracts/seats/node-build-node/seat.json +++ b/modules/mesh-delivery-contracts/seats/node-build-node/seat.json @@ -49,7 +49,7 @@ { "name": "install", "body": { - "$ref": "#/defs/InstallAsk" + "$ref": "#/defs/StepAsk" } } ], diff --git a/modules/mesh-delivery-contracts/ts/seats/nodebuildgo/parts/build-step.d.ts b/modules/mesh-delivery-contracts/ts/seats/nodebuildgo/parts/build-step.d.ts index 54c748d85..db352cb29 100644 --- a/modules/mesh-delivery-contracts/ts/seats/nodebuildgo/parts/build-step.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/nodebuildgo/parts/build-step.d.ts @@ -214,12 +214,14 @@ export interface FetchRefusal { "reason": string; } -/** an ask of the kind install (design 47 H2 §800, H-A-367 (4)): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, kept as an archive in the holder's outputs under the lock's digest */ +/** the job of an ask of the kind install (design 47 H2 §800, H-A-367 (4), H-A-403): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, and published to the artifact store (the seat oci-artifact-registry) as the module's archive :node-modules under the ask's version, which the builder's reservation covers */ export interface InstallAsk { /** who asked it */ "asker": string; /** the commit the lock is read at */ "commit": string; + /** the module's build-input fingerprint at the commit */ + "fingerprint": string; /** the ask's id */ "id": string; /** the package lock's text at the commit */ @@ -441,7 +443,9 @@ export interface StepAsk { "check"?: StepAskCheck; "compose"?: StepAskCompose; "id": string; - /** build, check, compose or step */ + /** the install job of the accepted kind install of node-build-node alone (design 47 H2 §800, H-A-403): the module's npm tree its lock names, published as the module's archive :node-modules under the ask's version */ + "install"?: InstallAsk; + /** build, check, compose, step or install */ "kind": string; /** go, typescript or image */ "language": string; @@ -460,7 +464,7 @@ export interface StepAsk { /** an ask's end, said by the build seat's holder on the node that ran it, whatever its asker (design 47 G section 602): a pipeline step's end names the pipeline, the commit and the fingerprint it was asked at, which the runner takes only from that holder's account (ADR 0666 sections 7, 21); the end of any other ask names its asker, the ask, the node, the outcome and when, and neither commit nor fingerprint (design 47 G section 548) */ export interface StepEnded { - /** for an install, the name of the archive object in the holder's outputs that holds the installed tree (design 47 H2 §800) */ + /** for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) */ "archive"?: string; "artifact"?: string; /** the ask's id, by which a reader takes only its own asks */ @@ -544,7 +548,7 @@ export interface StepResult { /** one pipeline step of one artifact at one commit (ADR 0666 sections 7, 8, 17): the step a build seat runs in its sandbox from the change's own heads, the names the lint step needs and the kept results it may skip */ export interface StepRun { - /** the install archive object the Go build module unpacks into the workspace before the step (design 47 H2 §800) */ + /** the reference of the install archive in the artifact store, which the Go build module fetches and unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2)) */ "archive"?: string; /** the artifact reference, : */ "artifact": string; diff --git a/modules/mesh-delivery-contracts/ts/seats/nodebuildimage/parts/build-step.d.ts b/modules/mesh-delivery-contracts/ts/seats/nodebuildimage/parts/build-step.d.ts index 54c748d85..db352cb29 100644 --- a/modules/mesh-delivery-contracts/ts/seats/nodebuildimage/parts/build-step.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/nodebuildimage/parts/build-step.d.ts @@ -214,12 +214,14 @@ export interface FetchRefusal { "reason": string; } -/** an ask of the kind install (design 47 H2 §800, H-A-367 (4)): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, kept as an archive in the holder's outputs under the lock's digest */ +/** the job of an ask of the kind install (design 47 H2 §800, H-A-367 (4), H-A-403): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, and published to the artifact store (the seat oci-artifact-registry) as the module's archive :node-modules under the ask's version, which the builder's reservation covers */ export interface InstallAsk { /** who asked it */ "asker": string; /** the commit the lock is read at */ "commit": string; + /** the module's build-input fingerprint at the commit */ + "fingerprint": string; /** the ask's id */ "id": string; /** the package lock's text at the commit */ @@ -441,7 +443,9 @@ export interface StepAsk { "check"?: StepAskCheck; "compose"?: StepAskCompose; "id": string; - /** build, check, compose or step */ + /** the install job of the accepted kind install of node-build-node alone (design 47 H2 §800, H-A-403): the module's npm tree its lock names, published as the module's archive :node-modules under the ask's version */ + "install"?: InstallAsk; + /** build, check, compose, step or install */ "kind": string; /** go, typescript or image */ "language": string; @@ -460,7 +464,7 @@ export interface StepAsk { /** an ask's end, said by the build seat's holder on the node that ran it, whatever its asker (design 47 G section 602): a pipeline step's end names the pipeline, the commit and the fingerprint it was asked at, which the runner takes only from that holder's account (ADR 0666 sections 7, 21); the end of any other ask names its asker, the ask, the node, the outcome and when, and neither commit nor fingerprint (design 47 G section 548) */ export interface StepEnded { - /** for an install, the name of the archive object in the holder's outputs that holds the installed tree (design 47 H2 §800) */ + /** for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) */ "archive"?: string; "artifact"?: string; /** the ask's id, by which a reader takes only its own asks */ @@ -544,7 +548,7 @@ export interface StepResult { /** one pipeline step of one artifact at one commit (ADR 0666 sections 7, 8, 17): the step a build seat runs in its sandbox from the change's own heads, the names the lint step needs and the kept results it may skip */ export interface StepRun { - /** the install archive object the Go build module unpacks into the workspace before the step (design 47 H2 §800) */ + /** the reference of the install archive in the artifact store, which the Go build module fetches and unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2)) */ "archive"?: string; /** the artifact reference, : */ "artifact": string; diff --git a/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/index.d.ts b/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/index.d.ts index e66be3015..2e7dd3ec7 100644 --- a/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/index.d.ts @@ -201,7 +201,7 @@ export type DeliveryStepAccept = StepAsk; export type RecheckAccept = StepAsk; /** is the body of install. */ -export type InstallAccept = InstallAsk; +export type InstallAccept = StepAsk; /** is one value of the state steps under the key ... */ export type StepsByAskerNodeIDValue = Step; diff --git a/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/parts/build-step.d.ts b/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/parts/build-step.d.ts index 54c748d85..db352cb29 100644 --- a/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/parts/build-step.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/nodebuildnode/parts/build-step.d.ts @@ -214,12 +214,14 @@ export interface FetchRefusal { "reason": string; } -/** an ask of the kind install (design 47 H2 §800, H-A-367 (4)): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, kept as an archive in the holder's outputs under the lock's digest */ +/** the job of an ask of the kind install (design 47 H2 §800, H-A-367 (4), H-A-403): the npm tree a module's package lock names, installed with an integrity-checked install and no install scripts, and published to the artifact store (the seat oci-artifact-registry) as the module's archive :node-modules under the ask's version, which the builder's reservation covers */ export interface InstallAsk { /** who asked it */ "asker": string; /** the commit the lock is read at */ "commit": string; + /** the module's build-input fingerprint at the commit */ + "fingerprint": string; /** the ask's id */ "id": string; /** the package lock's text at the commit */ @@ -441,7 +443,9 @@ export interface StepAsk { "check"?: StepAskCheck; "compose"?: StepAskCompose; "id": string; - /** build, check, compose or step */ + /** the install job of the accepted kind install of node-build-node alone (design 47 H2 §800, H-A-403): the module's npm tree its lock names, published as the module's archive :node-modules under the ask's version */ + "install"?: InstallAsk; + /** build, check, compose, step or install */ "kind": string; /** go, typescript or image */ "language": string; @@ -460,7 +464,7 @@ export interface StepAsk { /** an ask's end, said by the build seat's holder on the node that ran it, whatever its asker (design 47 G section 602): a pipeline step's end names the pipeline, the commit and the fingerprint it was asked at, which the runner takes only from that holder's account (ADR 0666 sections 7, 21); the end of any other ask names its asker, the ask, the node, the outcome and when, and neither commit nor fingerprint (design 47 G section 548) */ export interface StepEnded { - /** for an install, the name of the archive object in the holder's outputs that holds the installed tree (design 47 H2 §800) */ + /** for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) */ "archive"?: string; "artifact"?: string; /** the ask's id, by which a reader takes only its own asks */ @@ -544,7 +548,7 @@ export interface StepResult { /** one pipeline step of one artifact at one commit (ADR 0666 sections 7, 8, 17): the step a build seat runs in its sandbox from the change's own heads, the names the lint step needs and the kept results it may skip */ export interface StepRun { - /** the install archive object the Go build module unpacks into the workspace before the step (design 47 H2 §800) */ + /** the reference of the install archive in the artifact store, which the Go build module fetches and unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2)) */ "archive"?: string; /** the artifact reference, : */ "artifact": string; diff --git a/modules/mesh-delivery-sdk/buildstep/ask.go b/modules/mesh-delivery-sdk/buildstep/ask.go index 63029a780..23ca15d49 100644 --- a/modules/mesh-delivery-sdk/buildstep/ask.go +++ b/modules/mesh-delivery-sdk/buildstep/ask.go @@ -31,6 +31,9 @@ const ( // AskStep is a pipeline step the runner sends (novox/hq design 47 *The steps and who serves them*: the accepted kind // step on the stream check, after delivery and before recheck). AskStep = "step" + // AskInstall is the Node build seat's install of a module's npm tree (design 47 H2 §800, H-A-403): its own queue on + // node-build-node alone, the Go and image build seats never install. + AskInstall = "install" ) // AskKinds are the queues of a build seat, in the order a holder pulls them (ADR 0536 §4): delivery, check and recheck, @@ -39,7 +42,16 @@ const ( var AskKinds = []string{AskDelivery, AskCheck, AskRecheck} // askBodyKinds are the kinds an ask's body names: a queue's, or step. -var askBodyKinds = []string{AskDelivery, AskCheck, AskStep, AskRecheck} +var askBodyKinds = []string{AskDelivery, AskCheck, AskStep, AskRecheck, AskInstall} + +// AskQueues are the queues a language's build seat pulls, in the order its holder pulls them: AskKinds, and install on +// node-build-node alone (H-A-403). +func AskQueues(language string) []string { + if language == AskNode { + return append(slices.Clone(AskKinds), AskInstall) + } + return AskKinds +} // The languages of the build seats: each is one build module's (mesh-build-) and one seat's // (node-build-). @@ -105,14 +117,14 @@ const ( func checkAskKind(kind string) error { if !slices.Contains(askBodyKinds, kind) { - return fmt.Errorf("buildstep: the ask kind %q is not delivery, check, step or recheck", kind) + return fmt.Errorf("buildstep: the ask kind %q is not delivery, check, step, recheck or install", kind) } return nil } -func checkAskQueue(queue string) error { - if !slices.Contains(AskKinds, queue) { - return fmt.Errorf("buildstep: the queue %q is not delivery, check or recheck", queue) +func checkAskQueue(language, queue string) error { + if !slices.Contains(AskQueues(language), queue) { + return fmt.Errorf("buildstep: the queue %q is not one of %s's (%s)", queue, language, strings.Join(AskQueues(language), ", ")) } return nil } @@ -152,7 +164,7 @@ func AskSubject(language, queue string) (string, error) { if err != nil { return "", err } - if err := checkAskQueue(queue); err != nil { + if err := checkAskQueue(language, queue); err != nil { return "", err } return "mesh.seat." + seat + ".accept." + queue, nil @@ -209,7 +221,7 @@ func AskWorker(language, kind string) (string, error) { if err != nil { return "", err } - if err := checkAskQueue(kind); err != nil { + if err := checkAskQueue(language, kind); err != nil { return "", err } return stream + "_" + strings.ToUpper(kind) + "_worker", nil @@ -280,6 +292,10 @@ type StepAsk struct { // Step is a pipeline step the runner sends as the accepted kind step (novox/hq ADR 0666 §7): lint or tests of one // artifact. Step *StepRun `json:"step,omitempty"` + // Install is the install job the runner sends as the accepted kind install of node-build-node (design 47 H2 §800, + // H-A-403): the module's npm tree its package lock names, published as the module's archive :node-modules + // under the ask's Version. + Install *InstallAsk `json:"install,omitempty"` // Needs are what a check's tests need of the holder's node (CheckNeed); a holder lacking one declines the ask. Needs []string `json:"needs,omitempty"` // Packages pin the mesh packages a build or a check builds against. @@ -468,14 +484,18 @@ func (a StepAsk) check() error { return fmt.Errorf("buildstep: the ask %s names no time", a.ID) } jobs := 0 - for _, set := range []bool{a.Build != nil, a.Check != nil, a.Compose != nil, a.Run != nil, a.Step != nil} { + for _, set := range []bool{a.Build != nil, a.Check != nil, a.Compose != nil, a.Run != nil, a.Step != nil, a.Install != nil} { if set { jobs++ } } switch { case jobs != 1: - return fmt.Errorf("buildstep: the ask %s holds a build, a check, a compose, a run or a step, exactly one", a.ID) + return fmt.Errorf("buildstep: the ask %s holds a build, a check, a compose, a run, a step or an install, exactly one", a.ID) + case (a.Install != nil) != (a.Kind == AskInstall): + return fmt.Errorf("buildstep: the ask %s is sent as %s and holds an install, or not: the accepted kind install carries an install alone", a.ID, a.Kind) + case a.Install != nil && a.Language != AskNode: + return fmt.Errorf("buildstep: the ask %s is an install of the %s seat: node-build-node alone installs (H-A-403)", a.ID, a.Language) case a.Compose != nil && (a.Kind != AskCheck || a.Language != AskGo): return fmt.Errorf("buildstep: the ask %s is a compose, which the Go seat's check stream alone carries", a.ID) case a.Run != nil && (a.Kind != AskCheck || a.Language != AskGo): @@ -512,6 +532,8 @@ func (a StepAsk) check() error { return a.Run.check(a.ID) case a.Step != nil: return a.Step.check(a.ID) + case a.Install != nil: + return a.Install.check(a) } return a.Check.check(a.ID) } diff --git a/modules/mesh-delivery-sdk/buildstep/ask_test.go b/modules/mesh-delivery-sdk/buildstep/ask_test.go index 7220baca4..f65616775 100644 --- a/modules/mesh-delivery-sdk/buildstep/ask_test.go +++ b/modules/mesh-delivery-sdk/buildstep/ask_test.go @@ -55,12 +55,20 @@ func stepAsk() StepAsk { Kept: []KeptResult{{Package: "./modules/nats/a", Digest: "sha256:bbbb", Level: StepUnit}}}} } +// installAsk is an install of the Node build seat (design 47 H2 §800, H-A-403). +func installAsk() StepAsk { + return StepAsk{ID: testAskID, Kind: AskInstall, Language: AskNode, Asker: "mesh-delivery-pipeline", Version: "0.1.4", + At: time.Date(2026, 11, 10, 10, 0, 0, 0, time.UTC), + Install: &InstallAsk{ID: testAskID, Asker: "mesh-delivery-pipeline", Pipeline: "main.12.gitea", Module: "gitea", Commit: testCommit, + Fingerprint: "fp-0123", Lock: `{"lockfileVersion":3}`}} +} + // The ask the three build seats share is one neutral form: it round-trips, and every ill-formed ask is refused, // naming what is wrong (the rules of the old delivery.StepAsk, now the shared runner's). func TestAskCheckAndRoundTrip(t *testing.T) { headless := runAsk() // a run whose program reads only its input names no head (design 47 G §712, A-238) headless.Run.Heads = nil - for _, a := range []StepAsk{goodBuild(), goodCheck(), runAsk(), headless, stepAsk()} { + for _, a := range []StepAsk{goodBuild(), goodCheck(), runAsk(), headless, stepAsk(), installAsk()} { raw, err := EncodeStepAsk(a) if err != nil { t.Fatal(err) @@ -123,7 +131,7 @@ func TestAskCheckAndRoundTrip(t *testing.T) { edit func(*StepAsk) want string }{ - {"run beside a check", func(a *StepAsk) { a.Check = goodCheck().Check }, "or a step, exactly one"}, + {"run beside a check", func(a *StepAsk) { a.Check = goodCheck().Check }, "exactly one"}, {"run on the delivery stream", func(a *StepAsk) { a.Kind = AskDelivery }, "is a run"}, {"run on the Node seat", func(a *StepAsk) { a.Language = AskNode }, "is a run"}, {"run at a short commit", func(a *StepAsk) { a.Run.Program.Commit = "0123456" }, "no full commit"}, @@ -166,6 +174,31 @@ func TestAskCheckAndRoundTrip(t *testing.T) { t.Errorf("%s: %v, want %q", c.name, err, c.want) } } + // H-A-403: an install is the accepted kind install of the Node seat alone, its job naming its ask, a pipeline, a module + // at a full commit and fingerprint and a lock, under the version its archive is published with. + for _, c := range []struct { + name string + edit func(*StepAsk) + want string + }{ + {"install on the Go seat", func(a *StepAsk) { a.Language = AskGo }, "node-build-node alone installs"}, + {"install sent as a check", func(a *StepAsk) { a.Kind = AskCheck }, "carries an install alone"}, + {"install beside a step", func(a *StepAsk) { a.Step = stepAsk().Step }, "exactly one"}, + {"install of another ask", func(a *StepAsk) { a.Install.ID = "m2kx9a1b3c4d5f" }, "not its ask's"}, + {"install with no version", func(a *StepAsk) { a.Version = "" }, "names no version"}, + {"install with no lock", func(a *StepAsk) { a.Install.Lock = " " }, "no package lock"}, + {"install with no fingerprint", func(a *StepAsk) { a.Install.Fingerprint = "" }, "no build-input fingerprint"}, + {"install at a branch", func(a *StepAsk) { a.Install.Commit = "main" }, "no full commit"}, + } { + a := installAsk() + c.edit(&a) + if _, err := EncodeStepAsk(a); err == nil || !strings.Contains(err.Error(), c.want) { + t.Errorf("%s: %v, want %q", c.name, err, c.want) + } + } + if e, err := EndOf(installAsk(), "ace", OutcomePassed); err != nil || e.Step != StepInstall || e.Module != "gitea" || e.Fingerprint != "fp-0123" { + t.Errorf("the install's end: %+v, %v", e, err) + } if a := stepAsk(); !a.Step.Skips("./modules/nats/a", "sha256:bbbb") || a.Step.Skips("./modules/nats/a", "sha256:cccc") { t.Error("a kept result skips its package at its digest and level only") } @@ -281,6 +314,13 @@ func TestAskSubjectsStreamsAndKeys(t *testing.T) { if got, _ := AskWorker(AskGo, AskCheck); got != "SEAT_NODE_BUILD_GO_CHECK_worker" { t.Errorf("worker %q", got) } + // H-A-403: install is a queue of node-build-node alone. + if got, err := AskWorker(AskNode, AskInstall); got != "SEAT_NODE_BUILD_NODE_INSTALL_worker" || err != nil { + t.Errorf("install worker %q %v", got, err) + } + if _, err := AskSubject(AskGo, AskInstall); err == nil { + t.Error("the Go seat has an install queue") + } if got, _ := AskStream(AskImage); got != "SEAT_NODE_BUILD_IMAGE" { t.Errorf("stream %q", got) } @@ -552,9 +592,6 @@ func TestTheThreeSeatsFixturesFitTheNeutralForms(t *testing.T) { for _, f := range fixtures { t.Run(seat+"/"+f.Name, func(t *testing.T) { switch { - case f.Of == "accept:install": - seen++ - strict(t, f.Given, &InstallAsk{}) case strings.HasPrefix(f.Of, "accept:"): seen++ strict(t, f.Given, &StepAsk{}) diff --git a/modules/mesh-delivery-sdk/buildstep/pipelinestep.go b/modules/mesh-delivery-sdk/buildstep/pipelinestep.go index ae45a6ea8..a949b815f 100644 --- a/modules/mesh-delivery-sdk/buildstep/pipelinestep.go +++ b/modules/mesh-delivery-sdk/buildstep/pipelinestep.go @@ -80,8 +80,8 @@ type StepRun struct { Kept []KeptResult `json:"kept,omitempty"` Rerun bool `json:"rerun,omitempty"` By string `json:"by,omitempty"` - // Archive is the install archive object the Go build module unpacks into the workspace before the step (design 47 - // H2 §800). + // Archive is the reference of the install archive in the artifact store, which the Go build module fetches and + // unpacks into the workspace before the step (design 47 H2 §800, H-A-399 (2)). Archive string `json:"archive,omitempty"` } @@ -145,8 +145,8 @@ type StepEnded struct { // NotRun are the tests that did not run, each with its reason, counted apart from passed and failed (design 47 H2 // §800). NotRun []NotRun `json:"not-run,omitempty"` - // Archive is, for an install, the name of the archive object in the holder's outputs that holds the installed tree - // (design 47 H2 §800). + // Archive is, for an install, the reference the installed tree's archive was published under in the artifact store + // (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)). Archive string `json:"archive,omitempty"` Rerun bool `json:"rerun,omitempty"` By string `json:"by,omitempty"` @@ -161,21 +161,54 @@ type NotRun struct { Reason string `json:"reason"` } -// InstallAsk is an ask of the kind install the seat node-build-node accepts (design 47 H2 §800): the npm tree a -// module's package lock names, kept as an archive in the holder's outputs under the lock's digest. +// InstallAsk is the job of an ask of the kind install the seat node-build-node accepts (design 47 H2 §800, H-A-403): the +// npm tree a module's package lock names, installed with no install scripts and published to the artifact store as the +// module's archive :node-modules under the ask's version, which the builder's reservation covers. type InstallAsk struct { ID string `json:"id"` Asker string `json:"asker"` Pipeline string `json:"pipeline"` Module string `json:"module"` Commit string `json:"commit"` + // Fingerprint is the module's build-input fingerprint at the commit (H-A-403). + Fingerprint string `json:"fingerprint"` // Lock is the package lock's text at the commit. Lock string `json:"lock"` } +// InstallArtifact is the artifact the install archive of module is published as (H-A-403): :node-modules. +func InstallArtifact(module string) string { return module + ":node-modules" } + +func (i InstallAsk) check(a StepAsk) error { + switch { + case i.ID != a.ID || i.Asker != a.Asker: + return fmt.Errorf("buildstep: the install ask %s names the id %q and the asker %q, not its ask's", a.ID, i.ID, i.Asker) + case i.Pipeline == "": + return fmt.Errorf("buildstep: the install ask %s names no pipeline", a.ID) + case !askCommitOK.MatchString(i.Commit): + return fmt.Errorf("buildstep: the install ask %s names no full commit (%q)", a.ID, i.Commit) + case i.Fingerprint == "": + return fmt.Errorf("buildstep: the install ask %s names no build-input fingerprint", a.ID) + case strings.TrimSpace(i.Lock) == "": + return fmt.Errorf("buildstep: the install ask %s holds no package lock", a.ID) + case a.Version == "": + return fmt.Errorf("buildstep: the install ask %s names no version, so its archive could be published under no reservation (H-A-373, H-A-403)", a.ID) + } + if err := meshkeys.CheckName("module", i.Module); err != nil { + return fmt.Errorf("the install ask %s: %w", a.ID, err) + } + return nil +} + // EndOf is the end of the step a holds, on node, with outcome: the ask's names copied, so the runner can match the ask, // the commit and the fingerprint (ADR 0666 §21). func EndOf(a StepAsk, node, outcome string) (StepEnded, error) { + if i := a.Install; i != nil { + // An install's end names its pipeline, the step install, its module, commit and fingerprint (H-A-379, H-A-403). + e := StepEnded{V: StepEndedVersion, ID: a.ID, Asker: a.Asker, Ask: a.ID, Pipeline: i.Pipeline, Step: StepInstall, Module: i.Module, + Commit: i.Commit, Fingerprint: i.Fingerprint, Node: node, Outcome: outcome} + return e, e.check() + } if a.Step == nil { return StepEnded{}, fmt.Errorf("buildstep: the ask %s is no pipeline step", a.ID) } diff --git a/modules/mesh-delivery-sdk/steprun/askrun.go b/modules/mesh-delivery-sdk/steprun/askrun.go index bbfb70177..5888996e4 100644 --- a/modules/mesh-delivery-sdk/steprun/askrun.go +++ b/modules/mesh-delivery-sdk/steprun/askrun.go @@ -48,6 +48,11 @@ type AskSteps struct { // Has says whether this node has a need a package's tests declare (sdkstep.AskNeeds, issue 890); a package needing // what it lacks is not tested here but named in the level's Unmet, for the asker to place. Nil has nothing. Has func(need string) bool + // Install is the Node build module's install body for an install ask (design 47 H2 §800, H-A-403): it takes the + // module, commit, fingerprint, pipeline, the package lock's text, the artifact :node-modules and the ask's + // version, installs the tree with no install scripts, publishes its archive to the artifact store under that version and + // answers {"archive": }. Nil ends every install ask could not run. + Install StepFunc // Lint is the module's lint body for a pipeline step lint (novox/hq ADR 0666 §7): it takes the workspace and the // module's directory and answers a LintAnswer. Nil ends every lint step as nothing to run. Lint StepFunc @@ -78,7 +83,7 @@ func RunAsk(ctx context.Context, steps AskSteps, ask sdkstep.StepAsk) (any, erro job.Fetch = withPackages(job.Fetch, ask.Packages) return steps.build(ctx, job, ask.Version) } - if ask.Step != nil { + if ask.Step != nil || ask.Install != nil { return steps.runStep(ctx, ask) } if ask.Check != nil { diff --git a/modules/mesh-delivery-sdk/steprun/askrun_test.go b/modules/mesh-delivery-sdk/steprun/askrun_test.go index 762ee4d37..50f1ea5f5 100644 --- a/modules/mesh-delivery-sdk/steprun/askrun_test.go +++ b/modules/mesh-delivery-sdk/steprun/askrun_test.go @@ -418,6 +418,13 @@ func TestASeatsAskTypeRunsAsTheNeutralAsk(t *testing.T) { // runs its one level as a check of it, carries the packages the runner kept at their digest, keeps what it passed, says // its counts, and says its end once on its own node; a level with no tests ends nothing to run, a fault of the source // could not run, and a transport fault or an end that could not be said is handed back unsaid, to be given again. +// installOf is an install ask of the Node seat (H-A-403). +func installOf() sdkstep.StepAsk { + id := sdkstep.NewID() + return sdkstep.StepAsk{ID: id, Kind: sdkstep.AskInstall, Language: sdkstep.AskNode, Asker: "mesh-delivery-pipeline", At: time.Now(), Version: "0.1.4", + Install: &sdkstep.InstallAsk{ID: id, Asker: "mesh-delivery-pipeline", Pipeline: "main.12.m", Module: "m", Commit: runCommit, Fingerprint: "fp-1", Lock: "{}"}} +} + func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) { type said struct{ ends []sdkstep.StepEnded } stepOf := func(step string, kept ...sdkstep.KeptResult) sdkstep.StepAsk { @@ -444,6 +451,8 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) { notRun []sdkstep.NotRun saidOpen string // the end's said opens with these words archive string // the step's install archive, which every test call names + install StepFunc + arch string // the archive the end names }{ {name: "unit: the kept package carried, the other tested and kept", ask: stepOf(sdkstep.StepUnit, sdkstep.KeptResult{Package: "x/a", Digest: "d-a", Level: "unit"}), digests: map[string]string{"x/a": "d-a", "x/b": "d-b"}, tests: map[string]bool{"x/b": true}, outcome: sdkstep.OutcomePassed, counts: 1, carried: []string{"x/a"}, kept: []string{"x/b"}}, @@ -473,6 +482,17 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) { // §800: the install archive the step names reaches the test calls, for the build module to unpack. {name: "integration with an install archive: the test calls name it", ask: stepOf(sdkstep.StepIntegration), digests: map[string]string{"x/b": "d-b"}, tests: map[string]bool{"x/b": true}, outcome: sdkstep.OutcomePassed, counts: 1, kept: []string{"x/b"}, archive: "oci-artifact-registry://gitea/npm-tree:0.1.4"}, + // H-A-403, H-A-399 (2): an install publishes its archive under the ask's version and its end names the reference. + {name: "install: passed, naming its archive", ask: installOf(), outcome: sdkstep.OutcomePassed, arch: "oci-artifact-registry://m/node-modules:0.1.4", + install: func(_ context.Context, args map[string]any) (any, error) { + if args["artifact"] != "m:node-modules" || args["version"] != "0.1.4" || args["lock"] != "{}" { + return nil, fmt.Errorf("the install was asked %v", args) + } + return map[string]any{"archive": "oci-artifact-registry://m/node-modules:0.1.4"}, nil + }}, + {name: "install answering no archive: could not run", ask: installOf(), outcome: sdkstep.OutcomeCouldNotRun, saidOpen: "the install answered no archive", + install: func(context.Context, map[string]any) (any, error) { return map[string]any{}, nil }}, + {name: "install with no install body: could not run", ask: installOf(), outcome: sdkstep.OutcomeCouldNotRun, saidOpen: "this build module installs nothing"}, // §799: a fetch met away on the third run ends the step failed with its why. {name: "a fetch fault's third run: failed, fetch:", ask: stepOf(sdkstep.StepUnit), run: 3, outcome: sdkstep.OutcomeFailed, fetchErr: &sdkstep.Passing{Err: errors.New("fetch: git fetch: status 502")}, saidOpen: "fetch: git fetch"}, @@ -482,7 +502,7 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) { if row.fetchErr != nil { s.Fetch = func(context.Context, map[string]any) (any, error) { return nil, row.fetchErr } } - s.Lint, s.Node = row.lint, "ace" + s.Lint, s.Node, s.Install = row.lint, "ace", row.install if row.noTests { s.Test = func(context.Context, map[string]any) (any, error) { return map[string]any{"passed": true, "tests": 0, "no_tests": true}, nil @@ -548,6 +568,9 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) { t.Errorf("%s: the test call %s names no archive %s", row.name, c, row.archive) } } + if e.Archive != row.arch { + t.Errorf("%s: the end names the archive %q, want %q", row.name, e.Archive, row.arch) + } if !slices.Equal(e.NotRun, row.notRun) || !strings.HasPrefix(e.Said, row.saidOpen) { t.Errorf("%s: not run %+v said %q, want %+v and said opening %q", row.name, e.NotRun, e.Said, row.notRun, row.saidOpen) } diff --git a/modules/mesh-delivery-sdk/steprun/pull.go b/modules/mesh-delivery-sdk/steprun/pull.go index b35a30ad0..490d2ee26 100644 --- a/modules/mesh-delivery-sdk/steprun/pull.go +++ b/modules/mesh-delivery-sdk/steprun/pull.go @@ -535,9 +535,10 @@ func (p *Puller) next(ctx context.Context, wait time.Duration) (*Pulled, error) p.mu.Lock() declined, start := p.declined, p.turn p.mu.Unlock() - for i := range sdkstep.AskKinds { - at := (start + i) % len(sdkstep.AskKinds) - kind := sdkstep.AskKinds[at] + queues := sdkstep.AskQueues(p.Language) + for i := range queues { + at := (start + i) % len(queues) + kind := queues[at] if declined[kind] { continue } @@ -545,7 +546,7 @@ func (p *Puller) next(ctx context.Context, wait time.Duration) (*Pulled, error) if err != nil || msg != nil { if msg != nil { p.mu.Lock() - p.turn = (at + 1) % len(sdkstep.AskKinds) + p.turn = (at + 1) % len(queues) p.mu.Unlock() } return withKind(msg, kind), err @@ -731,8 +732,11 @@ func (p *Puller) take(ctx context.Context, msg *Pulled) { return } module := "" - if ask.Build != nil { + switch { + case ask.Build != nil: module = ask.Build.Module + case ask.Install != nil: + module = ask.Install.Module } p.mu.Lock() p.inHand++ @@ -1059,7 +1063,7 @@ func (p *Puller) say(event string, body any, id string) { // key naming it (design 47 G A-290: finish kept it with KeepOutput, so it is not put twice); a program that exits other than 0 // ends failed with its answer carried. func (p *Puller) sayEnded(msg *Pulled, ask sdkstep.StepAsk, outcome, said string, result any, kept string) { - if p.Say == nil || ask.Step != nil { + if p.Say == nil || ask.Step != nil || ask.Install != nil { return } end := sdkstep.StepEnded{ID: ask.ID, Asker: askerOf(msg, ask), Ask: ask.ID, Node: p.Node, Outcome: outcome, At: now().UTC()} diff --git a/modules/mesh-delivery-sdk/steprun/pull_test.go b/modules/mesh-delivery-sdk/steprun/pull_test.go index bb514f3a9..4c7af288c 100644 --- a/modules/mesh-delivery-sdk/steprun/pull_test.go +++ b/modules/mesh-delivery-sdk/steprun/pull_test.go @@ -133,6 +133,15 @@ func TestPullKindsTakeTurns(t *testing.T) { if want := []string{sdkstep.AskDelivery, sdkstep.AskCheck, sdkstep.AskDelivery}; len(order) != 3 || order[0] != want[0] || order[1] != want[1] || order[2] != want[2] { t.Fatalf("order = %v, want %v", order, want) } + // H-A-403: the Node seat's holder pulls install, its own queue, beside the others. + nsrc := NewFakeAsks() + if err := nsrc.PublishAsk(installOf()); err != nil { + t.Fatal(err) + } + np := &Puller{Source: nsrc, Language: sdkstep.AskNode, Node: "shanks", Put: newSteps().put, Capacity: func() int { return 1 }, + PullWait: 10 * time.Millisecond, Run: func(context.Context, sdkstep.StepAsk) (any, error) { return nil, nil }} + go np.Pull(ctx) + waitFor(t, "the install acked", func() bool { a, _, _ := nsrc.Fates(); return len(a) == 1 }) } // 1887/A2a, 1887/AC-pull: given capacity 2 and three asks waiting, two run and the third waits, and it starts when diff --git a/modules/mesh-delivery-sdk/steprun/steprun.go b/modules/mesh-delivery-sdk/steprun/steprun.go index b5dff4aca..f0fa2b4f2 100644 --- a/modules/mesh-delivery-sdk/steprun/steprun.go +++ b/modules/mesh-delivery-sdk/steprun/steprun.go @@ -63,7 +63,9 @@ func (s AskSteps) runStep(ctx context.Context, ask sdkstep.StepAsk) (any, error) // stepOutcome runs the step into end; the error it answers is one that keeps the end unsaid. func (s AskSteps) stepOutcome(ctx context.Context, ask sdkstep.StepAsk, end *sdkstep.StepEnded) error { var err error - if ask.Step.Step == sdkstep.StepLint { + if ask.Install != nil { + err = s.installStep(ctx, ask, end) + } else if ask.Step.Step == sdkstep.StepLint { err = s.lintStep(ctx, *ask.Step, end) } else { err = s.testStep(ctx, ask, end) @@ -81,6 +83,33 @@ func (s AskSteps) stepOutcome(ctx context.Context, ask sdkstep.StepAsk, end *sdk } } +// installStep runs the module's install body and names the archive it published in the end (design 47 H2 §800, H-A-399 +// (2), H-A-403); an install that answers no archive could not run. +func (s AskSteps) installStep(ctx context.Context, ask sdkstep.StepAsk, end *sdkstep.StepEnded) error { + if s.Install == nil { + return fmt.Errorf("this build module installs nothing") + } + i := ask.Install + Phase(ctx, "install") + out, err := s.Install(ctx, map[string]any{"module": i.Module, "commit": i.Commit, "fingerprint": i.Fingerprint, "pipeline": i.Pipeline, + "lock": i.Lock, "artifact": sdkstep.InstallArtifact(i.Module), "version": ask.Version}) + if err != nil { + return err + } + r, err := raw(out) + if err != nil { + return err + } + var a struct { + Archive string `json:"archive"` + } + if err := json.Unmarshal(r, &a); err != nil || a.Archive == "" { + return fmt.Errorf("the install answered no archive: %s", r) + } + end.Outcome, end.Archive = sdkstep.OutcomePassed, a.Archive + return nil +} + // lintStep fetches the heads and runs the module's lint body over the artifact's tree. func (s AskSteps) lintStep(ctx context.Context, run sdkstep.StepRun, end *sdkstep.StepEnded) error { if s.Lint == nil {