Skip to content

Add employee home and work address update commands - #151

Open
ashieh wants to merge 1 commit into
mainfrom
employee-update-address
Open

Add employee home and work address update commands#151
ashieh wants to merge 1 commit into
mainfrom
employee-update-address

Conversation

@ashieh

@ashieh ashieh commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds employee update-home-address and employee update-work-address write commands, PUTting to /v1/home_addresses/{uuid} and /v1/work_addresses/{uuid}.
  • Both are partial updates: only the flags passed change, and both use a shared optimistic-concurrency version helper that auto-fetches the current version unless --record-version is supplied.
  • Adds a shared putResourceWithVersion helper in api-context.ts so future versioned PUT commands reuse the same version handling, confirm gate, and dry-run behavior.

Linked issue

None.

Test plan

  • bun run test:all passes locally
  • Manual run of touched commands works against sandbox
  • --agent and --human output verified where touched

DCO

  • Every commit is signed off (git commit -s) per the DCO

Both PUTs are keyed on the address UUID and require an optimistic-
concurrency version. The version is auto-fetched by default (with a
--record-version override), reusing the shared version helper so the
behavior matches the raw api-request path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Austin Shieh <austin.shieh@gusto.com>
@ashieh
ashieh marked this pull request as ready for review July 24, 2026 19:23
@ashieh
ashieh requested a review from a team as a code owner July 24, 2026 19:23
Comment thread src/lib/api-context.ts
},
};
}
const response = await resolved.ctx.client.request("PUT", path, injected.body);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

putResourceWithVersion's try/catch wraps both the version GET and the PUT, so a failed version fetch, a 409/412 version conflict on the PUT, and a random network blip on the PUT all collapse into the same generic toResult(err). For a write, the version-conflict case especially deserves its own signal — that's the entire reason this function does a GET-then-PUT. There's also no test that makes either call in this block fail, so a regression here wouldn't get caught.

Comment thread src/lib/api-context.ts
if (!injected.ok) {
return {
ok: false,
exitCode: ExitCode.Validation,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version_unresolved returns ExitCode.Validation (7), but it's not a caller-input problem — it's the server returning a resource that's missing version, which reads more like ExitCode.Blocked (8), the same code the confirmation gate uses for "can't proceed as-is." A script/agent branching on exit code to tell "fix your flags" from "not your fault" would misclassify this one.

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.

2 participants