deepmodeling / deepmodeling/fpop

[Code scan] Avoid mutating caller step and executor configuration dictionaries

Open Beginner friendly
#34 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3
Forks
13
PR merge metrics
No merged PRs in 30d

Description

This issue is a result of a Codex global code scan of `deepmodeling/fpop` at commit `b05b337590c31a5237b2dcbd9c0833b841c08cd4`.

Relevant code:
https://github.com/deepmodeling/fpop/blob/b05b337590c31a5237b2dcbd9c0833b841c08cd4/fpop/preprun_fp.py#L127-L138
https://github.com/deepmodeling/fpop/blob/b05b337590c31a5237b2dcbd9c0833b841c08cd4/fpop/utils/step_config.py#L5-L12

Problem:
`_prep_run_fp()` and `init_executor()` destructively modify caller-owned configuration dictionaries:

```python
prep_executor = init_executor(prep_step_config.pop("executor"))
run_executor = init_executor(run_step_config.pop("executor"))
etype = executor_dict.pop("type")
```

After constructing one `PrepRunFp`, the original `prep_step_config` / `run_step_config` no longer contain `executor`, and the nested executor dict no longer contains `type`. Reusing the same config object for another workflow can silently drop the dispatcher executor or fail with `KeyError`.

Minimal reproduction:
```python
run_step_config = {"executor": {"type": "dispatcher", "machine_dict": {...}}}
PrepRunFp(..., run_step_config=run_step_config)
print(run_step_config)
# {'executor'} has been removed from the caller's dict
```

Expected behavior:
The workflow builder should copy configuration dictionaries before removing internal keys, preserving caller-owned input objects for reuse and inspection.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with _prep_run_fp() in fpop/preprun_fp.py and init_executor() in fpop/utils/step_config.py, then run the minimal reproduction from the issue. Verify that the original prep and run configuration dictionaries retain their executor and type entries after constructing PrepRunFp and can be reused without losing the dispatcher executor.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.