Feature/sma 101 audit log trait noop factory composition root wiring#194
Open
mrnkslv wants to merge 6 commits into
Conversation
…-101-audit-log-trait-noop-factory-composition-root-wiring
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces the audit log abstraction and wires a shared Arc<dyn AuditLog> through the node-control service composition root so future audit producers can depend on it.
Changes:
- Adds
AuditLog,NoopAuditLog,AuditLogFactory, and audit initialization error scaffolding. - Moves
AuditLogConfiginto common app config and adds it toAppConfigwith serde defaults. - Passes the audit log into HTTP
AppStateand the elections task, updating tests and config constructors.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/node-control/service/src/audit/log.rs |
Adds the async audit log trait, noop implementation, and unit test. |
src/node-control/service/src/audit/factory.rs |
Adds factory and initialization error type for audit log creation. |
src/node-control/service/src/audit/mod.rs |
Re-exports audit config, factory, trait, and noop implementation. |
src/node-control/service/src/audit/event.rs |
Updates test import path for AuditLogConfig. |
src/node-control/common/src/app_config.rs |
Adds AuditLogConfig, embeds it in AppConfig, and tests missing-field defaults. |
src/node-control/service/src/service_main_task.rs |
Initializes audit logging and passes it to service tasks. |
src/node-control/service/src/task/mod.rs |
Adds audit dependency to ElectionsTask. |
src/node-control/service/src/elections/election_task.rs |
Accepts the audit log dependency in the elections runner. |
src/node-control/service/src/http/http_server_task.rs |
Adds audit log to HTTP app state and run wiring. |
src/node-control/service/src/http/entity_crud_handlers_tests.rs |
Updates test config/state construction with audit defaults. |
src/node-control/service/src/http/config_handlers_tests.rs |
Updates test config/state construction with audit defaults. |
src/node-control/service/src/http/auth_tests.rs |
Updates test config/state construction with audit defaults. |
src/node-control/service/src/task/task_manager.rs |
Updates test AppConfig construction. |
src/node-control/service/src/contracts/contracts_task.rs |
Updates test AppConfig construction. |
src/node-control/service/src/auth/user_store.rs |
Updates test AppConfig construction. |
src/node-control/commands/src/commands/nodectl/config_cmd.rs |
Includes audit log defaults in generated config. |
src/node-control/service/Cargo.toml |
Adds thiserror dependency for audit init errors. |
src/Cargo.lock |
Locks the new service dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pub mod participant; | ||
|
|
||
| pub use config::AuditLogConfig; | ||
| pub use common::app_config::AuditLogConfig; |
|
|
||
| let audit = AuditLogFactory::from_config(&app_cfg.audit_log) | ||
| .await | ||
| .map_err(|e| anyhow::anyhow!("audit log init failed: {e}"))?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Define AuditLog async trait, NoopAuditLog, and AuditLogFactory as the foundation for the audit log subsystem. Wire Arc through the composition root so all future producers can depend on the trait without further structural changes.
Changes
Wire Arc in service_main_task.rs: initialized after setup_log, passed to ElectionsTask and http_server_task::run
Closes SMA-101