fix(review): Create title no silent fail; gate enables content LLM
Create title used to look enabled while review echoed a pre-typed title when species/primary were missing from taxonomy (no error). Persist wood cats before the deterministic build, return title_built / title_build_missing from review, and surface a Create-title nudge like Create desc. WooSetupGate now turns on content_llm_enabled when inference URL+key are set (Call 2 / Create desc). Call 1 stays out. Create-desc gate also requires inference URL+key so empty Settings show a clear missing list.
This commit is contained in:
@@ -62,6 +62,8 @@ def test_title_live_edge_no_dims(env):
|
||||
body = r.json()
|
||||
assert body["title"] == "Figured Black Walnut Live Edge Slab"
|
||||
assert body["short_description"].startswith("Figured Black Walnut Live Edge Slab, 9ft 6in x 24.3in x 1.75in")
|
||||
assert body["title_built"] is True
|
||||
assert body["title_build_missing"] == []
|
||||
assert "18.4 bdft" in body["short_description"]
|
||||
|
||||
|
||||
@@ -220,3 +222,25 @@ def test_ready_requires_figure_term_ids(env):
|
||||
})
|
||||
# May still miss other fields depending on fixture; figure must not be listed
|
||||
assert "figure_term_ids" not in missing2
|
||||
|
||||
|
||||
def test_review_title_built_false_without_species_or_primary(env):
|
||||
"""Create-title silent-fail fix: report title_built=false when taxonomy cannot resolve."""
|
||||
client, conn = env
|
||||
conn.execute(
|
||||
"INSERT INTO slabs(id,sku,length_in,thickness_in,sqft,bdft,width_min_in,width_max_in,width_avg_in,"
|
||||
"species_id,wood_category_ids,figure_term_ids,price,price_source,title,short_description,description,"
|
||||
"content_source,status,server_rev,client_rev,created_at,updated_at) "
|
||||
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
("s1", None, 114.0, 1.75, 30.0, 18.4, 18.0, 24.3, 24.3, None, "[]", "[]", None, None,
|
||||
"Typed Title", None, None, "manual", "calibrated", 1, 1, "t", "t"),
|
||||
)
|
||||
conn.commit()
|
||||
r = client.post("/api/v1/slabs/s1/review", json={})
|
||||
assert r.status_code == 200, r.text
|
||||
body = r.json()
|
||||
assert body["title_built"] is False
|
||||
assert "species" in body["title_build_missing"]
|
||||
assert "primary_wood_category" in body["title_build_missing"]
|
||||
assert body["title"] == "Typed Title"
|
||||
assert body["short_description"] is None
|
||||
|
||||
Reference in New Issue
Block a user