Skip to content

backend: keystone — switch submit/rejudge to enqueue, remove push path (slice 6/6) #66

Description

@as535364

目標:Keystone 切換——submit()/rejudge() 改走 enqueue_job,刪除全部舊 push 路徑。
範圍:刪 mongo/sandbox.py、send()/target_sandbox()/per-submission token、舊 PUT /submission/<id>/complete、PUT /config sandbox_instances 管理;舊測試改寫(TESTING/handwritten 跳過行為不變)。
Done:全套測試綠燈;grep 無舊路徑殘留。merge 後 backend 即切換,與 Sandbox keystone 協調部署(spec §15.3)。
依賴:slice 1–5/6 全部。
參考:spec §11、§15.3

Activity

  1. added
    pull-based-sandbox-runnerPull-based sandbox runner rework (spec: docs/specs/pull-based-job-dispatch.md)
    on Jul 13, 2026
  2. as535364 commented on Jul 24, 2026

    @as535364
    MemberAuthor

    Claude: 做 sandbox keystone(Normal-OJ/Sandbox#57)時發現一個跨 keystone 的缺口,先記在這裡。

    model/problem.py 的三個 testdata endpoints(/problem/<id>/meta、/testdata、/checksum)都靠 sandbox.find_by_token(query.token) 驗證,而這張票要刪 mongo/sandbox.py,刪掉後這三個 endpoints 連 import 都過不了。替代驗證需要在這張票一併定案:改吃 runner Bearer token,或暫時留一個獨立的 token 檢查。

    sandbox 端先保留了 SANDBOX_TOKEN,只給 testdata 通道用(spec §10 已同步更新)。這裡定案後再開一張小票跟進切換。

  3. as535364 commented on Jul 24, 2026

    @as535364
    MemberAuthor

    Claude: 提醒 keystone 前置義務(spec §17.2、ADR-0003 Consequences):dispatch 層的 landing 契約是 at-least-once——land_result 可能被全量重呼叫(reclaim 重跑)或在 partial write 後被 retry(見 Back-End#358 的 review 討論與 test_complete_retry_after_partial_write_reinvokes_in_full)。接線前必須驗證/修正 process_result(含 finish_judging 的 User 計數與 homework submissionIds append)對重複執行的容忍度,否則重試會重複累加副作用。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pull-based-sandbox-runnerPull-based sandbox runner rework (spec: docs/specs/pull-based-job-dispatch.md)ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions