Repository navigation
feat(inquiries): add getByApplication - #11
Merged
Merged
Conversation
The Scaffald app calls `client.inquiries.getByApplication(applicationId)` to load
the capability inquiry attached to an application. The method did not exist. An
`as unknown as InquiryCapabilityClient` cast at the call site silenced the
type error, so it failed at runtime instead and the page rendered
"Unable to load inquiry".
Backed by GET /v1/inquiries/by-application/{applicationId}, ported from the
legacy tRPC procedure that was the only implementation.
Resolves to null when the application has no inquiry yet — a normal state
callers should render as empty, not as a failure.
Types are derived from the actual schema rather than guessed, which the caller's
typecheck immediately proved necessary:
* InquiryComment carries sender_id, content, read_by and section_name; all are
NOT NULL in core.inquiry_comments.
* InquiryCapabilityResponse.response_value / response_text are nullable.
Note this models the ATS capability-inquiry feature
(core.application_inquiries), which is a different concept from the
sender/recipient `Inquiry` that list/create model.
Refs Scaffald/SaaS#443
Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Jul 30, 2026
Closed
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.
Part of Scaffald/SaaS#443, which is the "Unable to load inquiry" bug in Scaffald/SaaS#440.
Why
The Scaffald app calls
client.inquiries.getByApplication(applicationId)to load the capability inquiry attached to an application. The method did not exist. The call site papered over it:That cast silenced the missing-method type error, so it failed at runtime and the page rendered a red "Unable to load inquiry" instead. Only the legacy tRPC router had a real implementation.
What
getByApplication(applicationId): Promise<InquiryDetails | null>, backed byGET /v1/inquiries/by-application/{applicationId}(added in the companion server PR), ported from that tRPC procedure.Resolves to
nullwhen the application has no inquiry yet — a normal state that callers should render as an empty state, not a failure.Types come from the schema, not from guesses
Removing the cast made the caller's typecheck meaningful again, and it immediately caught two things the cast had been hiding:
InquiryCommentneedssender_id,content,read_byandsection_name— allNOT NULLincore.inquiry_comments.InquiryCapabilityResponse.response_value/response_textare nullable, which the consumer's type denied.Both verified against the live schema rather than inferred.
Naming caveat
This models the ATS capability-inquiry feature (
core.application_inquiries), which is a different concept from the sender/recipientInquirythatlistandcreatemodel. Those two currently readcore.inquiries— a table that does not exist in the database at all. Filed separately on the app repo; not touched here.Verification
tsc --noEmitclean on this package.scf-coretypechecks clean against the built dist with the cast removed — that is the real proof the surface matches.