Skip to content

Review fixes, batch 2: output fields, threads, archived keys, clearing fields, help, key echo, doctor - #14

Open
CorySchulz wants to merge 15 commits into
release/0.3.2from
feat/review-fixes-2
Open

CorySchulz wants to merge 15 commits into
release/0.3.2from
feat/review-fixes-2

Conversation

@CorySchulz

@CorySchulz CorySchulz commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Task output fields

List rows now carry priority and due_date. task get adds start_date, estimate_hours, completed_at, guest_visible and created_at, all from the model.Task the server already sends. A null value stays null. estimate_hours is always null for a guest, because the server withholds it.

Comment threads

A reply carries parent_id, the root comment it answers. The replies array is gone: the server never sends one, so each root printed replies: [] beside its own reply. parent_id is now the only record of a thread.

Task keys resolve exactly

A key such as WEB-42 resolves in two steps. The prefix finds the project in the cached project list, then GET /v1/projects/{id}/tasks/by-number/42 reads the task. This replaces full-text search, which skipped archived tasks, and there is no fallback.

An unknown prefix or number is not_found (kind task), exit 5. The task row read to resolve the key is kept: task get without --expand returns it, and the default stage for task comment and comment list comes from its status. Neither reads the task a second time.

Every page of the project list

listProjects asks for pages of 100, the server's maximum, and follows the keyset cursor until it is null. Before, it read only the first 50 projects (the server default). A member of more projects could not reach the rest through --project, project list or a task key.

null clears a field

On the command line, the literal null becomes JSON null for any field whose schema is nullable. This happens in coerce, the one place argv values are coerced. The task update summary now says this.

One name for the estimate

The task update input is now estimate_hours, as on output and on task create, and it is sent as the estimate the PATCH reads. --estimate still reaches it on the command line. Before, an MCP call with estimate_hours: null was stripped by the schema and still reported success.

Help anywhere

-h or --help anywhere in magic <product> … prints the product help and runs nothing.

Keys masked in errors

renderError, the single error exit, masks every key-shaped token in what it prints, in JSON and in text. A key-shaped token is <product>_<public id>_ followed by 32 or more letters and digits. It keeps the public part and the last four characters. maskKey uses the same rule, and ordinary typos are still quoted.

Doctor and unused products

Each product resolves its credential once, first. The product is in use if it has a key, even one that does not resolve yet, and that sets the severity of both checks:

  • Unreachable API with no key: a warning.
  • Unreachable API with a key: a failure.

Doctor still has two "has a key" checks: anyCredential for the whole machine, and inUse for each product. They are not folded into one. Folding means moving productConfig and resolveCredential into a first pass, which costs about as much as the nine lines it would save. The two checks also differ only in odd store states: an index entry whose session item is missing, or a stored item with an empty value.

Cleanup

  • Deleted the hand-written input interfaces in types.ts that nothing imports (UpdateTaskInput and six others). They had already drifted from the zod schemas, which are the truth.
  • Removed a second description assignment in hydrateTaskDetail.
  • Removed the unused GET /v1/search/tasks test route.
  • Removed the ref.projectId ? getWorkflow(…) : EMPTY_WORKFLOW guards in task comment, comment list, task timeline and hydrateDetailFor. A resolved task's row always carries project_id, so the fallback never ran.
  • In the test fake, page 1 of the project list is keyed exactly (?limit=100). A client that asks for a page wrongly now fails at once with the fake's 404, not after a timeout.

Behaviour changes

  • Task output gains priority and due_date on list rows, and five more fields on task get.
  • Replies carry parent_id, and comments no longer carry replies.
  • Archived tasks are reachable by key.
  • project list, --project and task keys reach every project, not only the first 50. A member of more than 100 projects costs one extra request per 100.
  • task get without --expand makes one request fewer. task comment and comment list make one fewer when no stage is given.
  • null clears a nullable field on the command line.
  • Renamed input: the task update estimate is estimate_hours. An MCP caller that sends estimate now has it ignored. --estimate still works on the command line.
  • -h or --help after a command shows the product help, so a value of exactly -h or --help can no longer be passed.
  • Keys are masked in error output. maskKey on a key whose secret is shorter than 32 characters shows only the prefix; no product mints such a key.
  • magic doctor warns, instead of failing with exit 10, when a product with no key is out of reach.

Measurements

base cd73c84 head 669fed4 change
src lines 8322 8264 −58 (+140 / −198)
bundle, raw bytes 182488 182922 +434
bundle, gzip -9 (sum per file) 51239 51763 +524
tests 337 passed, 2 skipped 352 passed, 2 skipped +15

Per commit:

commit src lines gzip bytes
task output fields +19 +118
comment parent_id +3 +24
exact task keys +10 +154
null clears a field +7 +50
help anywhere +1 −1
keys masked +5 +164
doctor +2 +55
every page of the project list +8 +91
drop replies −21 −59
estimate_hours 0 −14
delete unused input interfaces −73 0 (types only)
drop repeated description −3 −10
reuse the task row −6 −38
drop the dead project guards −10 −10
page-1 key in the fake (test only) 0 0

The key-masking commit is −1 raw byte. Its gzip rise is chunk order, not code: render now imports credentials, so esbuild places render, operation, argv and cli after credentials in the shared chunk. The bundle is not minified, so JSDoc counts toward these sizes.

🤖 Generated with Claude Code

CorySchulz and others added 15 commits November 21, 2026 17:46
…output

Hydration dropped seven fields the server sends on every task row
(model.Task). A list row now carries `priority` and `due_date`, the two
fields work is picked by; `task get` adds `start_date`, `estimate_hours`,
`completed_at`, `guest_visible` and `created_at`. Values are copied
through as sent, so null stays null (a guest's estimate is always null).

The test fixture is the server's own model.Task shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`comment list` returns roots and replies in one flat page, and hydration
dropped `parent_id`, so a reply could not be told from a root comment. A
reply now carries `parent_id` (the root it answers); a root has no such
key. The server allows one level of replies, so `thread_root_id` adds
nothing and is not copied.

The test fixture is the server's model.Comment shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hable

A key like WEB-42 was turned into a task through full-text search, and
search skips archived tasks (search.sql), so `task archive WEB-42
--unarchive` failed with task_not_found. A key is an exact identifier: its
prefix names the project (from the resolver's cached project list) and
GET /projects/{id}/tasks/by-number/{n} reads the task, archived or not.
This replaces the search call; there is no fallback beside it.

An unknown prefix is still task not_found. The lookup shares the project
list's reach with `--project`: the first page of live projects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`magic pyramid task update WEB-42 --owner null` sent the string "null"
(then user_not_found) and `--description null` stored the text "null",
though MCP clears both with JSON null. argv's one coercion step now turns
the literal `null` into JSON null for any field whose zod schema is
nullable, in both `--flag null` and `--flag=null`. It holds for every
nullable field of every operation; elsewhere `null` stays text.

`task update`'s `estimate` becomes nullable: the server's PATCH clears
estimate_hours on `"estimate": null` (task_requests.go, UpdateTask SQL),
as it does description, due_date, start_date, owner_id and reviewer_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Help was recognised only as the first token after the product. After a
command, `--help` was an unknown flag and `-h` became a positional:
`magic pyramid task comment WEB-42 -h` posted a comment reading "-h" and
`task create -h --project web` created a task titled "-h". The existing
check now also matches `--help` / `-h` anywhere in the arguments: it
prints the product help to stderr, exits 0 and runs nothing. `help`
still counts only as the first word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A key typed as an argument (`magic login <key>`, `--product <key>`) was
echoed whole in the usage error. renderError, the one error exit, now masks
every key-shaped token in what it prints, JSON and text alike, with the rule
maskKey uses: `<product>_<public id>_` kept, a secret of 32+ letters and
digits cut to its last four. Ordinary typos are still quoted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…each

`magic doctor` failed with exit 10 whenever any product's API was out of
reach, even one never used. Each product now resolves its credential once,
first; whether it is in use (has a key, even one that does not resolve yet)
sets both checks: an unreachable API fails a product in use and warns for
one that is not, and a missing key warns while anything else is signed in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
listProjects read the first page only (50 projects, the server default),
so a member of more projects could not reach the rest by `--project`, by
`project list` or, since keys resolve through the project list, by task
key. It now asks for pages of 100, the server's maximum, and follows the
keyset cursor until it is null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comments come back flat, each reply with `parent_id`; no response carries
a `replies` array. So every root printed `replies: []` beside its own
reply. The property, `hydrateReply` and `TaskComment.replies` are gone:
`parent_id` is the one thread truth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Output and `task create` say `estimate_hours`, but `task update` took
`estimate`, so an MCP call with `estimate_hours: null` was stripped by the
schema and reported success. The update input is now `estimate_hours`,
sent as the `estimate` the PATCH reads; `--estimate` still reaches it.
The summary now says null clears any nullable field, not only
owner/reviewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UpdateTaskInput, CreateTaskInput, CreateTasksBulkInput, MoveTaskInput,
AddCommentInput, ReplyCommentInput and CustomFieldValue mirrored the zod
schemas by hand and had already drifted (UpdateTaskInput still said
`estimate`). No module imports them; the zod schemas are the truth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hydrateTaskDetail set `description` again after the summary had set it the
same way. The CLI test's `GET /v1/search/tasks` stub stayed behind when
task keys stopped resolving through search; nothing requests it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
resolveTaskRef reads the whole task and kept three fields. `task get`
without --expand then read the same task again, and currentStageId read
it a third time on `task comment` and `comment list`. The ref now carries
the row: `task get` returns it, and the current stage comes from its
status. The unused `stage_id` fallback goes too (model.Task has none).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A resolved task's row always carries `project_id` (a uuid.UUID, never
null), so the `ref.projectId ? getWorkflow(…) : EMPTY_WORKFLOW` guards in
task comment, comment list, task timeline and hydrateDetailFor never took
their fallback. In task comment and comment list the default-stage path
had already called getWorkflow(ref.projectId) unguarded before them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s fast

Page 1 of the fake's project list was served by the path-only fallback, so
a client sending the wrong paging parameters got page 1 forever and the
test died as a timeout. Page 1 is now `GET /v1/projects?limit=100`, and
both paging tests check stderr first: a wrong query fails at once, naming
the fake's "no route /v1/projects".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant