@mandateops/cli-linux-x64 0.7.1 → 0.7.3

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.
package/README.md CHANGED
@@ -109,10 +109,16 @@ async function retryAfterLostResponse({ app, faults, provider }: Fixture) {
109
109
  await submit(app);
110
110
  }
111
111
 
112
+ // The test's name is also the run's label on the dashboard.
113
+ const name = "a retry after a lost response makes one payout";
114
+
112
115
  test(
113
- "a retry after a lost response makes one payout",
116
+ name,
114
117
  async () => {
115
- const result = await auditRun(config, retryAfterLostResponse);
118
+ const result = await auditRun(
119
+ { ...config, label: name },
120
+ retryAfterLostResponse,
121
+ );
116
122
  expect(result.ci_passed).toBe(true);
117
123
  },
118
124
  runLimit(config),
Binary file
@@ -2,7 +2,7 @@
2
2
 
3
3
  What an `@mandateops/audit` config may say, what the host does with each value, and what a result
4
4
  claims. The SDK types, the host's validation and the dashboard all follow this document. Session
5
- protocol 7.
5
+ protocol 8.
6
6
 
7
7
  ## Principles
8
8
 
@@ -118,6 +118,14 @@ one-entry list; there is no other form.
118
118
 
119
119
  ## Result
120
120
 
121
+ The sealed decision and exported record carry one `scope`: each check that was settled, plus any
122
+ required check whose evidence is missing, with its `passed`, `failed` or `evidence_missing` result,
123
+ and the checks left `not_checked`. Optional observations do not establish a check unless its
124
+ properties were judged. CI still uses the declared required checks; recording an optional result
125
+ does not change that policy. The dashboard displays this scope rather than reconstructing it from
126
+ the financial profile or independently inspecting properties. `selected_checks` is the coarse
127
+ assurance for a subset that none of the full-profile assurance codes describes.
128
+
121
129
  The host computes one headline from the sealed record, and the CLI, the SDK and the dashboard show
122
130
  the same text. It leads with the verdict and keeps the scope on the same line, then lists what was
123
131
  not checked and the resolved run parameters:
@@ -25,7 +25,7 @@ Change only by agreement of both sides.
25
25
  A backend preload may add `x-mandateops-call: <lower-case UUID v4>` to a
26
26
  payment request. The provider removes the header in its first request hook,
27
27
  before authentication, key reading or any record sees it, and logs one line per
28
- payment request: `mandateops-provider-call {"call":<id or null>,"effect":<effect id or null>}`.
28
+ payment request: `mo-call {"call":<id or null>,"effect":<effect id or null>}`.
29
29
  A malformed value is dropped and logged as `null`. The header is never sent to
30
30
  any other host: this provider is the end of the lab's provider path. The CLI
31
31
  joins these lines to the preloads' stack lines by id alone (never by time or
@@ -12,7 +12,7 @@
12
12
  "use strict";
13
13
 
14
14
  const HEADER = "x-mandateops-call";
15
- const LINE_PREFIX = "mandateops-codeloc ";
15
+ const LINE_PREFIX = "mo-loc ";
16
16
  const MAX_FRAMES = 8;
17
17
  const MAX_FUNCTION = 120;
18
18
  const MAX_PATH = 300;
@@ -23,7 +23,7 @@ import traceback
23
23
  import uuid
24
24
 
25
25
  HEADER = "x-mandateops-call"
26
- LINE_PREFIX = "mandateops-codeloc "
26
+ LINE_PREFIX = "mo-loc "
27
27
  MAX_FRAMES = 8
28
28
  MAX_FUNCTION = 120
29
29
  MAX_PATH = 300
@@ -8,7 +8,7 @@
8
8
  * on to another host.
9
9
  */
10
10
  export const CALL_HEADER = "x-mandateops-call";
11
- const LINE_PREFIX = "mandateops-provider-call ";
11
+ const LINE_PREFIX = "mo-call ";
12
12
  const CALL_ID =
13
13
  /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
14
14
 
@@ -58,6 +58,11 @@ if [[ -z "${MANDATEOPS_SKIP_LOGS:-}" ]]; then
58
58
  if secret_values="$(lab_secret_values)"; then exact=1; else secret_values=""; fi
59
59
  lab_capture_logs "$secret_values" lab_compose || { failed=1; exact=""; }
60
60
  lab_capture_logs "$secret_values" sut_compose_named || { failed=1; exact=""; }
61
+ : > "$run_dir/health.log"
62
+ lab_capture_health "$secret_values" lab_compose || { failed=1; exact=""; }
63
+ lab_capture_health "$secret_values" sut_compose_named || { failed=1; exact=""; }
64
+ # 65536 is MAX_HEALTH_BYTES in apps/mandateops-cli/src/startup_cause.rs.
65
+ lab_cap_health 65536 || { failed=1; exact=""; }
61
66
  unset secret_values
62
67
  [[ -z "$exact" ]] || : > "$exact_mark"
63
68
  {
@@ -565,6 +565,8 @@ lab_secret_values() {
565
565
  # The deployment file part is written as NAME='"'"'value'"'"'.
566
566
  if (FILENAME != "-" && value ~ /^'"'"'.*'"'"'$/) value = substr(value, 2, length(value) - 2)
567
567
  if (value == "") next
568
+ # The 8 is REDACTED_FROM_CHARS in apps/mandateops-cli/src/codeloc.rs:
569
+ # the code-location markers stay shorter so they are never replaced.
568
570
  if (length(value) >= 8 || index(credentials, " " name " ") > 0) print length(value) "\t" value
569
571
  }' - "$customer_env" | LC_ALL=C sort -t $'\t' -k1,1nr -k2 -u | cut -f2-)" || return 1
570
572
  (($(printf '%s\n' "$values" | wc -l) <= 4096)) || return 1
@@ -609,6 +611,35 @@ lab_redact() {
609
611
  }' 3< <(printf '%s\n' "${1:-}")
610
612
  }
611
613
 
614
+ # Appends, for each container of the project command "$2..." whose health
615
+ # check failed or never passed, one record per check Docker kept to
616
+ # $run_dir/health.log: \x1d service \x1f exit code \x1f output \x1e. The
617
+ # raw output is redacted of the lab's secrets and each line of $1 before
618
+ # anything encodes it, so no escaping can hide a value from lab_redact. A
619
+ # container removed between listing and inspecting adds nothing. A check
620
+ # that timed out says so here, which the service's own log cannot.
621
+ lab_capture_health() {
622
+ local values="$1" ids id
623
+ shift
624
+ ids="$("$@" ps --all --quiet)" || return 1
625
+ [[ -n "$ids" ]] || return 0
626
+ for id in $ids; do
627
+ docker container inspect --format \
628
+ '{{if .State.Health}}{{if ne .State.Health.Status "healthy"}}{{$service := index .Config.Labels "com.docker.compose.service"}}{{range .State.Health.Log}}{{"\x1d"}}{{$service}}{{"\x1f"}}{{.ExitCode}}{{"\x1f"}}{{.Output}}{{"\x1e"}}{{end}}{{end}}{{end}}' \
629
+ "$id" 2>/dev/null || true
630
+ done | lab_redact "$values" >> "$run_dir/health.log"
631
+ local statuses=("${PIPESTATUS[@]}")
632
+ ((statuses[0] == 0 && statuses[1] == 0))
633
+ }
634
+
635
+ # Keeps the newest $1 bytes of $run_dir/health.log. A record the cut opened
636
+ # mid-way lacks its \x1d start and is skipped by the reader.
637
+ lab_cap_health() {
638
+ local file="$run_dir/health.log"
639
+ [[ -f "$file" ]] || return 0
640
+ tail -c "$1" "$file" > "$file.partial" && mv "$file.partial" "$file"
641
+ }
642
+
612
643
  # Appends the logs of the project command "$2..." to compose.log, redacted
613
644
  # of the lab's secrets and of each line of $1 before they reach the
614
645
  # file, and cut at the deployment's limit, so a noisy container decides
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mandateops/cli-linux-x64",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "The mandateops binary and lab for linux-x64, installed by @mandateops/cli.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://getmandateops.com",