test: add unit tests for engine.runtime_config.apply_output_dir#121
Open
northline-lab wants to merge 1 commit into
Open
test: add unit tests for engine.runtime_config.apply_output_dir#121northline-lab wants to merge 1 commit into
northline-lab wants to merge 1 commit into
Conversation
## Summary Add focused unit tests for `contribarena.engine.runtime_config.apply_output_dir`. This pure helper is invoked from `engine/runner.py`, `engine/controller.py`, and `engine/season_runtime.py` (twice) to rebase `artifacts.output_root` and conditionally rebase `memory.root` into the per-run output directory, but had no dedicated unit test coverage. ## Coverage `tests/unit/test_runtime_config.py` adds 1 test class (`ApplyOutputDirTest`) and 9 tests: - **test_none_output_dir_returns_input_config_unchanged** — `output_dir=None` short-circuits and returns the same `RunConfig` instance with unchanged `artifacts.output_root` and `memory.root`. - **test_output_dir_updates_artifacts_output_root** — `artifacts.output_root` becomes the supplied `output_dir`. - **test_default_relative_memory_root_is_rebased_under_output_dir_parent** — when `memory.root` is the default `DEFAULT_MEMORY_RELATIVE` sentinel, it is rebased to `output_dir.parent / "memory"`. - **test_absolute_memory_root_is_preserved** — operator-provided absolute `memory.root` is left untouched. - **test_non_default_relative_memory_root_is_preserved** — non-default relative `memory.root` is also preserved; only the default sentinel triggers rebasing. - **test_returns_new_config_without_mutating_input** — the helper returns a new `RunConfig` via `model_copy` without mutating the input config's nested submodels. - **test_other_config_sections_are_preserved** — fields outside `artifacts` and `memory` round-trip unchanged (`run.mode`, `run.model`, `discovery.candidates`, `workspace.backend`). - **test_memory_config_fields_other_than_root_are_preserved** — when `memory.root` is rebased, other `MemoryConfig` fields (`enabled`, `backend`, `graphiti_enabled`) survive the `model_copy` untouched. - **test_relative_output_dir_rebases_memory_under_relative_parent** — a relative `output_dir` produces a correspondingly relative rebased `memory.root`. No production code is modified. ## Verification - `UV_CACHE_DIR=/tmp/uv-cache UV_PROJECT_ENVIRONMENT=/tmp/contribarena-uv-venv uv run --extra dev pytest -q tests/unit/test_runtime_config.py` → 9 passed - `UV_CACHE_DIR=/tmp/uv-cache UV_PROJECT_ENVIRONMENT=/tmp/contribarena-uv-venv uv run --extra dev ruff check tests/unit/test_runtime_config.py` → All checks passed ## Risk Low — test-only addition. No production code is modified. --- *This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add focused unit tests for
contribarena.engine.runtime_config.apply_output_dir. This pure helper is invoked fromengine/runner.py,engine/controller.py, andengine/season_runtime.py(twice) to rebaseartifacts.output_rootand conditionally rebasememory.rootinto the per-run output directory, but had no dedicated unit test coverage.Coverage
tests/unit/test_runtime_config.pyadds 1 test class (ApplyOutputDirTest) and 9 tests:output_dir=Noneshort-circuits and returns the sameRunConfiginstance with unchangedartifacts.output_rootandmemory.root.artifacts.output_rootbecomes the suppliedoutput_dir.memory.rootis the defaultDEFAULT_MEMORY_RELATIVEsentinel, it is rebased tooutput_dir.parent / "memory".memory.rootis left untouched.memory.rootis also preserved; only the default sentinel triggers rebasing.RunConfigviamodel_copywithout mutating the input config's nested submodels.artifactsandmemoryround-trip unchanged (run.mode,run.model,discovery.candidates,workspace.backend).memory.rootis rebased, otherMemoryConfigfields (enabled,backend,graphiti_enabled) survive themodel_copyuntouched.output_dirproduces a correspondingly relative rebasedmemory.root.No production code is modified.
Verification
UV_CACHE_DIR=/tmp/uv-cache UV_PROJECT_ENVIRONMENT=/tmp/contribarena-uv-venv uv run --extra dev pytest -q tests/unit/test_runtime_config.py→ 9 passedUV_CACHE_DIR=/tmp/uv-cache UV_PROJECT_ENVIRONMENT=/tmp/contribarena-uv-venv uv run --extra dev ruff check tests/unit/test_runtime_config.py→ All checks passedRisk
Low — test-only addition. No production code is modified.
This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.