Fix thesis seed metadata serialization
This commit is contained in:
parent
6b1e520845
commit
334b3f43c2
2 changed files with 17 additions and 1 deletions
|
|
@ -657,7 +657,9 @@ class VentureDiscoveryService:
|
||||||
for name, thesis, category, status in seeds:
|
for name, thesis, category, status in seeds:
|
||||||
existing = PortfolioThesis.objects.filter(canonical_name=name).first()
|
existing = PortfolioThesis.objects.filter(canonical_name=name).first()
|
||||||
historical = self.historical_thesis_stats(name)
|
historical = self.historical_thesis_stats(name)
|
||||||
defaults = {"concise_thesis": thesis, "category": category, "status": status, "metadata": {"dogfood_seed": True, "historical": historical}}
|
historical_metadata = {key: value for key, value in historical.items() if key != "best_company"}
|
||||||
|
historical_metadata["best_company"] = historical["best_company"].title if historical["best_company"] else ""
|
||||||
|
defaults = {"concise_thesis": thesis, "category": category, "status": status, "metadata": {"dogfood_seed": True, "historical": historical_metadata}}
|
||||||
if historical["proposal_count"]:
|
if historical["proposal_count"]:
|
||||||
defaults.update({"proposal_count": historical["proposal_count"], "best_ic_score": historical["best_ic_score"], "best_company": historical["best_company"]})
|
defaults.update({"proposal_count": historical["proposal_count"], "best_ic_score": historical["best_ic_score"], "best_company": historical["best_company"]})
|
||||||
if existing is None:
|
if existing is None:
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,20 @@ def test_v03_thesis_registry_mandate_and_territory_allocation() -> None:
|
||||||
assert mandate.opportunity_territories[-2:] == [OpportunityTerritory.OPEN_CATEGORY, OpportunityTerritory.OPEN_CATEGORY]
|
assert mandate.opportunity_territories[-2:] == [OpportunityTerritory.OPEN_CATEGORY, OpportunityTerritory.OPEN_CATEGORY]
|
||||||
|
|
||||||
|
|
||||||
|
def test_v03_registry_seed_historical_metadata_is_json_serializable() -> None:
|
||||||
|
svc = service()
|
||||||
|
proposal = svc.generate_single_company(svc.create_v0_mandate())
|
||||||
|
proposal.title = "RFP Historical Candidate"
|
||||||
|
proposal.description = "AI RFP response drafting for SaaS teams."
|
||||||
|
proposal.proposed_solution = "RFP proposal automation."
|
||||||
|
proposal.save(update_fields=["title", "description", "proposed_solution", "updated_at"])
|
||||||
|
|
||||||
|
svc.seed_dogfood_thesis_registry()
|
||||||
|
|
||||||
|
thesis = PortfolioThesis.objects.get(canonical_name="AI RFP response automation for B2B SaaS")
|
||||||
|
assert isinstance(thesis.metadata["historical"]["best_company"], str)
|
||||||
|
|
||||||
|
|
||||||
def test_v03_novelty_gate_blocks_hard_exclusion_and_allows_soft_exception() -> None:
|
def test_v03_novelty_gate_blocks_hard_exclusion_and_allows_soft_exception() -> None:
|
||||||
svc = service()
|
svc = service()
|
||||||
cohort = svc.prepare_cohort(size=2)
|
cohort = svc.prepare_cohort(size=2)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue