fix(s31): close 2 review findings — drop description from the embedding + re-derive SC2 on the minted shape
This commit is contained in:
parent
921a8daf71
commit
969d450b31
3 changed files with 172 additions and 43 deletions
|
|
@ -77,17 +77,36 @@ def test_fake_embedder_is_insensitive_to_code_set_ordering() -> None:
|
|||
|
||||
|
||||
def test_distinct_features_give_distinct_vectors() -> None:
|
||||
"""SC4, NARROWED: "distinct" means distinct in the EMBEDDED fields — the structural triple.
|
||||
The description-only variant moved to the test below, which asserts the opposite."""
|
||||
embedder = FakeEmbedder()
|
||||
baseline = embedder(_features())
|
||||
for variant in (
|
||||
_features(codes=frozenset({"09.1"})),
|
||||
_features(measure_type="rate_renegotiation"),
|
||||
_features(saving=900_000.0), # different magnitude bucket
|
||||
_features(description="totally different wording"),
|
||||
):
|
||||
assert not np.array_equal(baseline, embedder(variant))
|
||||
|
||||
|
||||
def test_features_differing_only_in_description_embed_identically() -> None:
|
||||
"""SC4's narrowing, asserted POSITIVELY rather than left implicit — this is the same
|
||||
assertion the loop above used to carry, with the opposite sign.
|
||||
|
||||
``description`` is excluded from the embedding on purpose: ``verdicts.similarity`` already
|
||||
ignores text by design and ``verdicts._mint_id`` already hashes only the structural triple, so
|
||||
two proposals differing only in prose are ONE verdict as far as the rest of the system is
|
||||
concerned. Leaving the embedding as the sole place surface text still counted made the
|
||||
framework's own restatement of a query outrank real expert prose (defect P1).
|
||||
|
||||
Detach point: put ``features.description`` back into ``_canonical_feature_string`` → RED."""
|
||||
embedder = FakeEmbedder()
|
||||
assert np.array_equal(
|
||||
embedder(_features()),
|
||||
embedder(_features(description="totally different wording")),
|
||||
)
|
||||
|
||||
|
||||
def test_fake_embedder_components_are_non_negative() -> None:
|
||||
"""Non-negative components keep ``cosine`` in [0, 1], matching the structural score's
|
||||
range — no scale mismatch when the two are blended by HybridRanker."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue