Repository navigation
Backlog
Labels
enhancementNew feature or request
Description
Upload verification: manifest checksums + row counts, resumable inserts, and a content-addressed insert ledger
Tracking issue for the next round of review following PR #91 (yaml-schema-config).
Part of the RMM 1.0.0 release. See the full working plan inPLAN.md.
Summary
Introduce a new upload path in ResultModelManager that validates every upload
against a manifest (per-file sha256 checksum and row count), records
each insert in a package-owned upload ledger table (uploading / completed
/ failed), never re-inserts an identical file, and makes resuming
interrupted inserts fast. Errors are file-scoped, never package-scoped.
Used alongside the existing ResultExportManager (which already validates
primary keys at export), this catches insert errors that would otherwise fail
silently.
Status / decisions already locked
- Row-count source of truth: re-scan the final written CSV (callbacks can
drop rows unpredictably). - Dedupe key:
sha256checksum (+table_name,database_id). - Forced inserts supported per file (
force = TRUE+invalidateChecksum()),
designed so AI agents can remediate partial/failed inserts. - Ledger table is RMM-owned, created via the existing migration pattern.
- Interface: R6 (
ResultsUploadManager+createResultsUploadManager()). - Row-count algorithm:
readr::read_csv_chunkedstreaming count (data rows,
excl. header) at manifest-write time. - Row-count validation is delta-based (
table_count(after) − table_count(before)),
because tables accumulate rows from multiple files over time.
Proposed pieces
- Manifest v2 (
ResultExportManager): addrowCountper file, bump
manifestVersion. Also fix the pre-existingdigest-missing-from-DESCRIPTION
issue. - Insert ledger
{tablePrefix}upload_ledger:
(database_id, table_name, checksum)PK, plusrow_count_expected,
row_count_actual,status,error_message,started_at,uploaded_at.
Created viaensureLedgerTable()+ RMM-owned example migration
Migration_3-CreateUploadLedger.sql. ResultsUploadManager(R6): skip-if-identical, resume-retry, file-scoped
failure isolation (§6b inPLAN.md),forceInsert()/invalidateChecksum().- Standard interface: factory + vignette
UsingTheUploadLedger.Rmd. - Adoption PRs: SelfControlledCohort + CohortDiagnostics as reference
implementations (CSV → YAML first, preservingis_vocabulary_table).
Questions for reviewers
- Hash dependency — add
digestto Imports, or switch toopenssl::sha256
to avoid a new dependency? - Delta counting and concurrency — is
after − before(accepted as racy
under concurrent inserts, mitigated bydatabase_idscoping) acceptable, or
should we require PK-based counting? - Ledger lifecycle — auto-create at runtime (
ensureLedgerTable()) vs.
require the migration to have run first? - Error propagation contract — should
upload()return a per-file report
(default) and only throw on opt-in (stopOnFirstError), or should it always
throw an aggregate error after isolation is recorded?
Release
Targets RMM 1.0.0 alongside the SCCS / CohortDiagnostics adoption PRs.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity