Define the processing-adapter contract and implement UTF-8 plain-text ingestion #12

Closed
opened 2026-07-24 19:38:15 -04:00 by JackFrostbyte · 1 comment

Goal

    Define a minimal format-adapter boundary and implement deterministic ingestion of approved UTF-8 plain-text files.

    ## Why

    Arkive needs a small, explicit processing contract before adding format-specific extraction. Plain text provides the simplest implementation against which later PDF behavior can be compared.

    ## Scope

    - Define the input and output contract shared by format-specific processing adapters.
  • Carry source ID, document ID, original file identity, media type, and transformation metadata through the adapter result.

  • Implement strict or explicitly documented UTF-8 decoding behavior.

  • Preserve the input text exactly at this ingestion stage.

  • Record encoding assumptions and the adapter implementation/version used.

  • Produce deterministic output and deterministic errors.

  • Reject unsupported encodings or malformed input according to the documented policy.

  • Add tests using approved plain-text pilot files and focused invalid fixtures.

  • Keep the interface small enough that a born-digital PDF adapter can implement it without a plugin framework.

      ## Out of scope
    
      - Text normalization.
    
  • Chunk generation.

  • PDF extraction.

  • OCR.

  • Automatic format conversion or repair.

  • A dynamic plugin discovery system.

      ## Dependencies
    
      - #7 — Establish the Python project and development-tooling baseline
    
  • #9 — Align metadata schemas and validation with the intake and processing contracts

  • #11 — Implement approved-file import and integrity verification

      ## Acceptance criteria
    
      - The adapter contract is documented and exercised by the plain-text adapter.
    
  • Valid UTF-8 pilot files preserve exact text and identity.

  • Source and document lineage is present in the adapter output.

  • Encoding and transformation metadata are explicit.

  • Unsupported or malformed text fails clearly.

  • Repeated ingestion produces identical output.

      ## Validation
    
      - Run the complete unit-test suite.
    
  • Compare ingested text byte-for-byte or character-for-character with approved UTF-8 inputs as appropriate.

  • Exercise malformed UTF-8 and unsupported-encoding fixtures.

  • Repeat ingestion and compare serialized results.

      ## Suggested branch
    
      `feature/issue-12-plaintext-ingestion`
    
      <!-- arkive-planning-automation:2026-07-24-v3:M1-07 -->
    
## Goal Define a minimal format-adapter boundary and implement deterministic ingestion of approved UTF-8 plain-text files. ## Why Arkive needs a small, explicit processing contract before adding format-specific extraction. Plain text provides the simplest implementation against which later PDF behavior can be compared. ## Scope - Define the input and output contract shared by format-specific processing adapters. - Carry source ID, document ID, original file identity, media type, and transformation metadata through the adapter result. - Implement strict or explicitly documented UTF-8 decoding behavior. - Preserve the input text exactly at this ingestion stage. - Record encoding assumptions and the adapter implementation/version used. - Produce deterministic output and deterministic errors. - Reject unsupported encodings or malformed input according to the documented policy. - Add tests using approved plain-text pilot files and focused invalid fixtures. - Keep the interface small enough that a born-digital PDF adapter can implement it without a plugin framework. ## Out of scope - Text normalization. - Chunk generation. - PDF extraction. - OCR. - Automatic format conversion or repair. - A dynamic plugin discovery system. ## Dependencies - #7 — Establish the Python project and development-tooling baseline - #9 — Align metadata schemas and validation with the intake and processing contracts - #11 — Implement approved-file import and integrity verification ## Acceptance criteria - The adapter contract is documented and exercised by the plain-text adapter. - Valid UTF-8 pilot files preserve exact text and identity. - Source and document lineage is present in the adapter output. - Encoding and transformation metadata are explicit. - Unsupported or malformed text fails clearly. - Repeated ingestion produces identical output. ## Validation - Run the complete unit-test suite. - Compare ingested text byte-for-byte or character-for-character with approved UTF-8 inputs as appropriate. - Exercise malformed UTF-8 and unsupported-encoding fixtures. - Repeat ingestion and compare serialized results. ## Suggested branch `feature/issue-12-plaintext-ingestion` <!-- arkive-planning-automation:2026-07-24-v3:M1-07 -->
Author
Owner

Issue #12 is complete through PR #57.

The processing-adapter boundary is now documented and implemented, with approved originals flowing through the Issue #11 integrity-verification boundary into format-specific processing using the exact verified bytes.

The initial plain-text adapter provides deterministic strict UTF-8 ingestion with exact text preservation, explicit encoding and adapter-version metadata, source/document/original lineage, stable processing errors, UTF-8 BOM preservation, unsupported-encoding handling, and deterministic repeated results.

Both approved UTF-8 pilot originals are covered by integration tests alongside focused malformed UTF-8, unsupported encoding, media-type, whitespace/newline, BOM, immutability, serialization, and verification-failure tests.

Final validation passed with 73 unit tests, metadata validation, Ruff lint/format checks, git diff --check, and pip check.

Issue #12 acceptance criteria are satisfied. Closing as completed.

Issue #12 is complete through PR #57. The processing-adapter boundary is now documented and implemented, with approved originals flowing through the Issue #11 integrity-verification boundary into format-specific processing using the exact verified bytes. The initial plain-text adapter provides deterministic strict UTF-8 ingestion with exact text preservation, explicit encoding and adapter-version metadata, source/document/original lineage, stable processing errors, UTF-8 BOM preservation, unsupported-encoding handling, and deterministic repeated results. Both approved UTF-8 pilot originals are covered by integration tests alongside focused malformed UTF-8, unsupported encoding, media-type, whitespace/newline, BOM, immutability, serialization, and verification-failure tests. Final validation passed with 73 unit tests, metadata validation, Ruff lint/format checks, `git diff --check`, and `pip check`. Issue #12 acceptance criteria are satisfied. Closing as completed.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Arkive/arkive#12
No description provided.