Add tests for the startup-grace chain through _run_once and the refusal re-stamp
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Read server/orcaster_server/housekeeping.py around _run_once and _expire_assigned, then review the existing DB helpers in server/tests/test_housekeeping.py and refusal tests in server/tests/test_poll_task_secrets.py. First determine how the other housekeeping passes interact with the test database. Done means real Postgres tests cover both grace outcomes and the restart, refused poll, re-stamp chain, with the required keyword-only argument updated at every caller.
Written by the indexing model from the issue text.
Description
Problem
The startup grace keeps the pre-assigned execution of a refused worker alive after a server restart. Two links of this protection have no test that checks the real behavior end to end. A later refactor can break the protection and leave the suite green.
_run_oncepasses the flag to the expiry step:_expire_assigned(engine, in_grace=in_grace)(server/orcaster_server/housekeeping.py:556)._expire_assignedhas a default value,in_grace: bool = False(server/orcaster_server/housekeeping.py:445). A call without the argument is valid and silently means "no grace".- The DB tests for the grace call
_expire_assigneddirectly (server/tests/test_housekeeping.py:359). They never go through_run_once. - Every test that calls
_run_oncepassesengine=Noneand mocks the passes (for exampleserver/tests/test_housekeeping.py:935,:966). The assertions on_expire_assigned(:941,:971) check the wiring only. No test runs the real SQL through_run_once. - The protection needs two steps. First, the grace pass keeps the execution although the refusal mark is old. Second, the refused poll of the returning worker re-stamps the mark (
_SQL_POLL_MARK_SECRETS_REFUSED,server/orcaster_server/api/poll.py:984), so the first pass after the grace sees a fresh mark. Each step has its own test. No test chains the two. If the re-stamp stopped working after a restart, no test would fail. - After a restart the in-memory state is empty (
_refusal_mark_written,_refusal_memory,server/orcaster_server/api/poll.py:1018-1019). A chained test must clear both to model a restart.
Proposed change
- Add a DB test that calls
_run_once(engine, settings, in_grace=True)against real Postgres. Use a worker with a refusal mark aged 10 minutes and an overdueassignedexecution of a task that declarestask_env. Assert the status staysassigned. Run the same setup within_grace=Falseand assertexpired. The helper_expire_with_refused_worker(server/tests/test_housekeeping.py:312) is a base. - Add one chained test in
server/tests/test_poll_task_secrets.py:- age the mark to 10 minutes and make the execution overdue;
- run a pass with
in_grace=Trueand assertassigned; - clear
poll._refusal_mark_writtenandpoll._refusal_memory(a restart) and poll as the refused worker; - assert the mark is fresh (younger than 120 s);
- run a pass with
in_grace=Falseand assertassigned.
- Make
in_gracea required keyword-only argument of_expire_assigned, and update the callers in the tests (server/tests/test_housekeeping.py:279,server/tests/test_poll_task_secrets.py:1534and the others). A missing argument then raisesTypeError.
Acceptance criteria
- A DB test runs
_run_once(engine, settings, in_grace=True)with a stale mark and asserts the execution isassigned. - A DB test runs
_run_once(engine, settings, in_grace=False)with the same setup and asserts it isexpired. - A chained test covers: grace pass keeps the execution, a refused poll re-stamps the mark, a pass after the grace still keeps it.
- If
in_grace=in_graceis removed from the call atserver/orcaster_server/housekeeping.py:556, at least one DB-level test fails. -
in_graceis a required keyword-only argument of_expire_assignedand all callers are updated. - Production behavior does not change: only tests and an internal function signature.
- Lint, format check and the two test files pass.
- CHANGELOG entry under Unreleased, if the maintainers record test-only changes there.
Open questions
_run_oncealso runs other passes (offline marking, lease reclaim, sticky pool, artifact reconcile, over-commit check). Are they harmless against the test database, or should the new test patch them so only the expiry step uses real SQL?
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
[Resource]: SpaicelyOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 68/100
hesreallyhim/awesome-claude-code#3875 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bvis/aegis-hass#725 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xPossibly taken @NimaVaziri claimed this today. OpenPytorch
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainers usually reply within 1 day