feat: wire storage backend into attestation generator#143
Conversation
Review: Rebased after #139 merge — tests pass, issues remainRebased onto upstream/main. Git automatically dropped the duplicate storage backends commit (already on main via #139). The PR is now a clean 2-file diff: IssuesBug 1: Storage always runs even when not configured (generator.py:127-138) When # generator.py:127 — should be guarded
try:
from darnit.storage.backends import get_backend
storage = get_backend(storage_config) # Returns FileBackend when NoneFix: wrap the entire storage block with Bug 2: The attestation dict was just serialized via Bug 3: Hardcoded GitHub URL (generator.py:126)
Note on test patching: The tests patch VerdictBug #1 (storage always runs) should be fixed before merge — it creates unwanted side effects for existing callers. Bugs #2 and #3 are minor and can be follow-ups. |
32b2a37 to
b3ee1e0
Compare
…ed scope, add TODO for hardcoded GitHub URL
| storage_ref = storage.store_attestation( | ||
| repo_url=repo_url, | ||
| commit=audit_result.commit, | ||
| attestation=unsigned, |
There was a problem hiding this comment.
So where does the signed attestation end up going?
| storage_config={"backend": "memory"}, | ||
| ) | ||
|
|
||
| mock_logger.info.assert_called_once() |
There was a problem hiding this comment.
This will fail because it logs on file save and logs on storage ref
The generator emits two logger.info calls (file save + storage backend), but the test was asserting only one. Verify the storage backend log is present without requiring it to be the only call. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
LGTM |
Summary
Follow-up to #139 as requested, hooks the storage backend into the attestation generator so it's used in practice, not just a standalone module.
Type of Change
Framework Changes Checklist
uv run python scripts/validate_sync.py --verboseand it passesuv run python scripts/generate_docs.pyand committed any doc changesControl/TOML Changes Checklist
Not applicable — no controls or TOML modified in this PR.
Testing
What was built
Added
storage_configparameter togenerate_attestation_from_results()in the attestation generator. After building the attestation, it callsget_backend(storage_config).store_attestation()before saving to file.Usage
Additional Notes