You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by "justinmclean (via GitHub)" <gi...@apache.org> on 2026/07/28 00:52:05 UTC
[I] Add a test that $CVE_JSON_CONFIG pointing at a missing file does not fall back to the legacy path [magpie]
justinmclean opened a new issue, #976:
URL: https://github.com/apache/magpie/issues/976
## Summary
`generate-cve-json` promises that an explicitly-chosen config path which does not exist is an
error, never a silent fallback to the old pre-rename location. That promise is tested for the
`--config` flag but not for the `$CVE_JSON_CONFIG` environment variable. Add the missing test.
## Background
The tool directory was renamed from `tools/vulnogram` to `tools/cve-tool-vulnogram`. Adopters
who upgraded across the rename still have their config at the old path, so the tool falls back
to it with a deprecation warning — but **only** when resolving from the default location. If the
user named a path explicitly (via `--config` or `$CVE_JSON_CONFIG`) and that path is missing,
the tool must raise rather than quietly read some other file.
`tests/test_config_resolution.py` covers five situations: default present, legacy fallback with
warning, default winning over legacy, both missing, and `--config` not falling back. The
environment-variable arm of the same guarantee has no test, even though it is the one reading
global process state and therefore the easier one to break by accident in a later refactor.
## Where to look
- `tools/cve-tool-vulnogram/generate-cve-json/tests/test_config_resolution.py` — add the test
here. `test_explicit_config_path_does_not_fall_back_to_legacy` is the closest existing test
to model it on.
- The `_clean_env` fixture at the top of that file already deletes `CVE_JSON_CONFIG` before
every test, so your test only needs to set it.
- `tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py` — read
`_resolve_config_path` and `_load_config` to see why the env var behaves like `--config`
and not like the default path.
A working shape:
```python
def test_env_config_path_does_not_fall_back_to_legacy(tmp_path, monkeypatch):
_write(tmp_path, _LEGACY_REL, "Legacy")
monkeypatch.setenv("CVE_JSON_CONFIG", str(tmp_path / "missing.toml"))
with pytest.raises(FileNotFoundError):
_load_config()
```
## Acceptance criteria
- [ ] A new test sets `$CVE_JSON_CONFIG` to a path that does not exist, with the legacy config
present on disk, and asserts `FileNotFoundError` is raised.
- [ ] The test fails if the fallback condition in `_load_config` is loosened to include the
env-var case (check this by temporarily editing the condition, then reverting).
- [ ] The package's existing tests still pass.
## Estimated effort
~1 hour for someone new to the codebase, most of it spent getting the package's tests running
locally the first time.
## Getting started
[[How to contribute](https://github.com/apache/airflow-steward/blob/main/CONTRIBUTING.md#your-first-contribution)](https://github.com/apache/airflow-steward/blob/main/CONTRIBUTING.md#your-first-contribution)
This issue was drafted with the help of an AI-assisted tool and reviewed by a Magpie maintainer before posting. If anything here is unclear or looks wrong, say so on the issue: a real person is reading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add a test that $CVE_JSON_CONFIG pointing at a missing file does not fall back to the legacy path [magpie]
Posted by "Shaurya2k06 (via GitHub)" <gi...@apache.org>.
Shaurya2k06 commented on issue #976:
URL: https://github.com/apache/magpie/issues/976#issuecomment-5100732384
I'll take this up!
cc @justinmclean
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add a test that $CVE_JSON_CONFIG pointing at a missing file does not fall back to the legacy path [magpie]
Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean closed issue #976: Add a test that $CVE_JSON_CONFIG pointing at a missing file does not fall back to the legacy path
URL: https://github.com/apache/magpie/issues/976
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org