Skip to content

Conversation

harryadel
Copy link
Member

@harryadel harryadel commented Jul 11, 2025

  • Fix failing server side tests

  • Fix linting

  • Verify .find hooks work
    History & README were updated to properly reflect the current package status

  • Support both sync and async operations in all hooks
    As I was working on the package I thought it'd be possible to support async operations in sync hooks but I then figured how hard it'd be to support such a thing as blocking sync execution based on a sync operation wouldn't be feasible and allowing async operations as fire-and-forget to not block things would be awkward. I know understand why @bhunjadi decided to drop sync support and now hooks are only triggered on async operations (ex: findOneAsync instead of findOne)

     collection.before.findOne(async function(userId, selector) {
       console.log('Async hook started')
       await fetch('/api/log-access') // Takes 200ms
       console.log('Async hook finished')
     })
    
     // Sync call
     const doc = collection.findOne({name: 'John'})
     console.log('findOne returned:', doc)
     Async hook started                    // ← Hook fires immediately
     findOne returned: {_id: 1, name: 'John'}  // ← findOne completes WITHOUT waiting
     Async hook finished                   // ← Hook completes later (200ms later)
  • Fix CI tests

  • Utilize https://packosphere.com/lai/collection-extensions until Integrate lai:collection-extensions into core meteor/meteor#13830 gets merged

  • Review files one last time compared to their older versions to ensure they still retain the same structure

  • Try it out in my top secret project @DanielDornhardt

  • Once it's ready, ping @vparpoil for one last test

  • Profit??


Post release

Comment on lines +10 to +32
name: tests
runs-on: ubuntu-latest
strategy:
matrix:
meteorRelease:
- '--release 3.0.4'
- '--release 3.1'
meteor: [ '3.3' ]
# needs: [lintcode,lintstyle,lintdocs] # we could add prior jobs for linting, if desired
steps:
- name: Checkout code
- name: checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
- name: Setup meteor
uses: meteorengineer/setup-meteor@v2
with:
node-version: '20.x'
meteor-release: ${{ matrix.meteor }}

- name: Install Dependencies
run: |
curl https://install.meteor.com | /bin/sh
npm i -g @zodern/mtest
- name: Run Tests
run: |
mtest --package ./ --once ${{ matrix.meteorRelease }}
- name: cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: cd tests-app && meteor npm install && meteor npm run test

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 2 months ago

To fix the issue, we will add a permissions block at the root of the workflow. This block will apply to all jobs in the workflow unless overridden by a job-specific permissions block. Since the workflow only needs to read repository contents (e.g., for checking out code), we will set contents: read as the minimal required permission.


Suggested changeset 1
.github/workflows/testsuite.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -4,2 +4,4 @@
 name: Test suite
+permissions:
+  contents: read
 
EOF
@@ -4,2 +4,4 @@
name: Test suite
permissions:
contents: read

Copilot is powered by AI and may make mistakes. Always verify output.
…` instead of `_super`. Introduce constants for async methods and MongoDB operators for better readability and maintainability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant