Repository navigation
Conversation
This was referenced Sep 30, 2026
djbclark
force-pushed
the
simulate-json-files
branch
from
September 30, 2026 18:44
8182ea9 to
d5cc2c4
Compare
djbclark
force-pushed
the
simulate-json-packages
branch
from
September 30, 2026 18:44
a1d1175 to
29fce46
Compare
RecordPkgOperationInChroot() wrote the architecture before the version, the reverse of the order its readers expect. Ticket: none Changelog: Title Signed-off-by: Daniel JB Clark <djbclark@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
djbclark
force-pushed
the
simulate-json-files
branch
from
October 9, 2026 03:09
d5cc2c4 to
f8342de
Compare
A recorded removal with a version was only reported when it cancelled a recorded installation of the same version. Ticket: none Changelog: Title Signed-off-by: Daniel JB Clark <djbclark@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…talls DiffPkgOperations() compared the versions of two recorded installations of the same package without checking that both were set, which PkgVersionIsGreater() asserts. The diff report now keeps the record the way the manifest report does: a versioned record over an unversioned one, otherwise the higher version, otherwise the first one recorded. Ticket: none Changelog: Title Signed-off-by: Daniel JB Clark <djbclark@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
With --simulate-json=FILE, cf-agent also writes the files and renames of a --simulate run to FILE as one JSON document, together with whether the run fell back to the failsafe policy or was aborted. Under manifest-full the JSON lists only the changed files, not the kept ones. Ticket: none Changelog: Title Signed-off-by: Daniel JB Clark <djbclark@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PkgOperationRecord now stores the package fields and the simulate modes format their messages when printing, so that the reduction can be reused by other renderers. Ticket: none Changelog: None Signed-off-by: Daniel JB Clark <djbclark@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
djbclark
force-pushed
the
simulate-json-packages
branch
2 times, most recently
from
October 9, 2026 04:20
15d4380 to
312c466
Compare
The "packages" array lists each package that a --simulate run would install or remove, with its version and architecture when known. It always carries that install/remove reduction, under --simulate=manifest as well. Ticket: none Changelog: Title Signed-off-by: Daniel JB Clark <djbclark@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
djbclark
force-pushed
the
simulate-json-packages
branch
from
October 9, 2026 04:50
312c466 to
e00b899
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fork-internal PR for CI; not an upstream submission. PR 2 of the three-PR plan on #3, stacked on PR 1 (#40, base
simulate-json-files); the first four commits are #39, #44, #45 and #40 as pushed. Two commits of its own: a refactor that makes the package records store the package fields instead of a formatted message, so the existing install/remove reduction can feed more than one renderer, and the feature, which adds apackagesarray to the--simulate-jsondocument. Each entry hasoperation(installorremove),name, andversionandarchitecturewhen the policy named them. The array always carries the install/remove reduction, under--simulate=manifestas well. Unit tests: 21, all passing; the acceptance test records a real package operation through a fake package module shipped beside the policy. Adversary security review: three Low findings, none blocking; the one in this PR's own test fixture (an unquoted command substitution insimulate_json.cf.module) is fixed, and the two in pre-existing upstream code (the CSV op code is checked only by asserts; thename-_-archmap key is not injective) are recorded for a fork follow-up, not changed here.ELI5 — auditable without C
You know shell and a little Python. Two facts.
What the code is for.
cf-agent --simulatedoesn't install or remove packages. It writes one CSV line per package action it would take,op,name,version,architecture, and at the end reduces that log to the net result: a package installed and then removed in the same run is no change, a newer version replaces an older one, and so on. Until now that net result was only printed as prose.--simulate-json=<file>(PR 1) writes the file changes as JSON; this PR adds the packages to the same document.Fact 1: the refactor changes no output. Before, each surviving record stored the finished sentence (
Package 'foo [1.0]' would be installed). Now it stores the three fields and the sentence is formatted when printed:The reduction rules are untouched; the five unit tests from #39, #44 and #45 that read the printed sentences still pass unchanged.
Fact 2: the JSON is the same reduction. The
packagesarray is built from the same two maps the prose uses, then sorted by name and architecture so the order is stable:versionandarchitectureare present only when known; empty strings are never written.How you'd catch me lying, without reading C. The unit test feeds 15 small CSV logs through the JSON writer and checks each one's net result, including the corner cases: an install cancelled by a matching removal, a removal of another version that keeps the install, a second unversioned removal that keeps the versioned one,
latestbeating any version, and a malformed line being skipped. A second test checks the sort order over three records. The acceptance test29_simulate_mode/simulate_json.cfruns a real--simulate=manifestwith a one-package policy and a fake package module (simulate_json.cf.module) and diffs the whole JSON document, packages included, againstsimulate_json.cf.expected.🤖 Generated with Claude Code