Skip to content

Add export/import of redaction settings as a shareable JSON profile #16

Description

@LegalMarc

Goal

Let a user export their MetadataCleaningSettings and RedactionSettings as a JSON file, and import one, so legal teams can share a standard configuration profile.

Dependencies

None — immediately eligible.

Scope

  • Make MetadataCleaningSettings and RedactionSettings (find their definitions in src/swift/MarcutApp/Sources/MarcutApp/ — likely DocumentModels.swift or similar) Codable if not already.
  • Add "Export Profile..." and "Import Profile..." actions to SettingsView.swift using NSSavePanel/NSOpenPanel (this is a sandboxed macOS app — use the existing file-access patterns already in the codebase, e.g. how FileAccessCoordinator.swift handles user-selected file access, rather than introducing a new pattern).
  • Export writes a single JSON file combining both settings structs under named top-level keys (e.g. {"metadataCleaningSettings": {...}, "redactionSettings": {...}}) with a schemaVersion field for forward compatibility.
  • Import reads that JSON, validates the schemaVersion, and applies both settings structs, replacing current values. Reject/error clearly on a malformed or wrong-schema-version file rather than partially applying it.

Out of scope

  • Cloud sync or automatic profile distribution — this is local file export/import only.
  • Merging an imported profile with existing settings — import always fully replaces.

Acceptance criteria

  • Exporting produces a JSON file containing both settings structs and a schema version.
  • Importing that same file into a fresh settings state reproduces the original values exactly.
  • Importing a malformed JSON file or one with an unrecognized schema version shows a clear error and does not change any current settings.

Required verification

  • swift build --package-path src/swift/MarcutApp — must succeed.
  • swift test --package-path src/swift/MarcutApp — all existing tests must still pass.
  • Add round-trip tests: encode a settings pair to JSON, decode it back, assert equality; and a test that decoding a malformed/wrong-version payload throws/fails cleanly without mutating any passed-in state.

Notes

  • Read FileAccessCoordinator.swift before adding file-picker code — the app is sandboxed and already has a pattern for user-selected file access that should be reused, not duplicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    afkAutonomous workflow-loop eligible

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions