Skip to content

Conversation

djeebus
Copy link
Contributor

@djeebus djeebus commented Sep 5, 2025

Note

Adds optional NFS-backed caching when building templates and implements write-through local caching in storage, wiring flags and usage across orchestrator components with updated tests/mocks.

  • Orchestrator build pipeline:
    • Pass featureFlags into build.NewBuilder and template server; use env SHARED_CHUNK_CACHE_PATH.
    • When flag feature_flags.BuildingFeatureFlagName is enabled, wrap template storage with storage.NewCachedProvider for build reads/writes.
    • Adjust rootfs size and layer executors to use the possibly-wrapped templateStorage.
  • Storage cache (packages/shared/pkg/storage):
    • Implement write-through caching:
      • CachedFileObjectProvider.WriteFromFileSystem and Write now populate local chunk cache while writing to remote.
      • Async local cache cleanup on Delete and DeleteObjectsWithPrefix.
      • Concurrency-limited chunking for large files; tracing and metrics attributes added.
    • Helper utilities: error recording, safe removals; minor struct/param renames.
  • Feature flags:
    • Add BuildingFeatureFlagName (use NFS for building templates).
  • Tests and mocks:
    • Add/replace mockery-generated mocks in packages/shared/pkg/storage.
    • Expand cache tests (write-through, chunking, delete prefix); update to new mocks.
  • Config:
    • Update .mockery.yaml to generate storage mocks in packages/shared/pkg/storage.

Written by Cursor Bugbot for commit b6a786c. This will update automatically on new commits. Configure here.

@djeebus djeebus marked this pull request as ready for review September 5, 2025 22:42
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@djeebus djeebus added the improvement Improvement for current functionality label Sep 10, 2025
cursor[bot]

This comment was marked as outdated.

@djeebus djeebus force-pushed the bring-back-cache-writes branch from d141efb to f8f1a6f Compare September 16, 2025 18:14
cursor[bot]

This comment was marked as outdated.

@dobrac dobrac self-requested a review September 17, 2025 11:26
cursor[bot]

This comment was marked as outdated.

@djeebus djeebus force-pushed the bring-back-cache-writes branch from 68ece42 to 5130329 Compare September 18, 2025 02:02
dobrac
dobrac previously requested changes Sep 18, 2025
}

totalSize := stat.Size()
var wg sync.WaitGroup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about using errorgroup instead which has included concurrency limit by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errgroup will cancel the context and goroutines if an error is encountered, which we don't want. If a single chunk fails for some reason, we still want all of the rest of the chunks to write to disk.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@djeebus djeebus dismissed dobrac’s stale review September 26, 2025 21:22

ready for a new review!

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@ValentaTomas ValentaTomas removed their request for review October 7, 2025 05:25
@ValentaTomas
Copy link
Member

@djeebus Let's split to PR preparing for this change (refactor) and adding the caching behavior.

@ValentaTomas ValentaTomas self-assigned this Oct 8, 2025
@djeebus djeebus force-pushed the bring-back-cache-writes branch from 2b47e2d to 5e6fc67 Compare October 8, 2025 22:39
cursor[bot]

This comment was marked as outdated.

@djeebus
Copy link
Contributor Author

djeebus commented Oct 8, 2025

@djeebus Let's split to PR preparing for this change (refactor) and adding the caching behavior.

OK, I've removed all the nice-to-haves, the rest will go in other PRs.

@ValentaTomas ValentaTomas requested review from ValentaTomas and removed request for jakubno October 10, 2025 22:31
@ValentaTomas ValentaTomas marked this pull request as draft October 10, 2025 22:52
@djeebus
Copy link
Contributor Author

djeebus commented Oct 10, 2025

There is currently a mismatch between reading/writing whole files and reading/writing chunked files. We need to do things:

  1. Line things up so that the template writes the same files that the orchestrator expects to read
  2. Find a way to throw errors if the function calls don't line up across structs

@djeebus
Copy link
Contributor Author

djeebus commented Oct 16, 2025

This is blocked by #1361 ; will refactor after that gets merged.

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

Labels

improvement Improvement for current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants