fix(research): remove template scope constraints and migrate stored templates
Deploy production / deploy (push) Successful in 55s
Deploy production / deploy (push) Successful in 55s
This commit is contained in:
@@ -585,3 +585,25 @@ async def test_native_bot_creates_template_and_immutable_version(app, logged_in)
|
||||
assert conflict.value.status_code == 409
|
||||
old = (await logged_in.get(f"/api/v1/research/assets/{created['id']}?version=1")).json()
|
||||
assert old["content"]["description"] == "测试经济假设"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("candidate_settings", [{"region": "EUR"}, {"universe": "TOP1000"}, {"delay": 0}])
|
||||
async def test_preparation_scope_must_still_match_candidate_settings(app, logged_in, research_input, candidate_settings):
|
||||
body = expansion(research_input["id"])
|
||||
body["input_ids"] = []
|
||||
body["preparation_refs"] = [{"id": research_input["preparation_id"], "version": research_input["preparation_version"]}]
|
||||
body["settings"].update(candidate_settings)
|
||||
response = await logged_in.post("/api/v1/research/experiments", json=body)
|
||||
assert response.status_code == 422 and "输入快照与研究范围不一致" in response.text
|
||||
async with app.state.sessions() as db:
|
||||
assert await db.scalar(select(func.count()).select_from(ResearchExperiment)) == 0
|
||||
|
||||
|
||||
async def test_template_contract_rejects_removed_scope(logged_in):
|
||||
from app.research.workspace_contracts import TemplateSpec
|
||||
|
||||
content = template() | {"scope": SCOPE}
|
||||
response = await logged_in.post("/api/v1/research/assets", json={"kind": "template", "content": content})
|
||||
assert response.status_code == 422, response.text
|
||||
assert "scope" in response.text
|
||||
assert "scope" not in TemplateSpec.model_json_schema()["properties"]
|
||||
|
||||
Reference in New Issue
Block a user