refactor(workflow-executor): own record not-found handling in the port [PRD-450]#1636
Open
matthv wants to merge 2 commits into
Open
Conversation
…t [PRD-450] Keep @forestadmin/agent-client's Collection#getOne a thin by-id passthrough and move the not-found semantics into AgentClientAgentPort, which owns RecordNotFoundError: - getOne no longer swallows errors nor normalizes empty bodies — it just GETs by id. - getRecord converts a 404 to RecordNotFoundError, treats a 200 + empty body as not-found, and rethrows any other error (no masking of real failures as "record not found"). Follow-up refactor on top of #1629. Relates to PRD-450. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Coverage Impact Unable to calculate total coverage change because base branch coverage was not found. Modified Files with Diff Coverage (2)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
…dError
Move the `id.join('|')` formatting into RecordNotFoundError so call sites pass
the recordId as-is. The constructor accepts a string or a (composite) id array
and joins it, removing the repeated join at every throw site.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

What
Follow-up refactor on top of #1629. Keeps
@forestadmin/agent-client'sCollection#getOnea thin by-id passthrough and moves the not-found semantics intoAgentClientAgentPort(the layer that ownsRecordNotFoundError).Why
The generic agent-client shouldn't decide that a 404 / empty body means "record not found" — that's a domain concern of the executor. Centralizing it in the port also makes the behavior explicit and testable.
Changes
agent-client/collection.ts—getOneno longer has a try/catch, doesn't swallow 404s, doesn't normalize empty bodies. It justGETs by id and returns the result.workflow-executor/agent-client-agent-port.ts—getRecordnow owns the not-found handling:RecordNotFoundError;RecordNotFoundError;HttpRequester.is404Error; added cases for 404 → RNF, non-404 → rethrown (not masked), and 200-empty → RNF.Testing
Essentially a refactor (no behavior change for callers) — relates to PRD-450.
🤖 Generated with Claude Code
Note
Move
RecordNotFoundErrorhandling fromCollection.getOneintoAgentClientAgentPort.getRecordCollection.getOneso HTTP errors propagate directly to callers.AgentClientAgentPort.getRecordnow catches 404s viaHttpRequester.is404Errorand throwsRecordNotFoundError; non-404 errors are rethrown. A 200 with an empty body is also treated as a missing record.RecordNotFoundErrorconstructor now accepts astring | (string | number)[]id, joining arrays with|for the error message.Collection.getOneno longer swallows 404s or empty responses — any caller outsideAgentClientAgentPortthat relied on the null return value will now receive thrown errors instead.Macroscope summarized ce724f4.