Skip to content

chore(ingest): extract the shared local ingestion core (walk, cursor, change gate, report) from the qoder connector #111

Description

@waterbro-8
schemaVersion: requirement-record.v1
revision: R1
status: needs-design
priority: P2
productOwner: "@PeterGuy326"
technicalOwner: "@waterbro-8"
userOutcome: "A mem maintainer changes local ingestion behaviour once, in one core, instead of twice: the qoder transcript connector and the future put --watch daemon share walk, cursor, change-detection and report code, so #110 does not write a second state layer."
requirements:
  - REQ-001
  - REQ-002
  - REQ-003
acceptanceCriteria:
  - AC-001
  - AC-002
  - AC-003
parent: null
dependencies:
  - "https://github.com/bytefolk/mem/pull/108 (must merge first)"
supersedes: []
lastDecisionAt: null

User problem and observable outcome

Adjudicated on #110 (R2, D-4): #110 and #103 share an ingestion core, not a write surface. The core already exists in working form inside #103's connector, and everything in it was earned through review on PR #108 — a cursor that must not advance under --dry-run, truncate/rewrite detection, atomic cursor writes, per-file degradation on a 409 instead of aborting the run, and a run summary.

Concrete duplication cost if this is not done: put --watch would re-implement the same cursor store, the same state-root layout (cliStateRoot(), server/cmd/mem/cmds_ingest.go:104-112), the same failure-classification table and the same report vocabulary, in a second file, with a second set of edge-case tests, and the two copies would drift. Observable outcome: one internal package owns local ingestion mechanics; both call sites are thin.

Requirements

  • REQ-001: Extract the local ingestion core — deterministic recursive walk, per-path cursor store (atomic rename write, truncate/rewrite reset), stat-gate-then-hash change decision, cycle report aggregation, closed failure-code classification, and the --dry-run / --limit semantics — out of server/cmd/mem/cmds_ingest.go + qoder_checkpoint.go into a reusable internal package, preserving behaviour exactly.
  • REQ-002: Point the qoder connector at the core with no observable behaviour change: same memories payload shape, same Idempotency-Key derivation, same stdout summary, same cursor file format and location (existing users' cursors must remain readable).
  • REQ-003: Make the report and failure vocabulary explicit and shared, so feat(sync): put --watch one-way directory watch (minimal tier, carved from Phase 2 sync drive) #110 consumes names instead of inventing them: counts scanned / ingested / deduped / unchanged / changed / local_gone / failed, and failure codes auth / plan_quota / provider_timeout / network / read_denied / upload_rejected / root_missing / state_corrupt.

Acceptance criteria

Non-goals and forbidden shortcuts

Lifecycle, status, priority, blockers, and open decisions

Evidence plan

Decisions

Revision history


需要 maintainer 打标(本账号无 label 写权限):建议 type:maintenance、area:cli、priority:p2、evidence:e2-source、status:needs-triage。

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCommand-line interfaceevidence:e2-sourceSource or log evidence identifies the likely causestatus:needs-triageAwaiting maintainer classificationtype:maintenanceMaintenance, tooling, refactoring, or repository work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions