|
AWK Minifier
Conservative AWK source minification
|
Accepted
The inherited template documents Bash with bash-doxygen and tests Bash artifacts primarily with Bats. AWK Minifier needs a different evidence model. Its most important risks are semantic transformation errors, interpreter portability, ambiguous lexical context, and divergence among modular source and assembled artifacts.
The shared coding_standards repository defines the AWK documentation convention, and the awk-doxygen project provides the corresponding Doxygen input filter. The awk-doxygen repository also demonstrates a lightweight shell harness parameterized by AWK_BIN, which is a better fit for running the same corpus against multiple AWK implementations than retaining Bats as the product's primary behavior layer.
Maintained AWK source SHALL follow the imported AWK documentation standard from coding_standards. Doxygen reference generation SHALL use the pinned awk-doxygen filter prepared through bashdeps.
The product's primary test harness SHALL be shell-based and SHALL support selecting the interpreter through AWK_BIN. The harness SHALL exercise, at minimum:
awk -f arguments;dist/awk-minifier.dev.awk;dist/awk-minifier.awk; anddist/awk-minifier.min.awk.The core corpus SHALL combine several evidence types:
minify(minify(source)) is expected to equal minify(source) without weakening safety to obtain the property;Candidate self-minification SHALL be test-only. The harness MAY minify the current candidate with itself and execute the result as dogfooding evidence, but this test surface does not alter ADR-019's production provenance rule.
CI SHOULD exercise multiple interpreters, including GNU awk and mawk, and SHOULD add BusyBox awk and a BSD/macOS AWK implementation where the runner makes that practical. Additional One True Awk/nawk coverage is encouraged when it can be installed reproducibly.
make docs SHALL consume already-prepared awk-doxygen and adrctl artifacts, generate the ephemeral ADR landing page, and invoke Doxygen without synchronizing dependencies. Generated reference documentation remains ignored state.
A post-release canary SHOULD download the exact published AWK artifacts and their checksums, verify those bytes, and execute smoke/behavior tests against the release assets rather than substituting a tag checkout.
AWK_BIN.Rejected as the primary layer because the central matrix dimension is the AWK interpreter and the tests are naturally expressed as source/fixture/output comparisons. Bats may still be used for repository-level shell orchestration if a specific test benefits from it.
Rejected because assembly, ordinary-artifact processing, bootstrap copying, and future previous-release minification can each introduce divergence.
Rejected because many safe textual outputs may be semantically equivalent while a plausible-looking exact output can still change behavior on a fixture not represented by that golden case.
Rejected because GNU extensions or implementation-specific behavior could enter the code unnoticed and violate the portable AWK baseline.
The existing Bats product tests and bash-doxygen configuration will be replaced or reduced to only those repository-level concerns that still apply. Test fixture volume grows substantially because safety depends on covering lexical and grammar boundaries explicitly.
CI takes longer than a single-interpreter smoke suite, but failures provide much stronger evidence about the product's actual portability and semantic contract.
This ADR supersedes ADR-007's Bash-specific source documentation standard with the shared AWK documentation standard and awk-doxygen filter.
This ADR supersedes ADR-009's requirement that Bats be the default product behavior framework while preserving its stronger invariant that every shipped artifact receives the same observable behavior suite.
This ADR refines ADR-010 and ADR-017 by replacing the Bash source-code filter with awk-doxygen while preserving ephemeral generated documentation and offline ADR navigation generation.