application capa

application-audit-log

Forge module wrapping foundation-audit-log.

Forge module wrapping foundation-audit-log.

Tierapplication
Roleunclassified (baselined)
Pathcrates/application/audit-log
Edition2024
Targetsapplication_audit_log, pg_forge_audit_log
Public items24 across 2 modules
Tests13

What it is for

application-audit-log — wraps foundation-audit-log.

Capabilities

AuditLogModule

application-audit-log — wraps foundation-audit-log.

Item
pub struct AuditLogModule
AuditLogModule :: fn new() -> Self
AuditLogModule :: fn name(& self) -> & 'static str
AuditLogModule :: fn version(& self) -> & 'static str
AuditLogModule :: fn migrations(& self) -> Vec <MigrationSet>
AuditLogModule :: async fn migrate_pending(& self, pool : & PgPool) -> std::result::Result <u32, MigrationError>

failures (other)

Fail-loud accounting for best-effort audit writes (Sprint 0.55 T1 / F1).

Item
fn note_audit_write_failure(path : & str, action : & str, err : & sqlx::Error)
fn audit_write_failures_total() -> u64
fn audit_write_failures_for(path : & str, action : & str) -> u64

repo (other)

Audit-log persistence over the append-only audit_logs table.

Item
fn action_category(action : & str) -> & 'static str
async fn list_audit_page(pool : & PgPool, f : & AuditFilter) -> Result <AuditPage, sqlx::Error>
async fn distinct_actors(pool : & PgPool) -> Result <Vec <(Uuid, String)>, sqlx::Error>
async fn distinct_actions(pool : & PgPool) -> Result <Vec <String>, sqlx::Error>

AuditFilter

Audit-log persistence over the append-only audit_logs table.

Item
pub struct AuditFilter
async fn category_counts(pool : & PgPool, f : & AuditFilter,) -> Result <Vec <(String, i64)>, sqlx::Error>

AuditPage

Audit-log persistence over the append-only audit_logs table.

Item
pub struct AuditPage

AuditRepo

Audit-log persistence over the append-only audit_logs table.

Item
pub struct AuditRepo
AuditRepo :: async fn record <'e, E>(executor : E, log : & AuditLog) -> Result <(), sqlx::Error> where E : Executor <'e, Database = Postgres>,
AuditRepo :: async fn record_scoped(pool : & PgPool, log : & AuditLog) -> Result <(), sqlx::Error>

AuditView

Audit-log persistence over the append-only audit_logs table.

Item
pub struct AuditView
async fn list_audit(pool : & PgPool, actor_id : Option <Uuid>, action : Option <& str>, limit : i64,) -> Result <Vec <AuditView>, sqlx::Error>

Cursor

Audit-log persistence over the append-only audit_logs table.

Item
pub struct Cursor
Cursor :: fn encode(& self) -> String
Cursor :: fn decode(s : & str) -> Option <Self>

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

application_audit_log

flowchart TD
  n_application_audit_log["application_audit_log"]
  n_application_audit_log --> n_failures["failures"]
  n_application_audit_log --> n_repo["repo"]

Public surface

`crate root`

ItemWhat it is
pub struct AuditLogModule
AuditLogModule :: fn new() -> Self
AuditLogModule :: fn name(& self) -> & 'static str
AuditLogModule :: fn version(& self) -> & 'static str
AuditLogModule :: fn migrations(& self) -> Vec <MigrationSet>
AuditLogModule :: async fn migrate_pending(& self, pool : & PgPool) -> std::result::Result <u32, MigrationError>

`failures`

ItemWhat it is
fn note_audit_write_failure(path : & str, action : & str, err : & sqlx::Error)Record a failed best-effort audit write: bump audit_write_failures_total{path,action} and log at error level
fn audit_write_failures_total() -> u64Headline counter: total best-effort audit-write failures since start.
fn audit_write_failures_for(path : & str, action : & str) -> u64Per-label tally for one (path, action) pair (0 if never failed).

`repo`

ItemWhat it is
fn action_category(action : & str) -> & 'static strCoarse category for a log action, for the /staff/logs tabs (Sprint 0.54 lean — derived from the action string; no stored column yet)
pub struct CursorKeyset cursor over (created_at DESC, id DESC)
Cursor :: fn encode(& self) -> String
Cursor :: fn decode(s : & str) -> Option <Self>
pub struct AuditFilterFilters for list_audit_page
pub struct AuditPageA page of audit rows + the cursor to fetch the next (older) page.
pub struct AuditRepoThe single audit write path
AuditRepo :: async fn record <'e, E>(executor : E, log : & AuditLog) -> Result <(), sqlx::Error> where E : Executor <'e, Database = Postgres>,Append one audit row.
AuditRepo :: async fn record_scoped(pool : & PgPool, log : & AuditLog) -> Result <(), sqlx::Error>RLS-safe best-effort write (Sprint 0.55 US-0.55.8b, consensus Q4(b))
pub struct AuditViewOne audit row, projected for the read-only /admin/audit view.
async fn list_audit(pool : & PgPool, actor_id : Option <Uuid>, action : Option <& str>, limit : i64,) -> Result <Vec <AuditView>, sqlx::Error>Read the audit trail newest-first, optionally filtered by actor id and/or action
async fn list_audit_page(pool : & PgPool, f : & AuditFilter) -> Result <AuditPage, sqlx::Error>Paginated, filtered audit read for /staff/logs (Sprint 0.54 T1)
async fn category_counts(pool : & PgPool, f : & AuditFilter,) -> Result <Vec <(String, i64)>, sqlx::Error>Count rows per category (for the tab badges), honoring the same actor/action/ date filters but NOT the cursor.
async fn distinct_actors(pool : & PgPool) -> Result <Vec <(Uuid, String)>, sqlx::Error>Distinct (actor_id, actor_display) pairs present in the trail — for the audit view's Actor filter.
async fn distinct_actions(pool : & PgPool) -> Result <Vec <String>, sqlx::Error>Distinct action strings present in the trail — for the Action filter.

Re-exports. Exported here, defined elsewhere.

ExportDefined in
note_audit_write_failurefailures::note_audit_write_failure
{AuditRepo,AuditView}repo::{AuditRepo,AuditView}

Boundary

Reaches into foundation, identity.

Shares tier application with 120 other crates: application-agreements, application-ai, application-analytics, application-approvals, application-assessments, application-auth, application-billing, application-browser-automation, … (120 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)application
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/application/audit-log
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_application["application"] --> n_foundation["foundation"]
  n_application["application"] --> n_identity["identity"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`application-core`applicationnoalways
`foundation-audit-log`foundationnoalways
`identity-tenant`identitynoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
async-trait^0.1noalways
chrono^0.4serdenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
tracing^0.1noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio^1fullnoalways

Build. None.

Depended on by. 6 workspace crates.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_auth["application-auth"] -->|uses| SELF
  n_application_cli["application-cli"] -->|uses| SELF
  n_application_cms["application-cms"] -->|uses| SELF
  n_application_dlp["application-dlp"] -->|uses| SELF
  n_application_impersonation["application-impersonation"] -->|uses| SELF
  n_application_rbac["application-rbac"] -->|uses| SELF
  SELF["application-audit-log"]
  SELF -->|runtime| n_application_core["application-core"]
  SELF -->|runtime| n_foundation_audit_log["foundation-audit-log"]
  SELF -->|runtime| n_identity_tenant["identity-tenant"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libapplication_audit_log`src/lib.rs`
testpg_forge_audit_log`tests/pg_forge_audit_log.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesyes

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

VariableRead in
CARGO_PKG_VERSIONsrc/lib.rs

6 workspace crates depend on this one: application-auth, application-cli, application-cms, application-dlp, application-impersonation, application-rbac.

Verification

KindCount
Unit tests12
Integration tests1
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root100
failures303
repo11011

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc1624
Public modules with a //! block22
pie showData
    title Public items with rustdoc
    "Documented" : 16
    "No rustdoc detected" : 8

Metrics

MetricValue
Rust source files3
Source lines743
Code lines547
Public API items24
Public modules2
Tests13
Examples0
Cargo features0
Direct runtime dependencies9
Workspace reverse dependencies6
pie showData
    title Public API by kind
    "function" : 9
    "method" : 9
    "struct" : 6
pie showData
    title Rust source composition
    "Code" : 547
    "Blank or comment" : 196

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las application · Manual