Repository navigation
fix: read import's stdin and terminal check through Deps, update the no_verify comment, send area uuids as area-id - #344
Merged
Merged
Conversation
import read os.Stdin directly instead of Deps.Stdin, and Deps.interactive checked the real stdin through the global isInteractive. Deps gains a TTY func, defaulting to the real check, and import uses it and d.in().
Things matches add-project's area by title only, so project add --area <uuid> created the project under no area. A uuid of an area now goes as area-id.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last follow-ups from the add/edit read-back work: two small cleanups to how
Depsreads stdin, an out-of-date config comment, and aproject add --area <uuid>bug found while fixing the same bug inadd(#343).What was wrong
importreados.Stdindirectly instead of throughDeps.Stdin(d.in()), the reader the prompts use. A caller that supplied stdin throughDepswasn't the one read.Deps.interactive()checked the real stdin through the globalisInteractive(). A caller could not inject that check, the way it can inject Stdin and Stderr.no_verifycomment in the config template still said it covered only "a complete/cancel or an edit". Since feat(add): read back the created item and print it as show does #332 it also covers add, and it covers tag creation and import status changes too. The--no-verifyhelp and the configuration page already said so.project add --area <uuid>created the project under no area, though the help says "Area name or UUID". Things matchesareaby title only. I confirmed this with a throwawayzz things-cli testproject in the real app.What changed
DepsgainsTTY func() bool. When it is nil, the CLI checks the real terminal, the same way Stdin and Stderr fall back to the real streams.interactive()andimportboth use it through a newstdinTTY().importreads its payload fromd.in().docs/content/configuration.mdis regenerated to match, whichTestDocsPageQuotesTheTemplatechecks. This is a comment-only change to the template text.project addresolves--areawithdb.FindAreaUUID. When the value is an area's UUID it is sent asarea-id; a title is still sent asarea. A second throwaway project with the fix landed in the right area. Both throwaway projects are in the Trash.docs/content/commands.mdandinternal/skill/SKILL.mdsay--areatakes a UUID.Tests
TestRunImportReadsDepsStdin:importwith a payload inDeps.Stdin. On the unfixed code it read the real stdin and failed with "empty payload".TestInteractiveUsesDepsTTY: an injected terminal letsconfirmActionprompt and read the answer,--jsonstill turns prompting off, andimporton that terminal gives the "no JSON on stdin" error. It does not compile on the unfixed code, because there was nowhere to inject the check.TestProjectAddSendsUUIDAsAreaID: a UUID goes asarea-idwith noareabeside it, and a title or an unknown name goes asarea. The UUID case failed on the unfixed code.make testandmake lintpass./code-review medium --fixfound nothing.