Skip to content

feat(storage): SecuritySignatureManager – implement RocksDB iteration (v1.8.0 #206) - #4260

Merged
makr-code merged 2 commits into
developfrom
copilot/implement-rocksdb-iteration
Mar 15, 2026
Merged

makr-code merged 2 commits into
developfrom
copilot/implement-rocksdb-iteration

Conversation

Copilot AI commented Mar 15, 2026 •

Copy link
Copy Markdown
Contributor

listAllSignatures() silently returned an empty result when backed by RocksDB (TODO at line 110). verifyAll() did not exist. Both gaps meant integrity checks across all stored records were impossible.

Description

RocksDBWrapper – new iterateRange

void iterateRange(std::string_view start_key, std::string_view end_key, ScanCallback callback);

Direct rocksdb::Iterator under OperationGuard (same thread-safety pattern as scanRange). Callback returning false stops early.

SecuritySignatureManager – iteration + bulk verify

  • makePrefixRange() (private helper) — computes ["security_sig:", "security_sig;"] once; used by both list and verify paths to avoid duplication.
  • listAllSignatures() — replaces the TODO with iterateRange over the prefix range; deserialises each value into SecuritySignature.
  • verifyAll() (new) — iterates all stored signature keys via iterateRange, calls verifyFile per entry, returns VerifyAllResult:
struct VerifyAllResult {
    int total = 0;
    int verified = 0;
    int failed = 0;
    std::vector<std::string> failed_resource_ids;
    bool success() const { return failed == 0; }
};

Both RocksDB and in-memory fallback paths are handled in each method.

Tests & CI

  • 13 focused tests in tests/test_security_signature_rocksdb_iteration.cpp — covers iterateRange bounds, exclusive end key, early termination, value retrieval; listAllSignatures prefix isolation; verifyAll empty/correct/wrong-hash/missing-file/mixed + fallback path.
  • CMakeLists target: test_security_signature_rocksdb_iteration_focused / SecuritySignatureRocksDBIterationFocusedTests.
  • CI: .github/workflows/security-signature-rocksdb-iteration-ci.yml (gcc-12, clang-15, gcc-13).

Audit / Code Review

A post-implementation audit confirmed all acceptance criteria from the issue are fully satisfied:

  • AC-1 ✅ RocksDBWrapper::iterateRange declared in header, implemented with rocksdb::Iterator + OperationGuard.
  • AC-2 ✅ SecuritySignatureManager::verifyAll() wired to iterateRange; scans all security_sig: keys and verifies each file's SHA-256 hash in sequence.
  • src/storage/FUTURE_ENHANCEMENTS.md items marked [x] complete.

Type of Change

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Other:

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

📚 Research & Knowledge (wenn applicable)

  • Diese PR basiert auf wissenschaftlichen Paper(s) oder Best Practices?
    • Falls JA: Research-Dateien in /docs/research/ angelegt?
    • Falls JA: Im Modul-README unter "Wissenschaftliche Grundlagen" verlinkt?
    • Falls JA: In /docs/research/implementation_influence/ eingetragen?

Relevante Quellen:

  • Paper:
  • Best Practice:
  • Architecture Decision:

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings introduced
Original prompt

This section details on the original issue you should resolve

<issue_title>SecuritySignatureManager: Implement RocksDB Iteration</issue_title>
<issue_description>### Context

This issue implements the roadmap item 'SecuritySignatureManager: Implement RocksDB Iteration' for the storage domain. It is sourced from the consolidated roadmap under 🟡 Medium Priority — Near-term (v1.5.0 – v1.8.0) and targets milestone v1.8.0.

Primary detail section: SecuritySignatureManager: Implement RocksDB Iteration

Goal

Deliver the scoped changes for SecuritySignatureManager: Implement RocksDB Iteration in src/storage/ and complete the linked detail section in a release-ready state for v1.8.0.

Detailed Scope

SecuritySignatureManager: Implement RocksDB Iteration

Priority: Medium
Target Version: v1.8.0

security_signature_manager.cpp line 110: "TODO: Implement proper RocksDB iteration when RocksDBWrapper supports it". Without iteration, the signature manager cannot verify integrity across all stored records.

Implementation Notes:

  • [ ] Add RocksDBWrapper::iterateRange(start_key, end_key, callback) that uses a rocksdb::Iterator under the hood.
  • [ ] Wire into SecuritySignatureManager::verifyAll() to scan all document keys and verify their signatures in sequence.

Acceptance Criteria

  • Add RocksDBWrapper::iterateRange(start_key, end_key, callback) that uses a rocksdb::Iterator under the hood.
  • Wire into SecuritySignatureManager::verifyAll() to scan all document keys and verify their signatures in sequence.

Relationships

References

  • src/ROADMAP.md
  • src/storage/FUTURE_ENHANCEMENTS.md#securitysignaturemanager-implement-rocksdb-iteration
  • Source key: roadmap:206:storage:v1.8.0:securitysignaturemanager-implement-rocksdb-iteration

Generated from the consolidated source roadmap. Keep the roadmap and issue in sync when scope changes.

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…er (v1.8.0 #206)

- Add RocksDBWrapper::iterateRange(start_key, end_key, callback) using a
  rocksdb::Iterator under OperationGuard lifecycle protection
- Fix listAllSignatures() TODO: use iterateRange over the security_sig: prefix
- Add SecuritySignatureManager::verifyAll() that iterates all stored signature
  keys via iterateRange and verifies each file's SHA-256 hash
- Extract makePrefixRange() helper to avoid duplicating end-key logic
- Add 13 focused tests in test_security_signature_rocksdb_iteration.cpp
- Add CMakeLists.txt target test_security_signature_rocksdb_iteration_focused
- Add CI workflow security-signature-rocksdb-iteration-ci.yml
- Mark FUTURE_ENHANCEMENTS.md items as complete"

Co-authored-by: makr-code <[email protected]>
Copilot AI changed the title [WIP] Implement RocksDB iteration for SecuritySignatureManager feat(storage): SecuritySignatureManager – implement RocksDB iteration (v1.8.0 #206) Mar 15, 2026
Copilot AI requested a review from makr-code March 15, 2026 13:10
@makr-code
makr-code marked this pull request as ready for review March 15, 2026 13:18
@makr-code

Copy link
Copy Markdown
Owner

@copilot Review und Code Audit. Wurden alle Aufgaben des Issue erfüllt?

Copilot AI commented Mar 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Review und Code Audit. Wurden alle Aufgaben des Issue erfüllt?

Ja, alle Aufgaben des Issues wurden vollständig erfüllt. Hier die Audit-Übersicht:

AC-1 ✅ RocksDBWrapper::iterateRange(start_key, end_key, callback)

  • Deklariert in include/storage/rocksdb_wrapper.h (neben scanRange)
  • Implementiert in src/storage/rocksdb_wrapper.cpp (Zeile 1327–1354) mit rocksdb::Iterator unter OperationGuard für Thread-/Lifecycle-Sicherheit — gleiche Schutzmuster wie das bestehende scanRange
  • Callback gibt false zurück → stoppt die Iteration vorzeitig

AC-2 ✅ SecuritySignatureManager::verifyAll() mit iterateRange

  • VerifyAllResult-Struct in Header (total, verified, failed, failed_resource_ids, success())
  • verifyAll() in security_signature_manager.cpp (Zeile 212–255): verwendet iterateRange über den Prefix-Bereich ["security_sig:", "security_sig;"), deserialisiert jeden Eintrag und prüft SHA-256-Hash via verifyFile()
  • listAllSignatures() TODO (alte Zeile 110) ebenfalls durch iterateRange ersetzt
  • makePrefixRange() als privater Helper extrahiert, um Dopplung zu vermeiden

Tests ✅ 13 Tests in tests/test_security_signature_rocksdb_iteration.cpp

  • iterateRange: Bereichsgrenzen, exklusive End-Key, früher Abbruch, Werte
  • listAllSignatures: leere DB, mehrere Einträge, unrelated Keys nicht eingeschlossen
  • verifyAll: leere DB, fehlende Datei, korrekter Hash, falscher Hash, gemischte Ergebnisse
  • In-Memory-Fallback-Pfad abgedeckt

Weitere Artefakte ✅

  • tests/CMakeLists.txt: Target test_security_signature_rocksdb_iteration_focused + Test SecuritySignatureRocksDBIterationFocusedTests
  • CI: .github/workflows/security-signature-rocksdb-iteration-ci.yml (gcc-12, clang-15, gcc-13 / ubuntu-22.04 + 24.04)
  • src/storage/FUTURE_ENHANCEMENTS.md: Items als [x] markiert

Der CI-Run hat Status action_required (Workflow-Genehmigung für Bot-PRs beim ersten Lauf nötig) — kein Build-Fehler.

Commit: 8031d33

@makr-code
makr-code merged commit 90e5e04 into develop Mar 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SecuritySignatureManager: Implement RocksDB Iteration

2 participants