mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Add cli/contributing/changelog/archive: a CLI that trims CHANGELOG.md
to the last N entries (default 7) and writes every older release to
its own file under docs/changelog/ named <padded-semver>-<date>.md
(7.0.0 → 007.000.000-2026-05-08.md). The padded form makes a directory
listing already chronological, and the index in CHANGELOG.md is
rebuilt from the archive directory listing on every run, so it never
drifts away from what is on disk. The tool is idempotent and never
overwrites an existing archive file.
Run the migration once to split the 44-entry CHANGELOG.md into 7
inline entries plus 37 archived per-release files, with the index at
the bottom of CHANGELOG.md linking each archive in descending order.
Add docs/contributing/actions/release.md as the contributor-facing
release procedure (versioning, active window vs. archive, cutting a
release end-to-end, CI hand-off on tag push) and add a docs README
under docs/changelog/ that explains the archive directory layout and
filename schema. Cross-link release.md from pipeline.md and add
"releases" to the actions/ scope description.
Documentation cleanup pass on every page touched in the previous
mapping refactor:
- Remove "is the SPOT for X" / "Single Point of Truth" self-labels
across docs/contributing/, docs/agents/, and docs/changelog/. The
rule in documentation.md forbids self-declared SPOT status; status
is conferred by readers cross-linking, not by the page asserting
it. Rephrase to descriptive phrasing ("This page covers X",
"describes X", "lists X") throughout.
- Drop the orphaned docs/contributing/tools/actions.md duplicate
(101 lines paralleling tools/github/actions/workflows.md, with no
inbound links).
- Fix em-dashes used as thought breaks in dockerfile.md, origin.md,
agents/style.css.md, and suppression.md per documentation.md.
- Unwrap soft-wrapped sentences in iam/common.md, iam/ldap.md,
iam/oidc.md, image/origin.md, requirements.md, and dockerfile.md
so each logical line carries one full sentence.
Add a unit test for the archive CLI under
tests/unit/cli/contributing/changelog/archive/test_main.py covering
_pad_version, _split_into_entries, idempotency, dry-run, no-overwrite
of existing archives, and the multi-run index rebuild.
Quote `# noqa:` in CHANGELOG.md prose with backticks so the
noqa-only-ruff-codes lint does not parse "for" as a non-ruff code.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Integration Tests 🔗
This page covers integration testing requirements, framework, and structure.
Run integration tests with make test-integration.
Framework 🧰
- You MUST use Python
unittestas the test framework. - Tests that verify real runtime component interactions MUST live under
tests/integration/. - Tests that statically analyze Ansible config or task YAML files without exercising runtime boundaries MUST live under
tests/lint/ansible/instead.
When to Write ✍️
- You MUST add or update integration tests for every
*.pyfile you touch when the change affects behavior across module or runtime boundaries. - Write an integration test when the behavior you are verifying depends on two or more components working together at runtime. For example, verify a lookup plugin reading from real
group_varsor a filter interacting with an Ansible variable structure. - Write a lint test under
tests/lint/ansible/when the check only inspects static YAML structure, config keys, or comment annotations without executing any code.
Requirements 📋
- You MUST NOT write unit tests for integration test logic. Integration tests verify real runtime boundaries; extracting that logic into unit tests defeats the purpose and duplicates coverage. The integration test itself is the specification.
- You MUST NOT mock collaborators that are part of the integration boundary being tested. The point is to verify real interaction.
- You MUST NOT write tests that only assert a file contains a string.
- You MUST NOT write tests only for non-executable files such as
.ymlor.j2. Test the behavior that consumes them. - You SHOULD keep each test focused on one integration boundary.
- You SHOULD test realistic inputs that match what Ansible would pass at runtime.
- You MAY use
unittest.mockto stub out external services or filesystem state that is genuinely outside the integration scope.
How to Create 🛠️
- Identify the integration boundary (e.g. lookup plugin +
group_varsvariable loading). - Decide whether the test exercises a real runtime interaction (
tests/integration/) or only inspects static YAML structure (tests/lint/ansible/). - Create the matching test file under the correct directory if it does not exist.
- Subclass
unittest.TestCase. - Use realistic inputs. Build hypotheses about cross-component behavior before writing assertions.
- Run
make test-integration(ormake test-lintfor lint tests) and verify all tests pass.
Running Specific Tests 🏃
Use TEST_PATTERN to scope the test run to a single file or a glob:
# Run a single integration test file
make test-integration TEST_PATTERN=test_my_module.py
# Run all files matching a prefix
make test-integration TEST_PATTERN=test_applications*.py