chore: auto-open resources#1245
Merged
RangerMauve merged 2 commits intofeat/no-random-access-storage-in-testsfrom Mar 16, 2026
Merged
chore: auto-open resources#1245RangerMauve merged 2 commits intofeat/no-random-access-storage-in-testsfrom
RangerMauve merged 2 commits intofeat/no-random-access-storage-in-testsfrom
Conversation
Member
Author
|
Now that tests are using random-access-file, they are running much slower than with random-access-memory, and occasionally run more than 10 mins, which was our previous CI timeout value. This PR also increases the CI timeout to 15 minutes. |
RangerMauve
approved these changes
Mar 16, 2026
2f0cad7
into
feat/no-random-access-storage-in-tests
11 checks passed
RangerMauve
added a commit
that referenced
this pull request
Mar 16, 2026
* feat: Remove fast test option from test-e2e * feat: Remove random-access-storage from more test-e2e * test: Temporarily disable Consistent storage folders test * test: Remove RAM from server test * test: Remove RAM from coreManager in tests * fix: Close blobstore correctly * feat: Add ready-resource as dependency + types * chore: Revert ready-resource to 1.0.0 * fix: Use ready-resource when loading/closing async resources * chore: Fix ts in test-e2e/members.js * test: Wait for blobStore to be ready for blob-api tests * fix: Race conditions in core manager tests * chore: make replicate async to fix race conditions * test: update datastore test with new timings * fix: wait for project ready when loading * test: add create-core test utility * chore: auto-open resources (#1245) * chore: auto-open resources * chore: increase CI timeout * Update types/ready-resource.d.ts Co-authored-by: Andrew Chou <andrewchou@fastmail.com> * chore: re-add consistent folder name test * fix: Only _close should be abstract in ready-resource --------- Co-authored-by: Mauve Signweaver <contact@mauve.moe> Co-authored-by: Gregor MacLennan <gmaclennan@awana.digital> Co-authored-by: Andrew Chou <andrewchou@fastmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This removes some of the changes in #1232 around resource opening. Putting initialization in
_open()creates an additional state to manage for classes, "initialized but not open", and the need to wrap some functions and methods in athis.ready()guard, and a condition for a future dev "you must sometimes wait this.ready() before you access some properties". For example, #1232 was missing guards forBlobStore.get(),createReadStream(),createEntriesReadStream(). This isn't currently well covered in the tests because most/all reads happen after opening and writing resources - we're lacking tests that initialize a new instance with existing data and immediately try to read it.There's no need for the async open setup anyway. All of the upstream hypercore modules wrap their ready state, so that you can call any method before they are ready. The CoMapeo Core code has an intentional architecture that removes the need to access hypercore properties that are not populated until after
ready()e.g.core.key.This adds a — currently unnecessary — call to
this.ready().noop()in the constructor of all classes that use ReadyResource. I've done this because not all of our methods callthis.ready()first so we don't guarantee a lazy init, but it works, for now, because the upstream holepunch modules either lazy-init or auto-open. I think it's safer to have a "init in constructor" pattern rather than try to implement lazy init, because lazy init opens too many opportunities for bugs down the line with little gain.