case studies

Selectivity Reduces a Configuration Bundle by Files and Lines

The directory demonstration asks a slightly different question from the single-file example: can the reducer find both the relevant files and the relevant lines within them? The generated bundle starts with a.txt, nested/b.txt and junk.txt. The predicate needs alpha in the first file and omega in the nested file. Extra lines and the third file are unnecessary. It resembles a configuration bundle in shape, while remaining a generated text fixture with a known answer.

One recorded run of Selectivity 0.1.1 in a Linux amd64 container starts with three files totaling 39 bytes. With the per-file line pass enabled, Selectivity finishes with two files totaling 12 bytes. The first contains only alpha followed by a newline, and the second contains only omega followed by a newline. The unused file is gone. The run makes 18 predicate executions with repeats set to 1 and reports no unresolved checks.

Selectivity reduces the directory from three files to two and removes the unused lines, taking 39 bytes to 12

The predicate checks that both required files exist before matching their trigger lines. A missing required file returns uninteresting status, rather than letting a file-open error become an ambiguous result. File removal comes first, followed by line reduction within the remaining files. The engine repeats those passes until an entire loop makes no further change, then checks the accepted input again.

This ordering is useful because the two levels can interact. A line deletion might make a previously necessary file removable, so a single one-way pass would leave work undone. In this fixture, the final result is checked against the expected contents of both files and the absence of junk.txt. The saved audit distinguishes file-removal checks from each file’s line-reduction checks.

The example uses ordinary text files, rather than parsing a real configuration language. Selectivity retains the directory tree and treats files and lines as its units; it does not rewrite references between configuration documents or preserve syntactic validity automatically. Those conditions belong in the predicate. The demonstration is included in the repository’s scripts/demo.sh, and the quick start shows how to substitute a command that recognizes your own configuration failure.