Skip to content

Commit 977cec6

Browse files
PRAteek-singHWYnorthdpole
authored andcommitted
week_3: address CodeRabbit findings on #937
- config_loader_test: assert retriever_backend in both the defaults and the override tests (was the only LibrarianConfig field left unchecked). - __init__.py: refresh the stale 'No linking logic yet' scope note to reflect W1 contracts + W2 C.0 boundary + W3 C.1 retriever. Other #937 CodeRabbit findings were already addressed on this branch (knowledge_source model_validate_json error handling, schemas AnyUrl/datetime fields, section_validator assert->if, test_config_is_frozen isolation + FrozenInstanceError, dataset_test subprocess timeout, build_golden_dataset unused loop var).
1 parent ae94de8 commit 977cec6

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

application/tests/librarian/config_loader_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class TestConfigLoaderDefaults(unittest.TestCase):
1010
def test_defaults_when_env_unset(self):
1111
with mock.patch.dict(os.environ, {}, clear=True):
1212
cfg = load_config()
13+
self.assertEqual(cfg.retriever_backend, "in_memory")
1314
self.assertEqual(cfg.crossencoder_model, "cross-encoder/ms-marco-MiniLM-L-6-v2")
1415
self.assertEqual(cfg.top_k_retrieval, 20)
1516
self.assertEqual(cfg.top_k_rerank, 5)
@@ -27,6 +28,7 @@ def test_config_is_frozen(self):
2728

2829
class TestConfigLoaderOverrides(unittest.TestCase):
2930
OVERRIDES = {
31+
"CRE_LIBRARIAN_RETRIEVER_BACKEND": "pgvector",
3032
"CRE_LIBRARIAN_CROSSENCODER_MODEL": "cross-encoder/other",
3133
"CRE_LIBRARIAN_TOP_K_RETRIEVAL": "50",
3234
"CRE_LIBRARIAN_TOP_K_RERANK": "10",
@@ -39,6 +41,7 @@ class TestConfigLoaderOverrides(unittest.TestCase):
3941
def test_env_overrides_apply(self):
4042
with mock.patch.dict(os.environ, self.OVERRIDES, clear=True):
4143
cfg = load_config()
44+
self.assertEqual(cfg.retriever_backend, "pgvector")
4245
self.assertEqual(cfg.crossencoder_model, "cross-encoder/other")
4346
self.assertEqual(cfg.top_k_retrieval, 50)
4447
self.assertEqual(cfg.top_k_rerank, 10)

application/utils/librarian/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
W1 (C.-1): contracts + config + eval harness + golden dataset.
1414
W2 (C.0): input boundary — SectionValidator (validate/adapt without
1515
re-normalizing text) and ExplicitLinkResolver (fail-safe
16-
explicit-link resolution). No retrieval/ranking logic yet.
16+
explicit-link resolution).
17+
W3 (C.1): candidate retriever (in-memory + pgvector) + pipeline switch.
18+
Cross-encoder rerank (C.2, W4) onward is not built yet.
1719
1820
Vendored RFC JSON schemas live under ``_rfc_schemas/``. They are pinned to
1921
upstream/owasp-graph @ 2b1437987768d5ed20fe9ee721ab9a898c4b84af (PR #734).

0 commit comments

Comments
 (0)