Skip to content

fix(build-snapshot): check_lease_support logs once on success, with its duration - #824

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/i721-lease-check-log
Nov 16, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/i721-lease-check-log

Conversation

@webchang

Copy link
Copy Markdown
Member

Closes #721

What changed and why

  • check_lease_support in deploy/microvm/build-snapshot.sh printed only when the check failed, so a build log could not show that it ran, or how close it came to its guest_client -timeout-s 60 on a large rootfs.
  • It now logs one line on success, through the script's log, naming the checks run and the seconds taken:
    • build-snapshot.sh: lease-v1 and lease-processes-v1 check ok in N s (guest_client -timeout-s 60) on Firecracker;
    • build-snapshot.sh: lease-v1 check ok in N s (…) on Cloud Hypervisor, which asks only lease-v1.
  • The time is bash's SECONDS, whole seconds, measured around the one guest request and its parsing. Nothing else changes: the same request, the same failures and messages, and no new output on a failure.

Tests

  • deploy/microvm/tests/build-snapshot.test.sh:
    • a new static check that the function logs the line once;
    • a new run check that a passing Firecracker guest prints it, with a number of seconds;
    • the three harnesses that run check_lease_support on its own now load the script's one-line log() as well. Without it, the success path calls whatever log is on the PATH (on macOS, /usr/bin/log, which exits 64).
  • The suite passes under bash 5 and macOS's /bin/bash 3.2. shellcheck -S warning (shellcheck-py 0.10.0.1, the pre-commit pin) is clean on both files, and pre-commit passes.

Every commit is signed off (DCO).

Assisted-By: Claude Code

…ts duration

The lease check printed only on failure, so a build log could not show that it ran, or how
close it came to guest_client's -timeout-s 60 on a large rootfs. It now logs one line on
success naming the checks run (lease-v1, plus lease-processes-v1 on Firecracker) and the
seconds taken. The tests load the script's log() into the harnesses that run the function,
and check the line both in the function's text and in a passing run's output.

Closes rossoctl#721

Assisted-By: Claude Code
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 16, 2026

@clawgenti clawgenti left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Clean, well-scoped fix for #721: check_lease_support now logs one success line through the script's log(), naming the checks run (lease-v1, plus lease-processes-v1 on Firecracker) and the whole seconds taken against guest_client -timeout-s 60. Failure paths and the guest request are unchanged. The three harnesses that run the function on its own now load log() too, so the success path no longer falls through to a log on the PATH. Two optional test nits are below. Nothing blocks merge.

Author: webchang (MEMBER — maintainer)
Areas reviewed: Shell, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (deploy-scripts, deploy-scripts-bash32, shellcheck, lint, check, and the rest)

$tracked_line
$grp_line
")" "0"
check "lease support: a pass logs the checks and their duration (#721)" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: only the Firecracker label is asserted. The chv-ok run (ls_harness "$LT/chv-ok" … cloud-hypervisor) already writes $LT/chv-ok/out, so one more check could pin the Cloud Hypervisor line, e.g. grep -cE '^build-snapshot.sh: lease-v1 check ok in [0-9]+ s ' = 1, and make sure it does not say lease-processes-v1. That covers the checks= default branch.

mkdir -p "$LT/fail/stage"; printf '#!/bin/sh\necho "guest_client: dial: refused" >&2\nexit 1\n' >"$LT/fail/stage/guest_client"
chmod 0755 "$LT/fail/stage/guest_client"
{ echo "STAGE='$LT/fail/stage'"; fn_body sbx_tracked_passwd; fn_body check_lease_support; echo 'check_lease_support /uds'; } >"$LT/fail/run.sh"
{ echo "STAGE='$LT/fail/stage'"; grep '^log() ' "$SCRIPT"; fn_body sbx_tracked_passwd; fn_body check_lease_support; echo 'check_lease_support /uds'; } >"$LT/fail/run.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the PR says a failure prints no new output. A one-line check here would lock that in: grep -c 'check ok' "$LT/fail/out" = 0.

@pdettori
pdettori merged commit 5af33dd into rossoctl:main Nov 16, 2026
16 checks passed
@pdettori pdettori added this to the v0.11.0 milestone Nov 17, 2026
webchang added a commit to webchang/moca that referenced this pull request Nov 17, 2026
Takes upstream main at 1a7f41e (19 merges since 032c8f6): the sandbox
idle lifetime across docs, control plane, clients and deploy (rossoctl#820, rossoctl#837,
rossoctl#842, rossoctl#843), grant redemption (rossoctl#822), the lease-check log line (rossoctl#824),
egress fixes (rossoctl#829, rossoctl#834), the mock wait (rossoctl#828), the deadline timer
(rossoctl#835), the create rollback (rossoctl#832), multi refusals and the rossoctl#363 leftovers
(rossoctl#833, rossoctl#838), the identity near-miss check (rossoctl#827), mocactl login errors
(rossoctl#836), the ghostunnel probes (rossoctl#830), refusal-burst deferral (rossoctl#831), a
sandbox-worker change (rossoctl#841) and the v0.11 doc truth (rossoctl#821).

Conflicts (one):

- deploy/sbx/README.md, the "Optional inputs" table. Upstream (rossoctl#843)
  rewrote the SBX_LIFETIME_DAYS row (the default idle lifetime, at most
  SBX_MAX_LIFETIME_DAYS) and added the SBX_MAX_LIFETIME_DAYS and
  SBX_LOWER_WORKSPACE_IDLE rows, which widened the table; the fork had
  added an SBX_GATE_RECORD_SCHEMA row at its end. Resolved by taking
  upstream's table whole and appending the fork's SBX_GATE_RECORD_SCHEMA
  row after SBX_PROFILE, then re-padding the table with prettier. The
  fork's env-file example line for SBX_GATE_RECORD_SCHEMA merged cleanly.

Merged without markers, checked: setup.sh keeps the fork's
SBX_GATE_RECORD_SCHEMA validation and its sbx-settings write (so it stays
in the settings hash) beside upstream's SH_SANDBOX_MAX_LIFETIME_SECONDS;
both ocp-sbx and ocp-combined patch-control-plane.yaml keep the optional
SH_GATE_RECORD_SCHEMA from sbx-settings beside the new optional
SH_SANDBOX_MAX_LIFETIME_SECONDS; setup.test.sh keeps the fork's cases
beside upstream's. The fork's RUNBOOK, README and template-onboarding
docs say nothing about sandbox lifetime, refusal bursts, login errors or
the create rollback, so none needed a correction; GUIDE.md is unchanged
and GUIDE.pdf is not regenerated.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build-snapshot.sh: check_lease_support logs nothing on success

4 participants