Skip to content

[Rust] Audit log data model and storage in fd5 crate #167

@gerchowl

Description

@gerchowl

Parent: #161

Goal

Add audit module to the fd5 Rust crate with AuditEntry struct and read/write functions.

Spec

  • AuditEntry struct (serde Serialize/Deserialize):
    • parent_hash: String
    • timestamp: String (ISO-8601)
    • author: Author (struct with author_type: String, id: String, name: String)
    • message: String
    • changes: Vec<Change> (struct with action: String, path: String, attr: String, old: Option<String>, new: Option<String>)
  • read_audit_log(file: &File) -> Fd5Result<Vec<AuditEntry>> — read/parse _fd5_audit_log
  • append_audit_entry(file: &File, entry: &AuditEntry) -> Fd5Result<()>
  • JSON serialization via serde_json
  • VarLenUnicode attribute storage

TDD

  • Test round-trip: write → read → assert equal
  • Test append preserves existing entries
  • Test empty/missing log returns Ok(vec![])
  • Test malformed JSON returns clear error
  • Test serde serialization matches Python format exactly

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corefd5 core libraryaudit-trailAudit trail / provenance chain featureeffort:medium1-4 hoursfeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions