Skip to content

list_workspaces reports empty when it merely failed to read #120

Description

@blooop

Question

dl still reports "no workspaces" when it merely failed to read them. Fix the
production copy of the defect a dev task just stopped making.

Graduated from PR #118's review,
which found this while checking that the PR did what it claimed. It is the
sharpest kind of finding: the PR body describes eliminating exactly this shape,
and it eliminated it in a dev task and a test helper while production keeps doing
it.

devlaunch/dl.py:930-937list_workspaces() returns [] for both a failed
devpod list and an unparseable one. Demonstrated live by the reviewer. Callers
cannot distinguish "devpod says there are none" from "devpod could not be asked",
and they do not try.

The new devlaunch/devpod_provider.py:18-22 argues the opposite in its own
comments — that unreadable is not empty — and models it with an
UnreadableProviderList exception. So the repo now holds both positions at once,
in the same package, one of them in the code users actually run.

Why it matters beyond tidiness. purge_all_data() iterates
list_workspaces(). A silent [] there means a purge that quietly does nothing
looks identical to a purge that had nothing to do. Elsewhere the same [] can
read as "this workspace does not exist yet", which is the wrong branch to take
when the truth is "I could not tell".

Principle 3 is the whole ticket. Two outcomes are being collapsed into one
representation. Make the distinction one the type system states rather than one a
caller has to remember — and note that devpod_provider.py has already chosen a
shape for this in this very repo, so consistency (the map's tiebreak) points at
reusing it rather than inventing a second spelling. Run
/constructive-modeling on whatever you land.

Also fold in the smaller sibling the same review named: ensure_provider's
add-failure path raises a bare RuntimeError (devpod_provider.py:83) and omits
capture_output, so its message carries no stderr while its neighbour at :65
does — and main()'s except (UnreadableProviderList, RuntimeError) (:108) is
redundant, since the first subclasses the second, so it will swallow unrelated
RuntimeErrors.

This is a wayfinder:build ticket: go through /tdd.

Test-first. The red test is a devpod list that fails, and a caller that must
not conclude "empty". Both failure modes want covering — non-zero rc and
well-formed-but-unparseable output — because they are the two the current code
merges.

Relation to #107. That
ticket teaches --purge which workspaces are devlaunch's. This one is about
whether the list can be trusted at all. They meet in purge_all_data(), and #107
should be able to assume a trustworthy list — but they are separable and neither
blocks the other. Whichever lands second should not re-litigate the first.

Activity

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions