Skip to content

Conversation

sleepyStick
Copy link
Contributor

@sleepyStick sleepyStick commented Sep 22, 2025

Summary

Resync Spec task was silently failing and not generating any PRs.
https://jira.mongodb.org/browse/PYTHON-5569

Changes in this PR

  • I added a set -eu to the beginning of the bash file which should fail the task if the python script fails.
  • The cause of this specific PR was from one (or more) of the patch files being out of date. Going forward, this error is caught and the error will be put into the body of the generated PR (if all other steps succeed).
  • updated appropriate patch files and ran the script locally to sync the remaining specs.

Test Plan

I ran the script locally and verified desired behaviour. See below:
before my changes:

>$ ./.evergreen/scripts/resync-all-specs.sh 
Beginning to sync specs
Done syncing specs
Beginning to apply patches
rm: /Users/iris.ho/GitHub/mongo-python-driver/test/transactions/legacy/errors-client.json: No such file or directory
rm: /Users/iris.ho/GitHub/mongo-python-driver/test/index_management/index-rawdata.json: No such file or directory
Done removing unimplemented tests
error: patch failed: test/discovery_and_monitoring/unified/serverMonitoringMode.json:5
error: test/discovery_and_monitoring/unified/serverMonitoringMode.json: patch does not apply
Traceback (most recent call last):
  File "/Users/iris.ho/GitHub/mongo-python-driver/./.evergreen/scripts/resync-all-specs.py", line 122, in <module>
    main(args)
    ~~~~^^^^^^
  File "/Users/iris.ho/GitHub/mongo-python-driver/./.evergreen/scripts/resync-all-specs.py", line 109, in main
    apply_patches()
    ~~~~~~~~~~~~~^^
  File "/Users/iris.ho/GitHub/mongo-python-driver/./.evergreen/scripts/resync-all-specs.py", line 36, in apply_patches
    subprocess.run(
    ~~~~~~~~~~~~~~^
        ["git apply -R --allow-empty --whitespace=fix ./.evergreen/spec-patch/*"],  # noqa: S607
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        shell=True,  # noqa: S602
        ^^^^^^^^^^^^^^^^^^^^^^^^^
        check=True,
        ^^^^^^^^^^^
    )
    ^
  File "/Users/iris.ho/.pyenv/versions/3.13.5t/lib/python3.13t/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git apply -R --allow-empty --whitespace=fix ./.evergreen/spec-patch/*']' returned non-zero exit status 1.

after my changes:

>$ Beginning to sync specs
Done syncing specs
Beginning to apply patches
rm: /Users/iris.ho/GitHub/mongo-python-driver/test/transactions/legacy/errors-client.json: No such file or directory
rm: /Users/iris.ho/GitHub/mongo-python-driver/test/index_management/index-rawdata.json: No such file or directory
Done removing unimplemented tests

The following specs were changed:
 -connection_logging
 -connection_monitoring
 -csot
 -discovery_and_monitoring
 -scripts
 -server_selection_logging


The following spec syncs encountered errors:
 -applying patches
```b'error: patch failed: test/discovery_and_monitoring/unified/serverMonitoringMode.json:5\nerror: test/discovery_and_monitoring/unified/serverMonitoringMode.json: patch does not apply\n'```

Screenshots (optional)

See above?

Checklist

Do not delete the items provided on this checklist
Checklist for Author

  • Did you update the changelog (if necessary)? (not necessary this time since no public facing changes)
  • Is the intention of the code captured in relevant tests? (i think the script now behavious more like we expected it to)
  • If there are new TODOs, has a related JIRA ticket been created? (no new todos)

Checklist for Reviewer {@primary_reviewer}

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Have you checked for spelling & grammar errors?
  • Is all relevant documentation (README or docstring) updated?

Focus Areas for Reviewer

List any complex portion of code you believe needs additional scrutiny and explain why.
see comments :)


# PYTHON-5248 - Remove support for MongoDB 4.0
rm $PYMONGO/test/**/pre-42-*.json
rm $PYMONGO/test/**/**/pre-42-*.json
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is to remove files in test/discovery_and_monitoring/errors/pre-42-*.json
(I thought the ** was a recursive wildcard? but every time i ran the resync spec script those files would pop up so i added it explicitly?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend using find instead. I'm not a bash expert but the rules for ** aren't like in Path/.glob.

Try: find /$PYMONGO /test -type f -name 'pre-42-*.json' -delete

Note that -f means that this isn't going to match directories.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooo good idea! I've replaced the two rms with the find instead. Thanks~

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# Run spec syncing script and create PR
set -eu
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should make errors more visible to us

"single",
+ "sharded"
- "sharded",
- "sharded-replicaset"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already did this ticket but for whatever reason the spec repo still has this one instance of sharded-replicaset so we're applying this patch to keep it out of our tests. (I've made a comment on the drivers ticket asking why its still in the spec repo)

@sleepyStick sleepyStick marked this pull request as ready for review September 23, 2025 20:42
@sleepyStick sleepyStick requested a review from a team as a code owner September 23, 2025 20:42
@sleepyStick sleepyStick changed the title PYTHON-5569 PYTHON-5569: [Build Failure] Spec Resync job is failing silently Sep 23, 2025
Copy link
Contributor

@caseyclements caseyclements left a comment

Choose a reason for hiding this comment

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

Apologies for the delay. I had a cluster of partial seizures last week so needed some rest.


# PYTHON-5248 - Remove support for MongoDB 4.0
rm $PYMONGO/test/**/pre-42-*.json
rm $PYMONGO/test/**/**/pre-42-*.json
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend using find instead. I'm not a bash expert but the rules for ** aren't like in Path/.glob.

Try: find /$PYMONGO /test -type f -name 'pre-42-*.json' -delete

Note that -f means that this isn't going to match directories.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do these patches belong in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The spec sync was failing and I figured it was easier to fix it in this PR than to put it off and fix it in the next spec sync PR. (running the spec sync script locally naturally produced these changes and since I was on greener build last week I decided to take the time to straighten them out.) I saw it as "catching" up on what the spec sync for the past few weeks should've been like and was hoping to make it easier for the next person on greener build.
If you prefer that they not be added in this PR, I'm happy to take them out.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm personally ok with this approach. I'm not a stickler and think velocity is often more important than paper trail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same question on these new tests. I take it that the sync was failing and these just piled up?

@sleepyStick
Copy link
Contributor Author

Apologies for the delay. I had a cluster of partial seizures last week so needed some rest.

All good, hope you go the rest you needed and that you're feeling better now!

Copy link
Contributor

@caseyclements caseyclements left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm personally ok with this approach. I'm not a stickler and think velocity is often more important than paper trail.

@sleepyStick sleepyStick merged commit 4839e52 into mongodb:master Sep 29, 2025
70 of 73 checks passed
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.

2 participants