Settings that did nothing: placebo toggles from building with an AI agent
You change the compression level from Fast to Best, make a ZIP, and the file comes out byte-for-byte the same size. Nothing errors. The setting saved and is still on Best when you reopen the sheet. It just doesn’t do anything.
In the last week of May, three settings like this turned up in Purrchiver, along with two related bugs that were worse. I’m building Purrchiver mostly with an AI coding agent, and the agent wrote the code that contained them. No test ever failed because of any of them. This post is about why the suite stayed green, and the kind of test that would have gone red.
The placebos
Compression level. The Create Archive sheet showed a level picker for every format. Presets saved the value. Then the function that turns the user’s choice into an archive format dropped it, and the archive writer had no level parameter at all. Every format compressed at its default.
Symbolic links on compress. Settings offered Store, Follow, and Skip. The
compressor never read the setting. It checked fileExists, which follows
links, so all three options behaved like Follow. Fixing it also exposed a
latent mismatch: the entry’s size came from the link itself while its bytes
came from the target, which shows up as libarchive’s archive_write_data wrote zero bytes.
Strip macOS metadata. A ZIP toggle to drop ._* files and __MACOSX
folders. It was shown and persisted, and never passed to the compressor.
Hidden files. This one wasn’t a toggle. The folder walk used
.skipsHiddenFiles, which silently omitted every dotfile from every
compressed folder: .gitignore, .env, .editorconfig, all of them. The
fix removed that option. Real dotfiles are archived now, and only macOS
metadata is stripped, and only when you ask.
7z header encryption. The sheet said “AES-256 + header encryption” and promised that encryption hides 7z filenames. The mapping from the UI’s choice to the engine’s format picked the content-only variant. The contents were encrypted, but anyone could list the filenames without the password. The engine already supported header encryption. One line chose the wrong case.
Why green tests didn’t help
The placebos and the 7z bug had the same shape. A UI control writes a value. The engine has (or should have) a parameter. Between the two sit one to three call sites (the Create sheet, the compress coordinator, the Shortcuts action), and the value got lost there.
The tests that existed checked pieces in isolation. The engine was tested by calling it directly with whatever parameters it had. For some of these settings it had no parameter at all, and nothing noticed. The compress UI tests only opened the Create sheet. They never created an archive and looked at what came out. A test of the engine alone can’t catch a value that never reaches it, and nothing tested the path between the two.
In my experience, an agent is very good at producing each end: a well-labeled control backed by a stored setting, and a clean engine API with its own unit tests. Each looks finished when you review it. A diff-by-diff review doesn’t show you that something isn’t being read.
No failing test caught any of these. Audits did: the compression level turned up while I was following up a performance-audit finding, the other placebos in audit passes a few days later, and the 7z filename leak in a pre-release audit. The tests came with the fixes, aimed at exactly this gap, so they’re the prevention for next time, not the detection this time.
Wiring tests
A wiring test sets the option at the outermost layer the test can reach, runs the real operation, and checks the output.
@Test func coordinatorForwardsStripFlag() async throws {
let root = try makeFolder(["keep.txt", "__MACOSX/junk"])
let out = tmp.appending(path: "out.zip")
try await CompressCoordinator.perform(
source: root, format: .zip, output: out,
stripMacOSMetadata: true // the setting under test
)
let paths = try await Archive(opening: out).allEntries().map(\.path)
#expect(!paths.contains { $0.contains("__MACOSX") })
#expect(paths.contains { $0.hasSuffix("keep.txt") })
}The compress coordinator and the Shortcuts action each got one, with the setting on and with it off. At the engine level, symlinks get one test per policy, and each must produce a different archive: Store writes a link entry, Follow writes a file, Skip writes nothing.
The compression-level test checks for a difference rather than a direction. For each of the eleven formats that take a level, level 1 and level 9 must produce different output. Where higher should strictly mean smaller (the deflate family and lz4), it also checks that. LZMA-family formats and bzip2 don’t reliably shrink at higher levels on a 1 MiB test input, so for those the test only requires the output to differ. “The setting changes the output” is the property a placebo violates.
Driving the real UI
The Create sheet was the one call site a unit test couldn’t reach, because it resolves settings inside a SwiftUI view. For a couple of days it was verified by hand. On May 30 I added an end-to-end harness. A UI test drives a real archive creation through the sheet. Only the save panel is bypassed. Everything else (format, encryption, password, level, split, metadata) runs for real. Then the app reopens the archive it just wrote and reports to the test what’s actually inside: each entry’s name, size, and hash, whether the contents are encrypted, and whether the names are readable without the password.
The 7z test checks the format by magic bytes, not the file extension, so it proves the picker drives the engine. It also asserts that filenames are hidden without the password. When I wrote it, the 7z bug was already known, so that one assertion went in as a documented expected failure. The fix landed the same day and turned it into a hard assertion. As a side effect, that test went from 308 seconds to 16, because a no-password probe now fails at the header instead of grinding through the content.
What I do differently now
- A control that doesn’t work yet isn’t shown. Before its engine existed, the “split into volumes” section was visible only in debug builds. That’s the right default for anything else unfinished.
- Every user-visible setting gets a test that changes the output. It has to change something you can check by opening the result, not just a stored value.
- Engine tests and UI-presence tests don’t count as coverage for a setting. The middle is where values get lost.
- When an agent adds a control, I ask where the value is read. “Show me the line that consumes this” is a cheap review question, and it would likely have caught all three placebos.
Working with an agent moves my job from writing the code to deciding what “done” means and making the tests enforce it. These bugs were a gap in that definition, not in the agent’s typing. The fix was to close the gap.