Repository navigation
Description
Summary
quads --cloud-only --cloud <cloud> --date "<past date>" returns the hosts currently in the cloud instead of the hosts assigned to that cloud at the requested date. The same command works on 2.2.
Steps to reproduce
- Find a host whose schedule was in
cloud03on a past date:
quads --ls-schedule --host host-a.example.com | grep cloud03
e.g.start=2025-12-29T13:00, end=2026-08-17T17:07, cloud=cloud03 - Query the same date:
quads --cloud-only --cloud cloud03 --date "2026-08-16 22:00" - Query a different date:
quads --cloud-only --cloud cloud03 --date "2026-10-02 22:00"
Both queries print the current cloud03 membership, not the historical assignment.
Expected
The hosts whose schedules overlap the requested date, even if the owning assignment was terminated later.
Actual
ScheduleDao.get_current_schedule filters Assignment.active.is_(True). Historical schedules belong to assignments that are inactive now, so they are dropped. action_cloudonly then falls through to its no-schedule branch and prints the current cloud membership.
Regression
Commit ab3dc63d (fix: skip schedules of inactive assignments, issue #746) added the active filter to src/quads/server/dao/schedule.py. That fix is still needed for current and move queries, since stale future schedules on terminated assignments must not drive moves. It must not apply to point-in-time historical queries.
Read-only evidence from a development server:
- 14
cloud03schedule rows overlap2024-06-14 17:00, all under one assignment withactive=false. - SQL with the 2.2 predicate (no active filter) returns 14 rows; the development predicate (
a.active is true) returns 0. GET /api/v3/schedules/current?cloud=cloud03&date=2024-06-14T17:00returns[].
Proposed fix
- Add
include_inactive: bool = FalsetoScheduleDao.get_current_schedule. - In
/schedules/current, set it only when the requested date is in the past. Current and future queries keep theAssignment.activefilter, so [BUG] Terminated assignments keep future schedules; get_moves ignores Assignment.active (rogue host moves) #746 remains fixed. - Add an API regression test for a past schedule on a terminated assignment.
Acceptance criteria
- A past
--cloud-only --datequery returns the historical schedule hosts. - Current and future
--cloud-onlyand/movesqueries still exclude schedules from inactive assignments. TestMovesTerminatedAssignmentpasses.
Activity
fix: include inactive assignments in past queries
fix: include inactive assignments in past queries