|
bashdeps
Exact dependency materialization and manifest maintenance tools
|
Accepted
This ADR defines the development orchestration and test strategy used to verify bashdeps' public behavior and generated artifacts.
Bashdeps manipulates supply-chain inputs and filesystem state. Tests therefore need to cover more than happy-path command dispatch: parser strictness, digest identity, downloader selection, offline verification, staging, failure before publication, path safety, and generated artifact equivalence are all observable contracts.
The project follows the same documentation-driven, test-second discipline used by mktext: architecture and public behavior are documented first, implementation realizes that behavior, and automated tests verify the resulting contract.
Make SHALL be the canonical development orchestration interface.
The project SHALL provide at least these targets:
make all SHALL perform build only. It SHALL NOT implicitly run static analysis or behavior tests.
make test SHALL run the public behavior suite against:
src/bashdeps.bash;dist/bashdeps.dev.bash;dist/bashdeps.bash.Generated-artifact tests SHALL depend on make build and SHALL additionally verify expected artifact properties such as shebang, executable mode, embedded metadata, and checksum-file consistency.
Bats SHALL be the primary behavior-test framework.
Ordinary behavior tests SHALL NOT depend on live public network services.
Tests SHALL use temporary project directories and controlled fixture bytes. Downloader behavior SHOULD be exercised through PATH-injected fake curl and wget commands that record arguments and produce deterministic fixture output. This allows tests to verify backend selection, fallback, failure mapping, and staging behavior independent of the host's installed tools.
Hash-backend selection SHOULD likewise be testable with PATH-controlled fixtures or narrowly scoped adapter tests.
The test suite SHALL include cases for:
\ continuation markers;= only;= characters, including in folded records;\, failing closed;ADR-015 defines physical-line folding as a manifest preprocessing step. Tests SHALL exercise folding through the public CLI rather than freezing a particular private parser-helper decomposition.
make check SHALL perform Bash syntax validation on maintained executable test helpers and source.
ShellCheck SHALL run against maintained production source only:
Test helpers and Bats test code SHALL NOT be ShellCheck inputs. Test code is validated through Bash syntax checks where applicable and through the behavior suite itself.
make format SHALL apply the repository's canonical shfmt configuration to maintained shell source and executable test helpers.
Generated dist/ artifacts SHALL be validated for syntax and behavior but SHALL not be formatted or edited as maintained source.
A bug fix SHOULD include a regression test that demonstrates the formerly broken observable behavior.
A behavioral change is normally incomplete until its governing documentation and public tests agree.
This would miss defects introduced by metadata injection or comment removal. Generated artifacts are shipped products and require independent execution.
Live tests provide realism but introduce network availability, rate limits, upstream changes, and nondeterminism. Network-client behavior is better tested through controlled adapters; optional integration tests can be added separately.
Some narrow adapter tests may justify direct helper invocation, but broad testing of helper names would freeze implementation structure unnecessarily. Public CLI behavior remains the primary contract.
The suite will contain more fixture infrastructure than a typical tiny Bash script, but it will be able to test failure behavior deterministically without reaching the public Internet.
Changing the internal downloader implementation remains possible as long as the public behavior and adapter contract continue to pass.
The build transformation is continuously checked for semantic equivalence rather than trusted by inspection alone.
The parser may gain a dedicated physical-line assembly helper or may fold records inside existing manifest-loading logic; tests intentionally constrain observable folding semantics rather than that internal structure.
Optional end-to-end tests against real HTTPS services may be introduced later as non-required CI coverage. They SHALL NOT become the only evidence for ordinary acquisition behavior.