Found in review of #78: a rig's tab with declared panes never closes, and stale pane records stay #91
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/rexcity!91
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/rexcity-o1qc1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the findings in rexcity-o1qc1 (from the review of #78): an idle rig tab with declared panes never ended, and a failed read-back after a declared pane opened failed the agent's start.
What changes
prune, which runs at every agent start, now also ends the idle rig tabs: those with no agent record or view of the rig, other than the tab of the start in hand.[[rig_tab.pane]]loses the tab of a rig that never starts again.gc rig removetakes the rig's entry fromcity.tomland its binding from.gc/site.tomland leaves the checkout, so a rig that neither[[rigs]]nor[[rig]]names is gone. Only the names are read. A city directory that is not known, a file that does not parse, or nocity.tomlkeeps the tab..rig-dirs.<sid>; a tab from an earlier version gets it at the rig's next start).README and the fragment (
.changelog/idle-rig-tabs.md) say the same.Rework of round 1 (review 241 on
385deff)rigpanes.gono longer claims that removal deletes the directory.Verification
go vet ./...,GOOS=linux go vet ./...,go test ./...and the changelog check (valid=true) pass. New tests fail without their fix (the replacement one fails with "no such tab"; the warnings one counts two). Placing a pane put back beside existing agents' panes is checked on the fake Rex only; the Operator checks it on the real one when the city declares the pane.Review of
385deffbaffor rexcity-o1qc1. Checks of the head: success.Verdict
fail
Findings
gc rig remove --help: "Removes the rig entry from city.toml and removes its machine-local path binding from .gc/site.toml". A rig is an external project directory, and its checkout stays. So aftergc rig remove kube, kube's tab and its records stay for as long as the city declares[[rig_tab.pane]], which is the case the bead reports. To fix: tell removal from what gc knows. For example, rungc rig list --jsonwith thegcthatGC_BINnames in the city directory, or read the rig bindings of the city's.gc/site.toml, which the runtime already reads forworkspace_name. Keep the missing-directory check as well. If the bead's owner accepts directory-only detection, the README (README.md:145), the fragment (.changelog/idle-rig-tabs.md:3) and the PR description must say so plainly: a rig removed withgc rig removekeeps its tab until its checkout is deleted or the declaration is dropped. The comment at :167 must be corrected too.pruneRigTabcallsrigPanesForfor each idle rig, andrigPanesForreads and validatesrexcity.tomlagain with its warnings. A file with a skipped entry or an unknown key now prints those warnings once more for each idle rig, at every start of any agent. The same goes for a recorded directory that exists but is not a directory, which warns "is not there; the tab ... keeps its panes" at every start. One fix: read the declaration once per prune, or drop the warnings in this path.ensureCityPanesstill returns the error, and a failed read-back after a declared pane opens still fails the start of an agent in the city tab (now with Rex's error instead oftab has no pane). The PR description and the README speak only of rig tabs. Either handle the city tab the same way, or state that it is left as it is.Verified
.rig-dirs.<sid>is not picked up by Names, since it has no.jsonsuffix. SaveRigDir runs under the city lock, which openTab holds.65a1054).go vet ./...passes, as doGOOS=darwin GOARCH=arm64 go vet ./...andGOOS=linux GOARCH=amd64 go vet ./....go test ./... -count=1passes in every package.go test -race ./internal/... -count=1: passes in every package.-warn missing-fragmenton the merged tree. Exit 0, no errors. The fragment holds only a### Fixedsection. A change tointernal/needs a fragment, and it is there.addMissingPanesread-back change makesTestAFailedReadBackAfterADeclaredPaneOpensDoesNotFailTheStartfail withtab has no pane, so that test tests the fix. The changed assertion inTestEachRigsTabHoldsItsOwnCopyInItsOwnDirectoryfollows from the behaviour the bead asks for.gc rig remove --helpfor what removing a rig leaves on disk.385deffbafad75baaa9dReview of
ad75baaa9dfor rexcity-o1qc1. Checks of the head: success.Verdict
pass
Findings
endRigTabcloses the whole window withCloseWindow. In the third case, panes no longer declared, only the declared blocks close, so the tab goes only with its last pane. So a pane the user split into an idle rig's tab by hand is closed along with it. So is the block the runtime itself runs in.prunespares that block (REX_BLOCK, runtime.go:389) andendRigTabdoes not. Both are unlikely, and the rig is gone anyway. Closing the recorded declared blocks, as the third case does, would leave any other pane alone. Not blocking.Round 1 (review 241 on
385deff), finding by finding:rigRemoved(rigpanes.go:278) reads only the names from[[rigs]]ofcity.tomland[[rig]]of.gc/site.toml. It reports the rig gone only when both files are read and neither names it, so a missing or broken file keeps the tab. The rig is keyed byGC_RIG(tabs.go:34), which is thenamegc writes in both files. I checked this against the live city'scity.tomland.gc/site.toml, which have the same layout. The missing-directory check stays, usingmissing(), which counts onlyErrNotExist. The comment, README, fragment and description now say thatgc rig removeleaves the checkout.pruneRigTabs).TestTheIdleRigsDoNotRepeatTheWarningsOfTheDeclarationcounts one warning. A path that is there but is not a directory no longer warns on every start.errReadBackinensureCityPanes, plus a test. The README and the fragment state that opening the city tab for the first time is not covered.replaced()takes the closed block out before the read-back, withTestReplacedandTestAFailedReadBackAfterAReplacementLeavesNoClosedBlockInTheTab.Verified
pruneandopenTabas merged.pruneRigTabsruns under the city lock thatopenTabholds.prunereads the windows again after it, so a tab closed there is not acted on twice.369b5a8, which has moved since the branch was cut (merge 25df68b). All checks below ran on the merged tree.go vet ./...passes, and so doGOOS=darwin GOARCH=arm64 go vet ./...andGOOS=linux GOARCH=amd64 go vet ./....go test ./... -count=1passes in every package, includingpacksandchart.go test -race ./internal/... -count=1passes in every package.v2tag) from the module cache and ran it with-warn missing-fragment. It printedvalid=true, exit 0. The fragment holds only### Fixed, as REVIEW.md asks for a change tointernal/.rigRemovedalways false failsTestAnIdleRigTabEndsWhenTheRigIsRemovedFromTheCityAndItsCheckoutStays.missingalways false failsTestAnIdleRigTabEndsWhenTheRigsDirectoryIsGone.rigRemovedtrue whenever both files parse fails the "still in city.toml" and "still bound in site.toml" cases.replacedfails the replacement test.errReadBackbranch failsTestAFailedReadBackAfterADeclaredPaneOpensDoesNotFailTheCityTabsStart.