@patronage/factory-ci 1.0.0-alpha.42 → 1.0.0-alpha.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -381,6 +381,14 @@ export const resolveProofReuseCommands = (
381
381
  * created no earlier than its verification began, so `started_at` is an
382
382
  * upper bound on that start. Ranking there can only make such a run newer
383
383
  * than it is, so it vetoes more, never less.
384
+ * - A pass with no usable typed proof is reused only when it is the only run
385
+ * at this head (#1514). Its verification started at some unknown instant
386
+ * no later than its `started_at`, so another run posted before that
387
+ * `started_at` may still have been posted after the pass began: a pass
388
+ * verified before a failure but posted after it would otherwise outrank
389
+ * the failure. Ranked at its post, such a pass can only veto more as an
390
+ * older run; as the newest it is `ambiguous` beside any other run. Proofs
391
+ * over the text cap are rare, so refusing costs a hosted run.
384
392
  * - Neither `endedAt` nor a passing run's `started_at` is its start. The
385
393
  * factory posts a `pr-verify` run only once verification has finished, so
386
394
  * both say when it ended, and an older pass ordered there would hide a run
@@ -429,7 +437,7 @@ export const resolveProofReuseCommands = (
429
437
  * reimplement the CLI's payload parser. On payloads the factory's writer
430
438
  * emits, both readers select the same pass or both refuse: the differential
431
439
  * suite, `software-factory/src/pr-verify-reuse-differential.test.ts`,
432
- * asserts it over 9,653 generated run sets. On App-signed text the writer
440
+ * asserts it over 10,561 generated run sets. On App-signed text the writer
433
441
  * never emits, the two can differ in either direction. The known instances
434
442
  * where this gate reuses and the CLI refuses are: (a) a reused run whose
435
443
  * typed proof fails `validatePrVerifyProof`; (b) a newest pass that repeats
@@ -601,6 +609,11 @@ def releaseAuthorized($release; $commands; $stamp):
601
609
  | ($newestRun.recorded | not)
602
610
  and ([ $runs[] | select(sameVerdict($newestRun)) ] | length) > 1)
603
611
  then ["ambiguous", "", "", ""]
612
+ elif ($generation[0] as $newestRun
613
+ | ($newestRun | passing)
614
+ and ($newestRun.recorded | not)
615
+ and ($runs | length) > 1)
616
+ then ["ambiguous", "", "", ""]
604
617
  elif ($generation[0] as $newestRun
605
618
  | ($newestRun | passing)
606
619
  and any($observed[] | select(ownGeneration($newestRun) | not);
@@ -739,13 +752,15 @@ gate_lookup() {
739
752
  lookup_detail="checks API unreadable: $lookup_response"
740
753
  return 0
741
754
  fi
742
- if ! lookup_finding=$(printf '%s' "$lookup_response" | jq -r -s \
755
+ # A herestring, not printf piped into jq: the lookup starts jq alone,
756
+ # with no pipeline around it (#1096).
757
+ if ! lookup_finding=$(jq -r -s \
743
758
  --arg name "$CHECK_NAME" \
744
759
  --arg app "$FACTORY_APP_ID" \
745
760
  --arg sha "$1" \
746
761
  --arg repository "$GITHUB_REPOSITORY" \
747
762
  --argjson required "$REQUIRED_COMMANDS" \
748
- '${GATE_JQ}' 2>&1); then
763
+ '${GATE_JQ}' 2>&1 <<< "$lookup_response"); then
749
764
  lookup_detail="unreadable proof binding: $lookup_finding"
750
765
  return 0
751
766
  fi
@@ -801,9 +816,14 @@ if [ "$reason" = 'proven' ]; then
801
816
  fi
802
817
 
803
818
  # detail can carry arbitrary gh or jq error text. Collapse it to one bounded
804
- # line so it cannot restructure the summary it is written into.
805
- detail=$(printf '%s' "$detail" | tr '\n\r\t' ' ' | cut -c1-240)
806
- missing=$(printf '%s' "$missing" | tr '\n\r\t' ' ' | cut -c1-240)
819
+ # line so it cannot restructure the summary it is written into. Builtin
820
+ # expansions, not printf | tr | cut: each process the script starts waits for
821
+ # a CPU on a loaded machine, and these two pipelines were most of the
822
+ # processes every gate run started (#1096).
823
+ detail=${shellExpansion(String.raw`detail//[$'\n\r\t']/ `)}
824
+ detail=${shellExpansion("detail:0:240")}
825
+ missing=${shellExpansion(String.raw`missing//[$'\n\r\t']/ `)}
826
+ missing=${shellExpansion("missing:0:240")}
807
827
  if ! [[ "$source_url" =~ ^https://github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+/runs/[0-9]+$ ]]; then
808
828
  source_url=''
809
829
  fi
@@ -865,7 +885,7 @@ case "$reason" in
865
885
  ambiguous)
866
886
  say 'Ran the full suite. The newest factory proof for this commit is ambiguous.'
867
887
  say ''
868
- say "Two different \`$CHECK_NAME\` proofs at head \`$HEAD_SHA\` share the newest generation, the newest repeats an earlier run's verdict with no proof time to tell them apart, a run's start time cannot be ranked, or the newest pass started before another run at this head was posted, so there is no single newest generation to trust. The gate refuses rather than picking one."
888
+ say "Two different \`$CHECK_NAME\` proofs at head \`$HEAD_SHA\` share the newest generation, the newest repeats an earlier run's verdict with no proof time to tell them apart, a run's start time cannot be ranked, the newest pass records no verification start beside another run at this head, or the newest pass started before another run at this head was posted, so there is no single newest generation to trust. The gate refuses rather than picking one."
869
889
  say ''
870
890
  say '${CORRECTIVE_LINE}'
871
891
  ;;