You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(test): test_redis_db_ssot resolves its config one directory too high — all 4 tests error at fixture setup #15181
Found while fixing #15161, in the same directory and of the same defect class. Not fixed there — that PR repointed one conftest import and stayed in scope.
What
autobot-infrastructure/shared/tests/test_redis_db_ssot.py:20 resolves its config file with:
parents[2] /"config"/"redis-databases.yaml"
That is one level too high. The file lives at autobot-infrastructure/shared/config/redis-databases.yaml, so the correct anchor is parents[1].
All 4 tests in the file error at fixture setup. They have never run.
Why this keeps happening in this tree
This is the third defect of the same shape found in autobot-infrastructure/shared/tests/ this week: #15161 (a conftest importing a module that moved and a directory that does not exist), this, and the vacuous assertion filed alongside it. The tree is named by a marker workflow but is not in the root pytest.ini testpaths, so nothing routinely exercises it end to end — a path that resolves to nothing produces an error nobody sees.
Fixing the path is a one-line change. The part worth doing properly is the guard, or this recurs: a test whose fixture cannot find its data file should be distinguishable from a test that ran.
Acceptance criteria
The path resolves to the real file, verified by running the 4 tests and showing them collect and execute — not merely collect.
State what the 4 tests assert once they run. If any of them fails for a real reason, that failure is a finding to fix or file, not something to leave red.
Sweep the rest of autobot-infrastructure/shared/tests/ for other parents[N] anchors resolving to non-existent paths, and record the result — three of these in one tree is not evidence there are only three.
A guard that fails when a test file's fixture path does not exist, so the next one is caught at the point it is written rather than by inspection.
The contrast mutation: restore the wrong anchor and show the guard fails.
parents[2] -> parents[1]. Before: collected 4 items ... 4 errors in 0.22s, every one AssertionError: SSOT file not found: <root>/autobot-infrastructure/config/redis-databases.yaml — 4 collected, 0 executed. After: collected 4 items ... 4 passed in 0.07s — 4 collected, 4 executed. Whole tree went from 7 failed, 22 passed, 3 skipped, 4 errors to 7 failed, 26 passed, 3 skipped (36 collected, the 7 pre-existing and untouched).
They pass against 15 real database entries and assert: _FALLBACK_MAPPING identical to the YAML; every YAML name present in DATABASE_MAPPING at the same number; DATABASE_MAPPING inventing no name absent from the YAML and not a declared alias; each RedisDatabase member's value matching the YAML. No real failure surfaced. The loader now also asserts the mapping is non-empty — it returned {} on a renamed YAML section, which would have turned all four into vacuous passes.
AC4 guard: repo_tests/test_module_path_anchors_15181_test.py, an AST sweep of every test module on disk for Path(__file__)-anchored data files that do not exist. Reaches modules behind a collection error or in trees no workflow names. Contrast mutation: restoring parents[2] gives 4 errors again and fails the guard on both test_no_test_module_anchors_a_data_file_that_is_not_there and test_the_issue_15181_site_is_swept_and_resolves; reverted from a pristine copy, diff -q clean.
Sweep (AC3): 111 anchored data-file expressions repository-wide, 1 unresolved after the fix; 0 unresolved within autobot-infrastructure/shared/tests/. The remaining one is outside this issue's scope and is grandfathered in the guard's down-only KNOWN_UNRESOLVED with the reason recorded at the site.
autobot-infrastructure/shared/tests/test_redis_db_ssot.py now anchors at parents[1], with the reason recorded in the file. Before: 4 collected, 0 executed — 4 errors, each AssertionError: SSOT file not found. After: 4 collected, 4 executed, 4 passed, against 15 real database entries.
What they turn out to assert, now that they run: _FALLBACK_MAPPING matches the YAML exactly; every YAML name appears in DATABASE_MAPPING at the same number; DATABASE_MAPPING invents no name absent from the YAML and not a declared alias; each RedisDatabase enum member's value matches the YAML. No real failure was hiding behind the broken anchor — worth stating, because it was the open question.
One latent vacuity fixed alongside: _load_yaml_mapping returned {} if the redis_databases key were ever renamed, and all four tests iterate that mapping — four passes waiting to become vacuous. It now asserts non-empty.
test_redis_connectivity was client.ping() followed by assert True, with pytest.skip on ConnectionError. It now asserts client-not-None, pool host and port against unified_config_manager, pool db against the YAML allocation, ping() is True, and a set/get/delete round-trip on a UUID-namespaced key inside try/finally.
The skip turned out to be dead code, which is worse than the issue described: get_redis_client() catches ConnectionError internally and returns None, so the call site's except redis.ConnectionError was unreachable. Against a dead port the old test did not skip — it raised AttributeError: 'NoneType' object has no attribute 'ping'. Its only non-pass outcome was an uninformative traceback, which is why client is not None is now asserted first.
Removing the skip is safe, traced across four workflow files rather than asserted: ci.yml filters integration out of both invocations, coverage.yml and test-durations.yml filter it and do not name that tree, and marker-tests.yml — the only selector — provisions a health-gated redis:7-alpine with --health-retries 10 before any step runs.
The guard, and a correction it earned
repo_tests/test_module_path_anchors_15181_test.py sweeps 111 anchored data-file expressions across the repository, reaching modules by parsing rather than importing so it sees files behind collection errors. MIN_SWEPT_EXPRESSIONS = 100; KNOWN_UNRESOLVED holds one grandfathered entry, down-only in both directions.
An independent review found the first draft reproducing the very defect it cites — _file_anchors swallowed SyntaxError and swept an unparseable module clean. Now it raises, with KNOWN_UNPARSEABLE deliberately empty and a test that fails if it is not: 0 unreadable of 1,995 modules, so failing loudly costs nothing today.
Adding .worktrees to the skip list then exposed a latent bug: parts were matched against the absolute path, so any checkout under a directory named build, venv, dist or .worktrees swept zero. The population floor caught it on the first run — firing for real rather than hypothetically.
Sweeps
111 anchored expressions, 1 unresolved after the fix (0 within this tree, 1 before). Of the 36 tests this tree collects, 1 could not fail by assertion before, 0 after. A further 13 test_* functions there have no assertion and are collected by nothing — recorded on #15178, not here.
One figure corrected: this tree was described as having 8 marker-selected tests. Re-measured on the branch, it is 19 (16 passed, 3 skipped, 17 deselected of 36) — #15161's conftest fix restored collection the earlier count was taken under.
Activity
fix(test): make four SSOT tests run and give Redis connectivity a rea…
mrveiss commentedon Aug 28, 2026
PR #15249 (targets
Dev_new_gui).parents[2]->parents[1]. Before:collected 4 items ... 4 errors in 0.22s, every oneAssertionError: SSOT file not found: <root>/autobot-infrastructure/config/redis-databases.yaml— 4 collected, 0 executed. After:collected 4 items ... 4 passed in 0.07s— 4 collected, 4 executed. Whole tree went from7 failed, 22 passed, 3 skipped, 4 errorsto7 failed, 26 passed, 3 skipped(36 collected, the 7 pre-existing and untouched).They pass against 15 real database entries and assert:
_FALLBACK_MAPPINGidentical to the YAML; every YAML name present inDATABASE_MAPPINGat the same number;DATABASE_MAPPINGinventing no name absent from the YAML and not a declared alias; eachRedisDatabasemember's value matching the YAML. No real failure surfaced. The loader now also asserts the mapping is non-empty — it returned{}on a renamed YAML section, which would have turned all four into vacuous passes.AC4 guard:
repo_tests/test_module_path_anchors_15181_test.py, an AST sweep of every test module on disk forPath(__file__)-anchored data files that do not exist. Reaches modules behind a collection error or in trees no workflow names. Contrast mutation: restoringparents[2]gives4 errorsagain and fails the guard on bothtest_no_test_module_anchors_a_data_file_that_is_not_thereandtest_the_issue_15181_site_is_swept_and_resolves; reverted from a pristine copy,diff -qclean.Sweep (AC3): 111 anchored data-file expressions repository-wide, 1 unresolved after the fix; 0 unresolved within
autobot-infrastructure/shared/tests/. The remaining one is outside this issue's scope and is grandfathered in the guard's down-onlyKNOWN_UNRESOLVEDwith the reason recorded at the site.test(repo): an unparseable test module is an unknown, not a clean swe…
fix(test): make four SSOT tests run and give Redis connectivity a rea…
github-actions commentedon Aug 28, 2026
PR #15249 (merged to
Dev_new_gui) references this issue with a close keyword.If this issue is fully resolved, close it manually. If work remains, no action is needed.
mrveiss commentedon Aug 28, 2026
Verified in merged
Dev_new_gui— closingPR #15249 merged as
d8d45edd9.Closesdoes not fire on this branch, so closing by hand against code read from the merged base.#15181 — four tests that had never executed
autobot-infrastructure/shared/tests/test_redis_db_ssot.pynow anchors atparents[1], with the reason recorded in the file. Before: 4 collected, 0 executed —4 errors, eachAssertionError: SSOT file not found. After: 4 collected, 4 executed, 4 passed, against 15 real database entries.What they turn out to assert, now that they run:
_FALLBACK_MAPPINGmatches the YAML exactly; every YAML name appears inDATABASE_MAPPINGat the same number;DATABASE_MAPPINGinvents no name absent from the YAML and not a declared alias; eachRedisDatabaseenum member's value matches the YAML. No real failure was hiding behind the broken anchor — worth stating, because it was the open question.One latent vacuity fixed alongside:
_load_yaml_mappingreturned{}if theredis_databaseskey were ever renamed, and all four tests iterate that mapping — four passes waiting to become vacuous. It now asserts non-empty.#15182 — a test that could not fail
test_redis_connectivitywasclient.ping()followed byassert True, withpytest.skiponConnectionError. It now asserts client-not-None, pool host and port againstunified_config_manager, pooldbagainst the YAML allocation,ping() is True, and a set/get/delete round-trip on a UUID-namespaced key insidetry/finally.The skip turned out to be dead code, which is worse than the issue described:
get_redis_client()catchesConnectionErrorinternally and returnsNone, so the call site'sexcept redis.ConnectionErrorwas unreachable. Against a dead port the old test did not skip — it raisedAttributeError: 'NoneType' object has no attribute 'ping'. Its only non-pass outcome was an uninformative traceback, which is whyclient is not Noneis now asserted first.Removing the skip is safe, traced across four workflow files rather than asserted:
ci.ymlfiltersintegrationout of both invocations,coverage.ymlandtest-durations.ymlfilter it and do not name that tree, andmarker-tests.yml— the only selector — provisions a health-gatedredis:7-alpinewith--health-retries 10before any step runs.The guard, and a correction it earned
repo_tests/test_module_path_anchors_15181_test.pysweeps 111 anchored data-file expressions across the repository, reaching modules by parsing rather than importing so it sees files behind collection errors.MIN_SWEPT_EXPRESSIONS = 100;KNOWN_UNRESOLVEDholds one grandfathered entry, down-only in both directions.An independent review found the first draft reproducing the very defect it cites —
_file_anchorsswallowedSyntaxErrorand swept an unparseable module clean. Now it raises, withKNOWN_UNPARSEABLEdeliberately empty and a test that fails if it is not: 0 unreadable of 1,995 modules, so failing loudly costs nothing today.Adding
.worktreesto the skip list then exposed a latent bug: parts were matched against the absolute path, so any checkout under a directory namedbuild,venv,distor.worktreesswept zero. The population floor caught it on the first run — firing for real rather than hypothetically.Sweeps
111 anchored expressions, 1 unresolved after the fix (0 within this tree, 1 before). Of the 36 tests this tree collects, 1 could not fail by assertion before, 0 after. A further 13
test_*functions there have no assertion and are collected by nothing — recorded on #15178, not here.One figure corrected: this tree was described as having 8 marker-selected tests. Re-measured on the branch, it is 19 (16 passed, 3 skipped, 17 deselected of 36) — #15161's conftest fix restored collection the earlier count was taken under.