fix: allow repeated platform checks and unify Alpha metric formatting
Deploy production / deploy (push) Successful in 54s
Deploy production / deploy (push) Successful in 54s
This commit is contained in:
@@ -359,4 +359,7 @@ async def run_check(runner, job_id, payload):
|
||||
setattr(alpha, key, value)
|
||||
db.add(JobItem(job_id=job_id, alpha_id=alpha_id))
|
||||
job.processed = 1
|
||||
job.checkpoint = {"alpha_id": alpha_id, "phase": "checked", "checked_at": now().isoformat()}
|
||||
job.checkpoint = {
|
||||
"alpha_id": alpha_id, "phase": "checked", "checked_at": now().isoformat(),
|
||||
"review_snapshot": fingerprint(source(alpha.raw)),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"""A completed check can be repeated using its resulting review snapshot."""
|
||||
|
||||
from tests.test_submission import FIELDS, Description, setup
|
||||
|
||||
|
||||
async def test_repeat_check_uses_resulting_snapshot_without_repatch(app, logged_in):
|
||||
platform = await setup(app)
|
||||
url = "/api/v1/alphas/alpha1/submission"
|
||||
state = (await logged_in.get(url)).json()
|
||||
job_ids = []
|
||||
for _ in range(2):
|
||||
response = await logged_in.post("/api/v1/alphas/alpha1/submission-check", json={
|
||||
"snapshot": state["snapshot"], "descriptions": {"regular": Description(**FIELDS).text()},
|
||||
})
|
||||
assert response.status_code == 202
|
||||
job_ids.append(response.json()["id"])
|
||||
await app.state.runner.execute(job_ids[-1])
|
||||
state = (await logged_in.get(url)).json()
|
||||
assert state["job"]["status"] == "completed"
|
||||
assert state["job"]["checkpoint"]["review_snapshot"] == state["snapshot"]
|
||||
assert job_ids[0] != job_ids[1]
|
||||
assert len(platform.patches) == 1
|
||||
assert platform.calls.count(("GET", "/alphas/alpha1/check")) == 2
|
||||
Reference in New Issue
Block a user