Skip to content

Commit 61a9f04

Browse files
dotsdlclaude
andcommitted
Fix merge_networks tests' scope auth; revert docs.yml gufe bump
CI ran the env solve and tests cleanly with the gufe/openfe/feflow trio bump (b63474e), revealing two real bugs: 1. The four merge_networks client tests merged into destination scopes the test identity does not have access to (e.g. `test_org-test_campaign-merged_project`). The test identity only has the three scopes in `multiple_scopes` (scope_test plus two others); creating a "new project" under the same org/campaign was not, in fact, authorized. Switch the destination scope to one the identity has: - test_merge_networks: scope_test (collision-free because the merged network's name differs from pre-loaded networks) - test_merge_networks_respects_state: scope_test (each parametrize case uses a unique network name) - test_merge_networks_preserves_tasks_and_results: multiple_scopes[1] (different from where the source Tasks were set up, so the per-`_project` Task/PDRR counts stay clean) 2. The docs.yml gufe bump from 1.3.0 to 1.10.0 breaks the RTD build, because sphinx 9's autodoc dynamic-importer trips on `gufe/settings/models.py`: ph: PositiveFloat | None = Field(None, ...) ~~~~~~~~~~~~~~^~~~~~ TypeError: unsupported operand type(s) for |: 'PositiveFloat' and 'NoneType' gufe 1.3.0 still allows pydantic v1 (where PositiveFloat is a class with `__or__`); gufe >=1.8.0 forces pydantic v2 (where PositiveFloat is `Annotated[float, ...]`, no `__or__`). docs.yml only needs gufe for intersphinx and type-hint resolution; neither benefits from the bump. Revert docs.yml to its pre-PR state. Also polish the client merge_networks docstring with a `set_tasks_status` hint alongside `action_tasks` for the errored-Task remediation path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b63474e commit 61a9f04

3 files changed

Lines changed: 23 additions & 29 deletions

File tree

alchemiscale/interface/client.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,10 @@ def merge_networks(
204204
their associated ProtocolDAGResultRefs, so previously-computed results
205205
do not need to be re-run.
206206
207-
Cloned Tasks are wired to their Transformations via ``PERFORMS`` and
208-
are reachable through standard network traversals
209-
(``get_network_tasks``, ``get_network_results``, etc.). They are
210-
intentionally **not** actioned to the new network's TaskHub; to
211-
retry errored Tasks on the merged network, call
212-
:meth:`action_tasks` with the merged network's ScopedKey after the
213-
merge completes.
207+
Cloned Tasks are intentionally **not** actioned; to retry errored Tasks
208+
on the merged network, call :meth:`action_tasks` with the merged
209+
network's ScopedKey after the merge completes, and set the Tasks'
210+
status to back to `waiting` with :meth:`set_tasks_status`.
214211
215212
Parameters
216213
----------
@@ -224,11 +221,11 @@ def merge_networks(
224221
The Scope in which to create the new AlchemicalNetwork.
225222
This must be a *specific* Scope; it must not contain wildcards.
226223
state
227-
The starting state of the new AlchemicalNetwork in the database.
228-
See :meth:`AlchemiscaleClient.set_network_state` for valid states.
224+
The starting state of the new AlchemicalNetwork. See
225+
:meth:`AlchemiscaleClient.set_network_state` for valid states.
229226
Defaults to ``"active"``.
230227
visualize
231-
If ``True``, show submission progress indicator.
228+
If ``True``, show progress indicator.
232229
233230
Returns
234231
-------

alchemiscale/tests/integration/interface/client/test_client.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,10 @@ def test_merge_networks(
213213
# "incomplete" in each of `multiple_scopes`
214214
source_sks = user_client.query_networks(state=None)
215215

216-
# destination scope: a new project under the existing org/campaign
217-
merge_scope = Scope(
218-
org=scope_test.org,
219-
campaign=scope_test.campaign,
220-
project="merged_project",
221-
)
216+
# destination scope: reuse `scope_test`, which is authorized for
217+
# the test identity. The merged network's name differs from the
218+
# pre-loaded networks, so there is no _scoped_key collision.
219+
merge_scope = scope_test
222220

223221
merged_sk = user_client.merge_networks(
224222
networks=source_sks,
@@ -261,11 +259,10 @@ def test_merge_networks_respects_state(
261259
source_sks = user_client.query_networks(scope=scope_test, state=None)
262260
assert source_sks
263261

264-
merge_scope = Scope(
265-
org=scope_test.org,
266-
campaign=scope_test.campaign,
267-
project=f"merged_state_{state}",
268-
)
262+
# destination scope: reuse `scope_test`, which is authorized for
263+
# the test identity; the unique network name keeps each parametrize
264+
# case from colliding on _scoped_key.
265+
merge_scope = scope_test
269266
merged_sk = user_client.merge_networks(
270267
networks=source_sks,
271268
name=f"merged_state_{state}",
@@ -324,6 +321,7 @@ def test_merge_networks_rejects_non_network_scoped_key(
324321
def test_merge_networks_preserves_tasks_and_results(
325322
self,
326323
scope_test,
324+
multiple_scopes,
327325
n4js_preloaded,
328326
user_client: client.AlchemiscaleClient,
329327
network_tyk2,
@@ -363,12 +361,11 @@ def test_merge_networks_preserves_tasks_and_results(
363361
)
364362
n4js_preloaded.set_task_result(task_sks[1], err_pdrr)
365363

366-
# merge into a fresh project under the same org/campaign
367-
merge_scope = Scope(
368-
org=scope_test.org,
369-
campaign=scope_test.campaign,
370-
project="merged_with_results",
371-
)
364+
# merge into a different authorized scope from where we set up the
365+
# source Tasks, so the per-scope counts below remain clean (the
366+
# destination scope has pre-loaded networks but no Tasks/PDRRs).
367+
merge_scope = multiple_scopes[1]
368+
assert merge_scope != scope_test
372369
merged_sk = user_client.merge_networks(
373370
networks=[source_sk],
374371
name="merged_with_results",

devtools/conda-envs/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ channels:
33
- conda-forge
44

55
dependencies:
6-
- python >=3.11,<3.13
6+
- python<3.13
77
- sphinx
88
- furo
99
- myst-nb
1010
- myst-parser>=0.14
1111
- docutils
1212
- sphinx-notfound-page
13-
- gufe=1.10.0
13+
- gufe=1.3.0
1414
- py2neo
1515
- stratocaster

0 commit comments

Comments
 (0)