Skip to content

Return the assign response from Job.assign - #83

Merged
abreckner merged 3 commits into
masterfrom
tonybreckner/neb-641-return-assigned-job-from-job-assign
Aug 18, 2026
Merged

Return the assign response from Job.assign#83
abreckner merged 3 commits into
masterfrom
tonybreckner/neb-641-return-assigned-job-from-job-assign

Conversation

@abreckner

@abreckner abreckner commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Why

XPM's job.api/assign response is a full document carrying both the outcome and the authoritative post-assignment state — the assigned staff, manager and partner:

<Response api-method="Assign"><Status>OK</Status><Job><ID>J000032</ID>...
  <Manager><ID>859230</ID><Name>Dev Testing</Name></Manager>
  <Assigned><Staff><ID>859230</ID><Name>Dev Testing</Name></Staff></Assigned>
</Job></Response>

Job.assign reduced all of that to response["Status"] — the string "OK". A caller could learn that the request succeeded but never what XPM actually recorded, so there was no way to tell a partial assignment from a complete one.

That gap is the root of a recurring class of support issue in the app: workflows deploy to XPM "successfully" with staff, manager or partner silently missing, and nothing durable records what the provider confirmed. Needed by NEB-641.

What

Job.assign now returns the whole response hash, so callers get both "Status" and "Job".

Returning the response rather than digging out one key is deliberate: a caller checking the outcome and a caller reading the confirmed assignment both need it, and neither half is recoverable from the other. It does make assign the one method here that returns the envelope rather than a member — add, update, get and applytemplate return response["Job"], while state and delete return response["Status"]. That asymmetry is the point: assign is the only call whose result is interesting on both axes.

Compatibility

This changes a public method's return type, hence the minor bump to 0.5.0.

The only consumer is XpmIntegration::Job::Api.assign_staff in Practice-Ignition, which currently discards the return value, so nothing breaks on the bump. Callers that want the confirmed assignment read response["Job"]; callers that want the outcome read response["Status"].

Worth knowing for anyone relying on the status: Connection#handle_response raises ApiError on Status == "ERROR" before assign ever returns, so in practice "Status" is always "OK" on the success path.

Testing

The existing assign cassettes already contain the full payload, so no re-recording was needed. The six assign examples now assert on both halves — the status, plus that Assigned/Staff, Manager and Partner come back on the add paths and are absent on the remove paths. That is materially stronger than the previous eq("OK").

bundle exec rake93 examples, 0 failures; bundle exec rubocop → 46 files, no offenses.

🤖 Generated with Claude Code

@abreckner
abreckner force-pushed the tonybreckner/neb-641-return-assigned-job-from-job-assign branch from b047c4c to 022d17d Compare August 18, 2026 02:49
@abreckner
abreckner changed the base branch from master to tonybreckner/fix-ci-ruby-setup August 18, 2026 02:49
Base automatically changed from tonybreckner/fix-ci-ruby-setup to master August 18, 2026 02:52
abreckner and others added 2 commits August 18, 2026 10:54
XPM's job.api/assign response is a full Job document carrying the
authoritative post-assignment state: the assigned staff, manager and
partner. Job.assign discarded all of it and returned only the status
string, so a caller could learn that a request succeeded but never what
XPM actually recorded — leaving no way to tell a partial assignment from
a complete one.

Return response["Job"] instead, matching add, update, get and
applytemplate, which already return the job. The status is not lost as a
signal: Connection#handle_response raises ApiError on ERROR, so assign
either returns the job or raises.

The existing assign cassettes already contain the full payload, so the
specs now assert on the confirmed assignment rather than on "OK".

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
CI installs in frozen mode, so the lockfile has to record the version
the gemspec resolves.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@abreckner
abreckner force-pushed the tonybreckner/neb-641-return-assigned-job-from-job-assign branch from 022d17d to 3c1f158 Compare August 18, 2026 02:56
@abreckner
abreckner requested a review from rmustafin August 18, 2026 02:56
Digging out "Job" traded one loss for another: a caller checking the
outcome could no longer see the status, and neither half is recoverable
from the other. Return the whole response so both are available.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@abreckner abreckner changed the title Return the assigned job from Job.assign Return the assign response from Job.assign Aug 18, 2026

@wizardofosmium wizardofosmium left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I dig it! 👍

@abreckner
abreckner merged commit d0d9301 into master Aug 18, 2026
1 check passed
@abreckner
abreckner deleted the tonybreckner/neb-641-return-assigned-job-from-job-assign branch August 18, 2026 03:10
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