Skip to content

readFitLedger(): a run that does not fit reads the existing fit, falling back to production - #273

Merged
eliotmcintire merged 6 commits into
developmentfrom
feat/readFitLedger
Dec 3, 2026
Merged

eliotmcintire merged 6 commits into
developmentfrom
feat/readFitLedger

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

A run that only reads an existing model fit no longer needs its own copy of the ledger. When it has none, it reads the newest production fit.

Affects: modules that reuse a fit under a new run name can read it without a hand-copied ledger; readSpreadFitLedger() is removed (use readFitLedger("spread", ...)).

Reuses: latestSpreadFits(), latestIgnitionFits(), reproducible::CacheGeo(), CacheGeoLedger(), CacheGeoRead(), copyFile(), resolveDoFit(), ignitionFitFilePrefix; new: readFitLedger() (nothing chose between a named file and the production "latest" by doFit), moduleDoFit() (one resolver for the modules, over resolveDoFit()), .readLedgerFile() (the ledger read .latestLedgerFits() did inline; now shared), spreadFitFilePrefix, spreadFitLedgerProductionFolder, ignitionFitLedgerProductionFolder (each literal was in one or two places; now one, and the option defaults use them).

Technical details

readFitLedger(model = c("spread", "ignition"), filename, cloudFolderID, domain, destinationPath, doFit = NA, escapeDefinition = NULL, polygonIDs = NULL, productionFolder = <model's production constant>).

filename doFit read
"latest" any latest*Fits() from cloudFolderID
a file TRUE / NA that file in cloudFolderID
a file FALSE, file has rows that file (a missing ELF is the module's mustFit() to stop on)
a file FALSE, file missing or no rows "latest" from productionFolder, with a message naming each row's source file

The fallback is per file, never per ELF. Nothing is written. domain = NULL reads all rows; with doFit FALSE the file is read once. polygonIDs goes to latest*Fits(). Rows from the "latest" path keep the spreadFitFiles / ignitionFitFiles attribute.

Fixed after review: the fallback used spreadFitLedgerFolder(testing = FALSE), which follows the option an experiment sets to its testing folder. It now uses the exported constants spreadFitLedgerProductionFolder / ignitionFitLedgerProductionFolder, which no option changes (they are also the option defaults). moduleDoFit(params, module, message = FALSE) is resolveDoFit() over one module's parameter list (FALSE if NULL). readSpreadFitLedger() is deleted; its tests moved into test-readFitLedger.R. elfFeatures() and elfFitDates() read through readFitLedger() (same rows and attributes).

Tests, full devtools::test(): branch 973 tests, 0 failed, 0 errors, 3 skipped; development 953 tests, 0 failed. checkDocFiles() and codoc() clean. Scratch library with SpaDES.core and SpaDES.tools at development.

🤖 Generated with Claude Code

eliotmcintire and others added 3 commits December 2, 2026 17:13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.02%. Comparing base (023801d) to head (a1a1b90).

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #273      +/-   ##
===============================================
+ Coverage        93.98%   94.02%   +0.03%     
===============================================
  Files               78       78              
  Lines             5869     5908      +39     
===============================================
+ Hits              5516     5555      +39     
  Misses             353      353              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

eliotmcintire and others added 2 commits December 2, 2026 18:17
.fuelTermsBySpecies() set note to "" on a 0-row table, and elfFuelEffects() built a table from a 1-long ELF and 0-long
columns. Regression test: a climate-only fit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… helper, readSpreadFitLedger() removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eliotmcintire eliotmcintire added breaking change Existing code or results need changes to keep working and removed backwards compatible Existing code and results keep working unchanged labels Dec 3, 2026
@eliotmcintire
eliotmcintire merged commit cfad70f into development Dec 3, 2026
16 checks passed
@eliotmcintire
eliotmcintire deleted the feat/readFitLedger branch December 3, 2026 16:59
eliotmcintire added a commit that referenced this pull request Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Existing code or results need changes to keep working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant