Skip to content

feat: add portable archive export and inspect CLI - #56

Open
yusixian wants to merge 6 commits into
mainfrom
feat/g2-8-2-cli-export-inspect
Open

yusixian wants to merge 6 commits into
mainfrom
feat/g2-8-2-cli-export-inspect

Conversation

@yusixian

@yusixian yusixian commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add kodama archive export for deterministic point-in-time metadata archives with exact channel selection and optional typed Telegram provenance
  • add database-independent kodama archive inspect, versioned/sanitized reports, and atomic 0600 artifact publication
  • record bounded export lifecycle evidence and cover snapshot races, lock loss, hostile filesystem leaves, cancellation, and runtime packaging

Closes #55
Parent: #51
Depends on: #54

Changed files

  • apps/server/src/archive/*: export repository/service, bounded spool, artifact boundary, inspect service, reports, and CLI orchestration
  • apps/server/src/cli.ts: archive export / archive inspect command wiring with lazy database resolution
  • apps/server/src/db/schema.ts and apps/server/drizzle/0021_*: additive archive_export_runs evidence table
  • apps/server/test/archive-*.test.ts and apps/server/test/integration/archive-export-repository.test.ts: unit, fault-injection, offline CLI, and PostgreSQL 18 coverage
  • Dockerfile, apps/server/package.json, and pnpm-lock.yaml: package @koharu-suite/archive-format into the production runtime
  • docs/goals/G2.8.2-core-export-inspect-cli.md: implementation boundary and verification gate

Safety and behavior

  • exports channels, public/hidden messages, all revisions, entities, media metadata, and known verified original identities; no media bytes are included in this stage
  • excludes database UUIDs, raw Telegram JSON, Desktop paths, Owner/Auth/audit data, credentials, allowlist state, and backend locations
  • uses one read-only REPEATABLE READ snapshot with deterministic keyset paging and a session advisory lock through artifact publication
  • fails closed if the lock session is lost, provenance mappings are incomplete, selected channels are invalid, or streamed counts diverge
  • validates the complete tar.zst before atomic publication and distinguishes pre-publication cleanup from post-publication durability uncertainty

Validation

  • pnpm lint
  • pnpm typecheck
  • pnpm test — all workspace unit suites passed; server 584/584
  • pnpm build
  • focused PostgreSQL 18 integration — 8/8
  • pnpm compose:smoke
  • security and data-consistency re-review — no remaining important findings

Risk notes

  • adds one forward-only, additive PostgreSQL migration for export-run evidence
  • production export destinations must have an existing parent owned by the container user and not be group/world writable
  • a broader local integration run passed 30/31 files (212 tests); the unrelated MinIO suite timed out while starting its container in beforeAll

Non-goals

  • archive import or conflict application
  • original media blob transport
  • durable browser transfer jobs, APIs, or Owner Desk UI

@yusixian yusixian added the enhancement New feature or request label Aug 3, 2026
@yusixian yusixian self-assigned this Aug 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

G2.8.2: Core archive export and inspect CLI

1 participant