Improve Registry and Deduplicator separation of concerns #160

Open
opened 2025-10-14 22:06:47 +00:00 by tegwick · 0 comments
Owner

Problem

The Registry and Deduplicator have coupled responsibilities that violate separation of concerns:

  • Registry stores content-addressable storage paths instead of metadata
  • Deduplicator calls registry.register_asset() with storage paths, not original paths
  • Makes testing and maintenance more complex

Root Cause

The deduplicator calls registry.register_asset(stored_path, description) in markitect/assets/deduplicator.py:95, passing the deduplicated storage path instead of preserving the original path metadata.

Impact

  • Registry contains storage implementation details instead of logical metadata
  • Original file paths are lost in the registration process
  • Tight coupling makes components harder to test independently
  • Violates single responsibility principle

Proposed Solution

Option A (Recommended): Registry tracks original metadata, Deduplicator handles storage

Option B: Registry accepts both original and storage paths explicitly

Benefits

  • Clear separation: Registry = metadata, Deduplicator = storage
  • Easier unit testing of each component
  • Better preservation of original file information
  • More maintainable architecture

Files Affected

  • markitect/assets/deduplicator.py:95 - Storage registration logic
  • markitect/assets/registry.py - Registration interface
  • Tests that depend on current coupling

Priority

Medium - Architecture improvement that enables future features

## Problem The Registry and Deduplicator have coupled responsibilities that violate separation of concerns: - Registry stores content-addressable storage paths instead of metadata - Deduplicator calls registry.register_asset() with storage paths, not original paths - Makes testing and maintenance more complex ## Root Cause The deduplicator calls registry.register_asset(stored_path, description) in markitect/assets/deduplicator.py:95, passing the deduplicated storage path instead of preserving the original path metadata. ## Impact - Registry contains storage implementation details instead of logical metadata - Original file paths are lost in the registration process - Tight coupling makes components harder to test independently - Violates single responsibility principle ## Proposed Solution **Option A (Recommended)**: Registry tracks original metadata, Deduplicator handles storage **Option B**: Registry accepts both original and storage paths explicitly ## Benefits - Clear separation: Registry = metadata, Deduplicator = storage - Easier unit testing of each component - Better preservation of original file information - More maintainable architecture ## Files Affected - markitect/assets/deduplicator.py:95 - Storage registration logic - markitect/assets/registry.py - Registration interface - Tests that depend on current coupling ## Priority Medium - Architecture improvement that enables future features
tegwick added this to the Images And File Attachments project 2025-10-14 22:21:06 +00:00
Sign in to join this conversation.