@mandateops/cli-darwin-arm64 0.7.1 → 0.7.2
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 +8 -2
- package/audit-lab/bin/mandateops +0 -0
- package/audit-lab/contracts/test-provider.md +1 -1
- package/audit-lab/lab/examples/agents/codeloc.cjs +1 -1
- package/audit-lab/lab/examples/agents/python/mandateops_codeloc.py +1 -1
- package/audit-lab/lab/examples/test-provider/src/codeloc.ts +1 -1
- package/audit-lab/lab/scripts/compose-down.sh +5 -0
- package/audit-lab/lab/scripts/compose-lib.sh +31 -0
- package/package.json +1 -1
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
|
-
|
|
116
|
+
name,
|
|
114
117
|
async () => {
|
|
115
|
-
const result = await auditRun(
|
|
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),
|
package/audit-lab/bin/mandateops
CHANGED
|
Binary file
|
|
@@ -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: `
|
|
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
|
|
@@ -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