| 1 |
-- allium: 3 |
| 2 |
-- ci-actions.allium |
| 3 |
|
| 4 |
-- Scope: GitHub Actions automation for clnkr. |
| 5 |
-- Includes: pull request and main-branch validation, thoth guardrails, |
| 6 |
-- mocked evaluations, release-gated live evaluations, release artifact |
| 7 |
-- publication, Debian branch updates, Homebrew tap updates, and site deployment. |
| 8 |
-- Excludes: |
| 9 |
-- - Provider-specific evaluation scoring internals. |
| 10 |
-- - GitHub Actions runner implementation details. |
| 11 |
-- - The internal behavior of thoth architecture reports. |
| 12 |
|
| 13 |
------------------------------------------------------------ |
| 14 |
-- Value Types |
| 15 |
------------------------------------------------------------ |
| 16 |
|
| 17 |
value GitRef { |
| 18 |
name: String |
| 19 |
kind: branch | pull_request | semver_tag |
| 20 |
} |
| 21 |
|
| 22 |
value ReleaseAsset { |
| 23 |
name: String |
| 24 |
kind: debian_package | binary | source_archive | checksum |
| 25 |
} |
| 26 |
|
| 27 |
------------------------------------------------------------ |
| 28 |
-- Enumerations |
| 29 |
------------------------------------------------------------ |
| 30 |
|
| 31 |
enum RunStatus { requested | running | passed | failed | skipped } |
| 32 |
enum ValidationRequirement { actionlint | make_check | race_tests | thoth_guardrails } |
| 33 |
enum EvaluationProvider { openai | anthropic } |
| 34 |
|
| 35 |
------------------------------------------------------------ |
| 36 |
-- Entities and Variants |
| 37 |
------------------------------------------------------------ |
| 38 |
|
| 39 |
entity RepositoryHost {} |
| 40 |
|
| 41 |
entity Maintainer {} |
| 42 |
|
| 43 |
entity ValidationRun { |
| 44 |
ref: GitRef |
| 45 |
status: RunStatus |
| 46 |
requirements: Set<ValidationRequirement> |
| 47 |
|
| 48 |
transitions status { |
| 49 |
requested -> running |
| 50 |
running -> passed |
| 51 |
running -> failed |
| 52 |
terminal: passed, failed, skipped |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
entity LiveEvaluationRun { |
| 57 |
ref: GitRef |
| 58 |
provider: EvaluationProvider |
| 59 |
status: RunStatus |
| 60 |
artifacts_published: Boolean |
| 61 |
|
| 62 |
transitions status { |
| 63 |
requested -> running |
| 64 |
running -> passed |
| 65 |
running -> failed |
| 66 |
terminal: passed, failed |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
entity ReleaseRun { |
| 71 |
ref: GitRef |
| 72 |
status: RunStatus |
| 73 |
assets: Set<ReleaseAsset> |
| 74 |
live_evaluations_passed: Boolean |
| 75 |
main_status_required: Boolean |
| 76 |
tag_latest_main_intended: Boolean |
| 77 |
tag_latest_main_enforced: Boolean |
| 78 |
site_deployment_required: Boolean |
| 79 |
debian_branch_updated: Boolean |
| 80 |
debian_changelog_updated: Boolean |
| 81 |
project_changelog_updated: Boolean |
| 82 |
generated_manpages_packaged: Boolean |
| 83 |
generated_docs_committed: Boolean |
| 84 |
homebrew_tap_updated: Boolean |
| 85 |
|
| 86 |
transitions status { |
| 87 |
requested -> running |
| 88 |
running -> passed |
| 89 |
running -> failed |
| 90 |
terminal: passed, failed |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
entity SiteDeployment { |
| 95 |
ref: GitRef |
| 96 |
status: RunStatus |
| 97 |
reports_repository_status: Boolean |
| 98 |
|
| 99 |
transitions status { |
| 100 |
requested -> running |
| 101 |
running -> passed |
| 102 |
running -> failed |
| 103 |
terminal: passed, failed |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
------------------------------------------------------------ |
| 108 |
-- Rules |
| 109 |
------------------------------------------------------------ |
| 110 |
|
| 111 |
rule ValidateMainPush { |
| 112 |
when: MainBranchPushed(host, ref) |
| 113 |
requires: ref.kind = branch |
| 114 |
requires: ref.name = "main" |
| 115 |
|
| 116 |
ensures: ValidationRun.created( |
| 117 |
ref: ref, |
| 118 |
status: requested, |
| 119 |
requirements: { actionlint, make_check, race_tests, thoth_guardrails } |
| 120 |
) |
| 121 |
} |
| 122 |
|
| 123 |
rule ValidatePullRequest { |
| 124 |
when: PullRequestTargetingMain(host, ref) |
| 125 |
requires: ref.kind = pull_request |
| 126 |
|
| 127 |
ensures: ValidationRun.created( |
| 128 |
ref: ref, |
| 129 |
status: requested, |
| 130 |
requirements: { actionlint, make_check, race_tests, thoth_guardrails } |
| 131 |
) |
| 132 |
} |
| 133 |
|
| 134 |
rule MakeCheckContainsRepositoryQualityGates { |
| 135 |
when: run: ValidationRun.status transitions_to running |
| 136 |
requires: make_check in run.requirements |
| 137 |
|
| 138 |
ensures: MakeCheckRequires( |
| 139 |
run: run, |
| 140 |
obligations: { |
| 141 |
formatting, |
| 142 |
vet, |
| 143 |
lint, |
| 144 |
architecture_imports, |
| 145 |
script_tests, |
| 146 |
core_sloc, |
| 147 |
frontend_sloc, |
| 148 |
workflow_make_targets, |
| 149 |
docs, |
| 150 |
unit_tests, |
| 151 |
mocked_evaluations |
| 152 |
} |
| 153 |
) |
| 154 |
} |
| 155 |
|
| 156 |
rule ThothGuardrailsRemainSeparateFromMakeCheck { |
| 157 |
when: run: ValidationRun.status transitions_to running |
| 158 |
requires: thoth_guardrails in run.requirements |
| 159 |
|
| 160 |
ensures: GuardrailReportsRequired( |
| 161 |
run: run, |
| 162 |
reports: { |
| 163 |
thoth_critical, |
| 164 |
architecture_shape, |
| 165 |
semantic_cohesion, |
| 166 |
test_fidelity |
| 167 |
} |
| 168 |
) |
| 169 |
} |
| 170 |
|
| 171 |
rule ValidationPassesWhenAllRequirementsPass { |
| 172 |
when: ValidationRequirementsCompleted(host, run) |
| 173 |
requires: AllValidationRequirementsPassed(run) |
| 174 |
|
| 175 |
ensures: run.status = passed |
| 176 |
} |
| 177 |
|
| 178 |
rule ValidationFailsWhenAnyRequirementFails { |
| 179 |
when: ValidationRequirementsCompleted(host, run) |
| 180 |
requires: AnyValidationRequirementFailed(run) |
| 181 |
|
| 182 |
ensures: run.status = failed |
| 183 |
} |
| 184 |
|
| 185 |
rule ReleaseRequiresLiveEvaluations { |
| 186 |
when: SemverTagPushed(host, ref) |
| 187 |
requires: ref.kind = semver_tag |
| 188 |
|
| 189 |
ensures: |
| 190 |
LiveEvaluationRun.created( |
| 191 |
ref: ref, |
| 192 |
provider: openai, |
| 193 |
status: requested, |
| 194 |
artifacts_published: false |
| 195 |
) |
| 196 |
LiveEvaluationRun.created( |
| 197 |
ref: ref, |
| 198 |
provider: anthropic, |
| 199 |
status: requested, |
| 200 |
artifacts_published: false |
| 201 |
) |
| 202 |
} |
| 203 |
|
| 204 |
rule RunLiveEvaluationsWhenMaintainerRequests { |
| 205 |
when: MaintainerRequestsLiveEvaluations(maintainer, ref) |
| 206 |
|
| 207 |
ensures: |
| 208 |
LiveEvaluationRun.created( |
| 209 |
ref: ref, |
| 210 |
provider: openai, |
| 211 |
status: requested, |
| 212 |
artifacts_published: false |
| 213 |
) |
| 214 |
LiveEvaluationRun.created( |
| 215 |
ref: ref, |
| 216 |
provider: anthropic, |
| 217 |
status: requested, |
| 218 |
artifacts_published: false |
| 219 |
) |
| 220 |
} |
| 221 |
|
| 222 |
rule FailLiveEvaluationWhenProviderSecretMissing { |
| 223 |
when: run: LiveEvaluationRun.status transitions_to running |
| 224 |
requires: not ProviderSecretAvailable(run.provider) |
| 225 |
|
| 226 |
ensures: run.status = failed |
| 227 |
} |
| 228 |
|
| 229 |
rule PublishLiveEvaluationArtifacts { |
| 230 |
when: run: LiveEvaluationRun.status transitions_to failed |
| 231 |
|
| 232 |
ensures: run.artifacts_published = true |
| 233 |
} |
| 234 |
|
| 235 |
rule ReleaseSemverTag { |
| 236 |
when: SemverTagPushed(host, ref) |
| 237 |
requires: ref.kind = semver_tag |
| 238 |
requires: LiveEvaluationsPassed(ref) |
| 239 |
|
| 240 |
ensures: ReleaseRun.created( |
| 241 |
ref: ref, |
| 242 |
status: requested, |
| 243 |
assets: { |
| 244 |
ReleaseAsset{name: "debian-amd64", kind: debian_package}, |
| 245 |
ReleaseAsset{name: "debian-arm64", kind: debian_package}, |
| 246 |
ReleaseAsset{name: "linux-amd64", kind: binary}, |
| 247 |
ReleaseAsset{name: "linux-arm64", kind: binary}, |
| 248 |
ReleaseAsset{name: "darwin-amd64", kind: binary}, |
| 249 |
ReleaseAsset{name: "darwin-arm64", kind: binary}, |
| 250 |
ReleaseAsset{name: "source", kind: source_archive}, |
| 251 |
ReleaseAsset{name: "checksums", kind: checksum} |
| 252 |
}, |
| 253 |
live_evaluations_passed: true, |
| 254 |
main_status_required: true, |
| 255 |
tag_latest_main_intended: true, |
| 256 |
tag_latest_main_enforced: false, |
| 257 |
site_deployment_required: false, |
| 258 |
debian_branch_updated: false, |
| 259 |
debian_changelog_updated: false, |
| 260 |
project_changelog_updated: false, |
| 261 |
generated_manpages_packaged: false, |
| 262 |
generated_docs_committed: false, |
| 263 |
homebrew_tap_updated: false |
| 264 |
) |
| 265 |
} |
| 266 |
|
| 267 |
rule ReleasePublishesDownstreamState { |
| 268 |
when: run: ReleaseRun.status transitions_to running |
| 269 |
requires: run.live_evaluations_passed = true |
| 270 |
requires: MainRepositoryStatusIsGreen(run.ref) |
| 271 |
requires: run.tag_latest_main_intended = true |
| 272 |
requires: run.tag_latest_main_enforced = false |
| 273 |
requires: run.site_deployment_required = false |
| 274 |
|
| 275 |
ensures: |
| 276 |
run.debian_branch_updated = true |
| 277 |
run.debian_changelog_updated = true |
| 278 |
run.project_changelog_updated = true |
| 279 |
run.generated_manpages_packaged = true |
| 280 |
run.generated_docs_committed = false |
| 281 |
run.homebrew_tap_updated = true |
| 282 |
} |
| 283 |
|
| 284 |
rule MainIsGreenWhenValidationAndSitePass { |
| 285 |
when: MainStatusChecked(ref) |
| 286 |
requires: MainValidationPassed(ref) |
| 287 |
requires: MainSiteDeploymentPassed(ref) |
| 288 |
|
| 289 |
ensures: MainRepositoryStatusIsGreen(ref) |
| 290 |
} |
| 291 |
|
| 292 |
rule ReleasePassesWhenArtifactsAndDownstreamStateExist { |
| 293 |
when: ReleaseWorkCompleted(host, run) |
| 294 |
requires: run.live_evaluations_passed = true |
| 295 |
requires: MainRepositoryStatusIsGreen(run.ref) |
| 296 |
requires: run.site_deployment_required = false |
| 297 |
requires: ReleaseAssetsPublished(run) |
| 298 |
requires: run.debian_branch_updated = true |
| 299 |
requires: run.debian_changelog_updated = true |
| 300 |
requires: run.project_changelog_updated = true |
| 301 |
requires: run.generated_manpages_packaged = true |
| 302 |
requires: run.generated_docs_committed = false |
| 303 |
requires: run.homebrew_tap_updated = true |
| 304 |
|
| 305 |
ensures: run.status = passed |
| 306 |
} |
| 307 |
|
| 308 |
rule DeploySiteForMainPush { |
| 309 |
when: MainBranchPushed(host, ref) |
| 310 |
requires: ref.kind = branch |
| 311 |
requires: ref.name = "main" |
| 312 |
|
| 313 |
ensures: SiteDeployment.created( |
| 314 |
ref: ref, |
| 315 |
status: requested, |
| 316 |
reports_repository_status: true |
| 317 |
) |
| 318 |
} |
| 319 |
|
| 320 |
rule DeploySiteForPullRequest { |
| 321 |
when: PullRequestTargetingMain(host, ref) |
| 322 |
requires: ref.kind = pull_request |
| 323 |
|
| 324 |
ensures: SiteDeployment.created( |
| 325 |
ref: ref, |
| 326 |
status: requested, |
| 327 |
reports_repository_status: true |
| 328 |
) |
| 329 |
} |
| 330 |
|
| 331 |
rule DeploySiteWhenMaintainerRequests { |
| 332 |
when: MaintainerRequestsSiteDeployment(maintainer, ref) |
| 333 |
|
| 334 |
ensures: SiteDeployment.created( |
| 335 |
ref: ref, |
| 336 |
status: requested, |
| 337 |
reports_repository_status: true |
| 338 |
) |
| 339 |
} |
| 340 |
|
| 341 |
rule SiteDeploymentPassesWhenPublished { |
| 342 |
when: SitePublishCompleted(host, deployment) |
| 343 |
requires: SiteContentPublished(deployment) |
| 344 |
|
| 345 |
ensures: deployment.status = passed |
| 346 |
} |
| 347 |
|
| 348 |
rule SiteDeploymentFailureReportsRedStatus { |
| 349 |
when: deployment: SiteDeployment.status transitions_to failed |
| 350 |
requires: deployment.reports_repository_status = true |
| 351 |
|
| 352 |
ensures: RepositoryStatusRed(ref: deployment.ref, source: site_deployment) |
| 353 |
} |
| 354 |
|
| 355 |
------------------------------------------------------------ |
| 356 |
-- Actor Declarations |
| 357 |
------------------------------------------------------------ |
| 358 |
|
| 359 |
actor RepositoryHostActor { |
| 360 |
identified_by: RepositoryHost where true |
| 361 |
} |
| 362 |
|
| 363 |
actor MaintainerActor { |
| 364 |
identified_by: Maintainer where true |
| 365 |
} |
| 366 |
|
| 367 |
------------------------------------------------------------ |
| 368 |
-- Surfaces |
| 369 |
------------------------------------------------------------ |
| 370 |
|
| 371 |
surface GitHubEvents { |
| 372 |
facing host: RepositoryHostActor |
| 373 |
|
| 374 |
provides: |
| 375 |
MainBranchPushed(host, ref) |
| 376 |
PullRequestTargetingMain(host, ref) |
| 377 |
SemverTagPushed(host, ref) |
| 378 |
} |
| 379 |
|
| 380 |
surface MaintainerDispatch { |
| 381 |
facing maintainer: MaintainerActor |
| 382 |
|
| 383 |
provides: |
| 384 |
MaintainerRequestsLiveEvaluations(maintainer, ref) |
| 385 |
MaintainerRequestsSiteDeployment(maintainer, ref) |
| 386 |
} |
| 387 |
|
| 388 |
surface WorkflowRuntime { |
| 389 |
facing host: RepositoryHostActor |
| 390 |
|
| 391 |
provides: |
| 392 |
ValidationRequirementsCompleted(host, run) |
| 393 |
MainStatusChecked(ref) |
| 394 |
ReleaseWorkCompleted(host, run) |
| 395 |
SitePublishCompleted(host, deployment) |
| 396 |
} |
| 397 |
|
| 398 |
surface ValidationStatus { |
| 399 |
facing host: RepositoryHostActor |
| 400 |
|
| 401 |
context run: ValidationRun |
| 402 |
|
| 403 |
exposes: |
| 404 |
run.ref |
| 405 |
run.status |
| 406 |
run.requirements |
| 407 |
} |
| 408 |
|
| 409 |
surface LiveEvaluationStatus { |
| 410 |
facing host: RepositoryHostActor |
| 411 |
|
| 412 |
context run: LiveEvaluationRun |
| 413 |
|
| 414 |
exposes: |
| 415 |
run.ref |
| 416 |
run.provider |
| 417 |
run.status |
| 418 |
run.artifacts_published |
| 419 |
} |
| 420 |
|
| 421 |
surface ReleaseStatus { |
| 422 |
facing host: RepositoryHostActor |
| 423 |
|
| 424 |
context run: ReleaseRun |
| 425 |
|
| 426 |
exposes: |
| 427 |
run.ref |
| 428 |
run.status |
| 429 |
run.assets |
| 430 |
run.live_evaluations_passed |
| 431 |
run.main_status_required |
| 432 |
run.tag_latest_main_intended |
| 433 |
run.tag_latest_main_enforced |
| 434 |
run.site_deployment_required |
| 435 |
run.debian_branch_updated |
| 436 |
run.debian_changelog_updated |
| 437 |
run.project_changelog_updated |
| 438 |
run.generated_manpages_packaged |
| 439 |
run.generated_docs_committed |
| 440 |
run.homebrew_tap_updated |
| 441 |
} |
| 442 |
|
| 443 |
surface SiteDeploymentStatus { |
| 444 |
facing host: RepositoryHostActor |
| 445 |
|
| 446 |
context deployment: SiteDeployment |
| 447 |
|
| 448 |
exposes: |
| 449 |
deployment.ref |
| 450 |
deployment.status |
| 451 |
deployment.reports_repository_status |
| 452 |
} |