8000 fix(minimal): a min bug bundle records the minzoned version, hashes, service state and log on macOS by minimal-foundry[bot] · Pull Request #3484 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal): a min bug bundle records the minzoned version, hashes, service state and log on macOS - #3484

Merged
norrietaylor merged 11 commits into
mainfrom
agent/3478-a-min-bug-bundle-records-the-minzoned-version-ha
Nov 17, 2026
Merged

norrietaylor merged 11 commits into
mainfrom
agent/3478-a-min-bug-bundle-records-the-minzoned-version-ha

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

Defect

Fixes #3478

  • Epic: none; not charged to an epic
  • Size: M; estimated 260 code, 120 tests
  • May touch:
    • crates/minimal/src/diag/answerer.rs
    • crates/minimal/src/diag/mod.rs
    • crates/minimal/src/diag/collect.rs
    • crates/minimal/src/resolver.rs
    • crates/minimal/tests/bug.rs
    • docs/specs/10-spec-diagnostics/10-spec-diagnostics.md
Task marker
### D3476 — A min bug bundle records the minzoned version, hashes, service state and log on macOS and Linux
  kind: task
  size: M
  est: 260 code, 120 tests
  executor: agent
  defect: bug
  layers:
    - bundle:
      - crates/minimal/src/diag/answerer.rs (new): collects host/answerer.json (minzoned --version and SHA-256 of the installed and shipped copies), launchctl print or systemctl status, and journalctl for the bundle window
      - crates/minimal/src/diag/mod.rs: declares the answerer module and runs its collector with collect_step! beside host.system
      - crates/minimal/src/diag/collect.rs: adds minzoned.log as a Host log prefix so the logs collector takes it from <state>/logs
      - crates/minimal/src/resolver.rs: sets StandardOutPath and StandardErrorPath in ANSWERER_PLIST_TEMPLATE to the operator's logs/minzoned.log, and exposes the program paths and sha256_of to diag
      - crates/minimal/tests/bug.rs: asserts the bundle holds the answerer version, hashes and service-state entries, or a skip that says why
      test: cargo test -p minimal --test bug the_answerer_service_is_described
      test: cargo test -p minimal answerer_plist_sets_a_log_path
    - spec:
      - docs/specs/10-spec-diagnostics/10-spec-diagnostics.md: adds a requirement for the answerer version, hashes, service state and log entries in the host bundle
      test: cargo test -p minimal --test bug the_answerer_service_is_described
  proof: On a macOS host where dev.gominimal.zone exits 1, the min bug bundle shows the minzoned version, both SHA-256 hashes, the launchctl print output and the minzoned log lines.

Proof

A min bug bundle now holds host/answerer.json with minzoned --version and the SHA-256 of the installed copy and of the copy beside min or on PATH. It also holds host/answerer-service.txt with the launchctl print system/dev.gominimal.zone transcript on macOS, or the systemctl status transcript on Linux, and on Linux host/answerer-journal.txt with the last 24 hours of the minzoned units' journal. The launchd plist now sets StandardOutPath and StandardErrorPath to /logs/minzoned.log, and the bundle's logs/ collector takes minzoned.log*. A host where dev.gominimal.zone exits 1 therefore shows its version, both hashes, the launchctl print output and the minzoned log lines. This was verified on Linux only. The macOS path compiles under cfg but was not run on a Mac.

Notes from the agent: The macOS branch (launchctl print, plist log path on a real launchd) was not exercised: this box is Linux. The log path takes effect only after the answerer step re-installs the plist (min finalize-install), so a host with the old plist has no minzoned.log until then. The journal window is a fixed 24 hours (-n 1000 cap), because min bug has no explicit bundle window. A third log prefix (minzoned.log, Host locality) changes one collect.rs unit test from a count of 2 to LOG_PREFIXES.len(). The resolver now exposes ANSWERER_LAUNCHD_LABEL, ANSWERER_SYSTEMD_UNIT, answerer_source and sha256_of as pub(crate), and adds ANSWERER_LOG_FILE, answerer_log_path and xml_escape. just lint-prose did not run: vale is not installed on this box. Also ran: cargo test -p minimal --test bug (16 passed) and cargo test -p minimal --lib -- diag:: resolver:: (160 passed).

Tests

line exit tail
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 1 test test the_answerer_service_is_described ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.07s warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning:
cargo test -p minimal answerer_plist_sets_a_log_path 0 running 1 test test resolver::tests::answerer_plist_sets_a_log_path ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 980 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 41 filtered out; finished in 0.00s running 0 t
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 1 test test the_answerer_service_is_described ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.05s warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning:

Verify

min task run agent-verify exited 100, so this PR is a draft.

 {
                "parent_span_id": "509f54d0f61d5e4a",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "fbd63cf94bd54b12",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "fbd63cf94bd54b12",
                "queued_behind": "0",
                "span_id": "d2a44eb18368c78f",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "509f54d0f61d5e4a",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "a76bf7156b69ca8f",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "a76bf7156b69ca8f",
                "queued_behind": "0",
                "span_id": "254150b1474d75df",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "a76bf7156b69ca8f",
                "queued_behind": "0",
                "span_id": "77bc3ce44174ade1",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "77bc3ce44174ade1",
                "span_id": "1052504aa7344ed2",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "77bc3ce44174ade1",
                "queued_behind": "0",
                "span_id": "31ab1fc209acf00c",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [ 111.171s] 1149 tests run: 1148 passed, 1 failed, 2 skipped
        FAIL [  14.417s] (1149/1149) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

Base

The base branch moved while the coder worked; it was merged in before the tests ran.

The bundle gains host/answerer.json (minzoned --version and the SHA-256
of the installed and shipped copies), the launchctl print or systemctl
status transcript, and the service journal off macOS. The launchd unit
now sends the service's output to <state>/logs/minzoned.log, which the
logs collector takes.
@coderabbitai
coderabbitai Bot commented Nov 16, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: df2ce39b-9a1f-4e7e-b42e-cbe1761c7cdd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions
Copy link
Copy Markdown
Contributor

Spec lint

docs/specs/10-spec-diagnostics/10-spec-diagnostics.md — 3 finding(s)

docs/specs/10-spec-diagnostics/10-spec-diagnostics.md:1: F004 frontmatter is missing `owner:`, `epic:`, `arch:`, `updated:`
docs/specs/10-spec-diagnostics/10-spec-diagnostics.md:1: S002 missing 6 required section(s): `## Users and stories`, `## Requirements`, `## Non-goals`, `## Design reasoning`, `## Security considerations`, `## Open questions`
docs/specs/10-spec-diagnostics/10-spec-diagnostics.md:49: S003 12 section(s) are not part of the spec format: `## Introduction/Overview`, `## Goals`, `## User Stories`, `## Porting baseline — reconciling the reference tree with current `main``, `## Demoable Units of Work`, `## Non-Goals`, `## Design Considerations`, `## Repository Standards`, `## Open Questions`, `## Technical Considerations`, `## Security Considerations`, `## Verification`

Advisory. None of this blocks the merge; the review decides.

Advisory, and never a merge gate. Linter: gominimal/foundry@5ffd41cf, spec format: How Minimal Writes Specs.

@norrietaylor
Copy link
Copy Markdown
Member

/revise

Review of head 2d1f568. Fix these. Keep every change inside the plan's six files.

  1. Move the macOS log out of the operator's home.
    • ANSWERER_PLIST_TEMPLATE (resolver.rs about 464-467, answerer_log_path about 3312) points StandardOutPath/StandardErrorPath of the root-loaded dev.gominimal.zone unit at <state>/logs/minzoned.log under $HOME.
    • launchd does not create a missing parent directory. With logs/ absent at boot, for example after the state directory is removed, the job cannot open its output and does not start. That is a new start failure in the service this task exists to diagnose.
    • A path under $HOME also breaks this module's own rule that every path the unit names is root-owned and walked by the custody check.
    • Write the log under a root-owned directory that the install step creates with the plist, for example /Library/Logs/minimal/minzoned.log. Add that directory to the custody walk, remove the log and the directory on --undo, and have min bug collect the file from there, with a skip that says why when it is absent or unreadable.
  2. Do not bake the caller's environment into a machine-global unit. The log path came from the rendering process's XDG_STATE_HOME. A finalize-install run under a temporary state directory then wrote a plist that points at a directory that later disappears. A fixed root-owned path removes this problem. Keep it independent of the caller's environment.
  3. Existing installs must pick up the new plist.
    • The step reads the installed plist only through plist_program_argument and plist_user_name, so an install from before this change reads as current and never gains the log.
    • Re-surface the step when the installed plist names no log path, so min finalize-install --show offers it. When the bundle has no minzoned log, its skip says that the installed service predates logging and names min finalize-install.
  4. Bound the log. It is append-only at info level with no rotation. Cap its size, or rotate it as the other daemon logs are.
  5. Linux journal read. answerer.rs (about 173) passes -q, which hides journalctl's note that the user cannot read system messages. Keep that note, or record in the bundle why the transcript is empty. Bound the window to the bundle's collection time rather than a fixed -24h (about line 34), or say in the spec that it is a fixed 24 h.
  6. Linux skip noise. collect.rs (about 285) adds minzoned.log* as a log prefix on every host, so each Linux bundle carries a permanent "no such files" skip for a file Linux never writes. Add the prefix only on macOS, and change R2.12 in the spec to match.
  7. Tests.
    • the_answerer_service_is_described passes trivially on a CI host that has no service.
    • Add a test with a fixture installed copy, a fixture shipped copy and a fixture service-state transcript, and assert the version, both hashes and the transcript in the bundle.
    • Extend answerer_plist_sets_a_log_path to assert the new root-owned path, and that --undo removes it.

The launchd unit now sends the service's output to
/private/var/log/minimal/minzoned.log, a fixed root-owned path the step
creates, walks for custody, caps hourly, and removes on --undo. A unit
that names no log re-surfaces the step. min bug collects the log as
host/answerer.log, with a skip that says why when it is absent. The
Linux journal read keeps journalctl's notes and ends at the bundle's
creation time, and Linux bundles no longer list minzoned.log.
The log is a fixed root-owned file on macOS, capped hourly, re-offered
to old installs, and removed by --undo (R2.13). The Linux journal
window ends at the bundle's creation time.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a /revise note, pushed as 7fb8deb8e289.

line exit tail
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 3 tests test the_answerer_service_is_described_from_fixtures ... ok test the_answerer_service_is_described_when_its_log_is_absent ... ok test the_answerer_service_is_described ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.04s warning: un
cargo test -p minimal answerer_plist_sets_a_log_path 0 running 1 test test resolver::tests::answerer_plist_sets_a_log_path ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1004 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 41 filtered out; finished in 0.00s running 0
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 3 tests test the_answerer_service_is_described_from_fixtures ... ok test the_answerer_service_is_described_when_its_log_is_absent ... ok test the_answerer_service_is_described ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.03s warning: un

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "8e62f4ef96e22b0c",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "de029907c09fe988",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "de029907c09fe988",
                "queued_behind": "0",
                "span_id": "46f61715d281bc1e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "8e62f4ef96e22b0c",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "d9e8f73eb53fc3eb",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "d9e8f73eb53fc3eb",
                "queued_behind": "0",
                "span_id": "522406a5ef5cd7dd",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "d9e8f73eb53fc3eb",
                "queued_behind": "0",
                "span_id": "14d6df47cb88a4a7",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "14d6df47cb88a4a7",
                "span_id": "8fd91cf2a6c1ee84",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "14d6df47cb88a4a7",
                "queued_behind": "0",
                "span_id": "eb6f754e78118e86",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  78.716s] 1175 tests run: 1174 passed, 1 failed, 2 skipped
        FAIL [  12.906s] (1175/1175) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

Converted to a draft: something above needs a person before review.

On a macOS host where dev.gominimal.zone exits 1, the min bug bundle holds host/answerer.json with the minzoned version and the SHA-256 of the installed and shipped copies, host/answerer-service.txt with the launchctl print output, and host/answerer.log with the tail of /private/var/log/minimal/minzoned.log. When that log is absent, the manifest skip says why, and names min finalize-install for an install that predates the log. The fixture test shows each of these parts with fixture copies, transcripts and a log.

Notes from the agent: Revise round 1, item by item. (1) The log moved to the fixed root-owned /private/var/log/minimal/minzoned.log, not /Library/Logs/minimal. The custody walk refuses any directory with group write. I believe /Library/Logs is root:admin with group write on stock macOS, but I could not check that on this Linux box. /private/var/log is root:wheel 0755. I used /private/var/log and not /var/log, because /var is a symlink. The step creates the directory (root:wheel 0755) and the file (operator, 0644) before it loads the unit. The custody walk covers the directory when the unit names the log. --undo removes the directory. min bug collects the file as host/answerer.log, with a skip that says why. (2) The path is a constant. answerer_log_path and its XDG lookup are removed. (3) AnswererFacts has a new unit_log field, read from the plist's StandardErrorPath. On macOS, a unit that names no log or a different log fails the step's check ('its unit keeps no log at ...'), so --show offers the step again. The bundle skip for that case says the installed service predates its log and names min finalize-install. (4) launchd has no size limit. The service holds the log open while it runs, so a newsyslog rename would not bound it. The step installs a second job instead: /Library/LaunchDaemons/dev.gominimal.zone.logcap.plist. It runs hourly as the operator, and when the log is over 1 MiB it cuts it in place to its last 256 KiB. launchd opens the l…[truncated]

min finalize-install now writes the log size cap plist and
/private/var/log/minimal on macOS. The installer's uninstall advice
must remove them too, and install_test.sh checks that it names every
path the step writes.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a failed check suite, pushed as b260049b614a.

line exit tail
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 3 tests test the_answerer_service_is_described_from_fixtures ... ok test the_answerer_service_is_described_when_its_log_is_absent ... ok test the_answerer_service_is_described ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.03s warning: un
cargo test -p minimal answerer_plist_sets_a_log_path 0 running 1 test test resolver::tests::answerer_plist_sets_a_log_path ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1005 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 41 filtered out; finished in 0.00s running 0
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 3 tests test the_answerer_service_is_described_from_fixtures ... ok test the_answerer_service_is_described_when_its_log_is_absent ... ok test the_answerer_service_is_described ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 1.18s warning: un

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "45e5bb54604f07f0",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "184988d445d07d48",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "184988d445d07d48",
                "queued_behind": "0",
                "span_id": "a14e020244187ee3",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "45e5bb54604f07f0",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "61eafa3010f630c9",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "61eafa3010f630c9",
                "queued_behind": "0",
                "span_id": "7cb4277961f6681e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "61eafa3010f630c9",
                "queued_behind": "0",
                "span_id": "c7e0d8651fdca042",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "c7e0d8651fdca042",
                "span_id": "486d6810ef1c37d0",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "c7e0d8651fdca042",
                "queued_behind": "0",
                "span_id": "7b0d90223ae43780",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  77.591s] 1176 tests run: 1175 passed, 1 failed, 2 skipped
        FAIL [  12.837s] (1176/1176) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

Outside the task's layers::

  • scripts/install.sh

Converted to a draft: something above needs a person before review.

On a macOS host where dev.gominimal.zone exits 1, the min bug bundle shows the minzoned version, both SHA-256 hashes, the launchctl print output and the minzoned log lines. This round also makes the installer's uninstall advice remove the minzoned log, its directory and its size cap unit.

Notes from the agent: The CI tests job failed in common::shell_harnesses. scripts/install_test.sh checks that the installer's uninstall advice names every path constant in crates/minimal/src/resolver.rs. The earlier round added /Library/LaunchDaemons/dev.gominimal.zone.logcap.plist, /private/var/log/minimal and /private/var/log/minimal/minzoned.log, and the advice did not name them. I touched scripts/install.sh, which is outside the task's layers. The fix adds those paths to the macOS removal list, removes the log directory with rm -rf, and boots out dev.gominimal.zone.logcap. This matches what min finalize-install --undo removes. ci-linux-native-success is the lane aggregator and fails only because the tests job failed. On this box, scripts/metrics_test.sh missing_nextest_fails_mutants_mode still fails with exit 127. It removes every PATH directory that holds cargo-nextest, and here that directory also holds other tools it needs. The branch does not change the metrics scripts. Doctests did not run here because rustdoc is not installed on this box. The branch adds no doc code blocks. I did not run cargo test -p minimal --lib unscoped to completion: in-process parallel runs time out on this box, and nextest passes all 1175 tests.

@norrietaylor
norrietaylor marked this pull request as ready for review November 17, 2026 15:49
@norrietaylor
Copy link
Copy Markdown
Member

/revise

Review of head b260049. The seven points of the last directive are addressed. The scripts/install.sh change is accepted: the uninstaller must name the new paths. Keep it, and keep every other change inside the plan's files.

  1. Check the cap unit in the step.
    • The step installs dev.gominimal.zone.logcap (resolver.rs about 3450), but its plist is not among the files the step checks (resolver.rs about 1326-1360), and nothing reads whether the job is loaded.
    • If its bootstrap fails, the step prints only a warning. If its plist is later removed, the step still reads as current. Either way the log grows without a bound and min finalize-install --show reports nothing.
    • Add the logcap plist to the step's custody checks, and treat a missing plist, or one that names other arguments, as a step to run again. A test pins it.
  2. Name min finalize-install only when it has work.
    • answerer.rs (about 316-319) tells the user to "Run min finalize-install to make it again" when the unit names the right log path and the file is missing.
    • In that state every check passes, so the command has nothing to run. Say what is missing and that the service writes the file again when it next starts, or name the command only when the step reads as not current.

@norrietaylor
norrietaylor requested a review from a team as a code owner November 17, 2026 15:50
@minimal-foundry
minimal-foundry Bot commented Nov 17, 2026 •
Copy link
Copy Markdown
Contributor Author

Reviewed: 1 finding, none blocking at 42dbb09af3b2.

Address the comments on the diff.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 17, 2026
The answerer step now reads the dev.gominimal.zone.logcap plist on
macOS. A missing cap plist, one root does not own, or one that runs
other arguments re-surfaces the step. A cap that launchd does not load
is removed, so the next read re-surfaces the step too.

The min bug skip for a missing minzoned.log names min finalize-install
only when its directory is gone. Otherwise it says the service creates
the file when it next starts.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a /revise note, pushed as c574c369efa3.

line exit tail
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 3 tests test the_answerer_service_is_described_from_fixtures ... ok test the_answerer_service_is_described_when_its_log_is_absent ... ok test the_answerer_service_is_described ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.05s warning: un
cargo test -p minimal answerer_plist_sets_a_log_path 0 running 2 tests test resolver::tests::answerer_plist_sets_a_log_path_and_checks_its_cap ... ok test resolver::tests::answerer_plist_sets_a_log_path ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1005 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed;
cargo test -p minimal --test bug the_answerer_service_is_described 0 running 3 tests test the_answerer_service_is_described_from_fixtures ... ok test the_answerer_service_is_described_when_its_log_is_absent ... ok test the_answerer_service_is_described ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.04s warning: un

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "f502162e2feab576",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "ba3c89a7c2c30eaa",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "ba3c89a7c2c30eaa",
                "queued_behind": "0",
                "span_id": "6367ba651490d13f",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "f502162e2feab576",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "d68e5e9d967243bb",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "d68e5e9d967243bb",
                "queued_behind": "0",
                "span_id": "3c53fb5b2cb7e7fb",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "d68e5e9d967243bb",
                "queued_behind": "0",
                "span_id": "86d0bd1c373acbff",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "86d0bd1c373acbff",
                "span_id": "01227ce034e2689d",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "86d0bd1c373acbff",
                "queued_behind": "0",
                "span_id": "9fff841466f4c449",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  87.323s] 1177 tests run: 1176 passed, 1 failed, 2 skipped
        FAIL [  13.157s] (1177/1177) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

Outside the task's layers::

  • scripts/install.sh

Converted to a draft: something above needs a person before review.

On a macOS host where dev.gominimal.zone exits 1, the min bug bundle shows the minzoned version, both SHA-256 hashes, the launchctl print output and the minzoned log lines. If the log is missing, the skip names min finalize-install only when the step has work to do. The step also reads the log cap plist, so min finalize-install --show reports a missing or changed cap.

Notes from the agent: Item 1: the answerer step on macOS now reads /Library/LaunchDaemons/dev.gominimal.zone.logcap.plist (owner and mode, and its ProgramArguments, with the XML escapes undone). A missing plist, one root does not own, or one whose arguments are not /bin/sh -c is a failed check, so the step reads as not current. The check runs only when the main unit exists, the same as the log-path check. The step does not read whether the cap job is loaded. Instead, a failed bootstrap of the cap now removes the cap plist, so the next read fails the check. The warning for that case now ends with 'Run min finalize-install to try again.' Item 2: when the unit names the right log path and the file is missing, the skip now says 'absent: does not exist. The DNS service creates it when it next starts'. When the log's directory is also gone, launchd cannot create the file and the custody walk fails, so the skip names min finalize-install. Only Linux ran the build. The macOS-only code in answerer_step_over and read_answerer_step was not compiled here, and the macOS lane owes that check. The pure checks (answerer_log_cap_check, plist_string_array) are cfg(any(test, macos)) and ran in the Linux tests. I also ran cargo test -p minimal --lib answerer (16 passed) because the step fixtures changed. scripts/install.sh was not touched this round.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 17, 2026 16:15
@minimal-foundry minimal-foundry Bot added the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Nov 17, 2026
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: the diff is +1274/-19 (1293 lines), past 3x the plan's estimate of 380 lines (est: 260 code, 120 tests, as #3478 reads now), at round 3 (the last trigger was a /revise note). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #3478 by hand.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/minimal/src/resolver.rs Resolved
@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Nov 17, 2026
@norrietaylor
norrietaylor marked this pull request as ready for review November 17, 2026 16:24
@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved at c574c36. The log now lives under a root-owned directory the step creates and --undo removes, existing installs are offered the new unit, the cap unit is in the step's checks, and the bundle tests use fixtures. The scripts/install.sh change is accepted: the uninstaller must name the new paths. One low edge case is filed in #3497.

@bryan-minimal bryan-minimal left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Read the whole diff at c574c36, including the last commit, which adds a check on the log's size-cap unit (its owner and the arguments it runs) to the answerer step. The bundle half is good and I'd take it as it is. The other half changes the privileged macOS install, and that part needs a run on a Mac and a clearer title before it merges.

The collector (diag/answerer.rs): fine. Each part that cannot be read becomes a skip that says why, a non-zero exit of launchctl print or systemctl status is kept as the finding, every command is bounded, and the sources are injectable so the test does not depend on the host. Two small notes: the journal read is capped at 1000 lines newest-first inside a 24 hour window, which is right for a restart loop; and minzoned --version is run on the copy found on PATH, which is the caller's own program, so no concern.

The install change is larger than the title says. "A min bug bundle records…" also:

  1. adds a root-owned directory /private/var/log/minimal and a log file owned by the operator;
  2. adds a second LaunchDaemon, dev.gominimal.zone.logcap, that runs a /bin/sh -c script hourly as the operator;
  3. makes the answerer step re-surface for every existing macOS install, because an installed unit that names no log now fails a check, and since the last commit so does a missing or altered size-cap unit. After this merges, every Mac user is offered min finalize-install (a sudo prompt) again, for a diagnostics feature.

Point 3 is a product call and should be in the title or at least the first line of the body. If it is intended, fine; if not, the check could be advisory (the bundle's skip already says "run min finalize-install") and leave the step quiet.

None of the macOS path has run. The PR says so itself ("this box is Linux"). The pure parts are unit-tested, but the things that can go wrong are launchd's: whether a system job with UserName opens StandardOutPath as root or as the user, whether the job starts when the log file's owner and the directory's owner differ, and whether launchctl bootstrap of the cap job works from the step's script. I would not merge a change to the privileged step on reading alone. One min finalize-install, one --undo, and one upgrade from an install made by main, on a real Mac, would settle it.

Smaller points

  • The log is mode 0644 in a world-readable directory, and it is the DNS service's output. On a Mac with more than one user, another user can read it. If the service logs box names, that is one user's box names shown to the others. Is 0640, or 0600, enough for the collector (it runs as the operator)?
  • The cap script copies the tail to a temp file and then writes it back. Lines the service writes between the two commands are lost. Acceptable for a cap, but worth one sentence in the comment, since the reason for the log is a service that fails at start.
  • __OPERATOR__ goes into the new plist without xml_escape, while the script beside it is escaped. The existing unit does the same, so this is consistency only.
  • The draft PRs for the macOS package install (#2975, #2976, #2977) do the same privileged setup from a package. Whichever lands second has to carry the log directory and the cap job too; noting it so it is not lost.

So: approve the collector, and for the install half I'd like the Mac run and a decision on point 3.

🤖 Generated with Claude Code

@norrietaylor
Copy link
Copy Markdown
Member

/revise

Merge origin/main into this branch. crates/minimal/src/resolver.rs conflicts with #3481, which merged at 17:02Z and also reworked the DNS service step. The merge also picks up the RUSTSEC-2026-0543 ignore from #3492, which is the only reason cargo-deny is red here.

Keep both changes:

answerer_step_over must report every one of those states, and the step script must both replace a stale copy and install the log and the cap. Run both PRs' tests. Change nothing else.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise was refused. A person needs to take it from here..

Round 4 of 10 was not counted; #3478 carries the same sentence.

…ed-version-ha

Resolves the conflict in crates/minimal/src/resolver.rs with #3481 (finalize-install
replaces a stale or failing minzoned). Both changes are kept: AnswererFacts carries
the log-cap facts and the SHA-256/job facts, read_answerer_step_with_job reads both,
and answerer_step_over runs the log and log-cap custody checks before the copy-differs
and not-running states.
@norrietaylor
norrietaylor added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit a6dd8c9 Nov 17, 2026
45 of 47 checks passed
@norrietaylor
norrietaylor deleted the agent/3478-a-min-bug-bundle-records-the-minzoned-version-ha branch November 17, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3476 — A min bug bundle records the minzoned version, hashes, service state and log on macOS and Linux

2 participants

0