Repository navigation
fix(inquiries): retire list() and create(), which called a table that never existed - #23
Merged
Merged
Conversation
… never existed Both hit /v1/inquiries, which read core.inquiries — a table that does not exist and never has (Scaffald/SaaS#476). They were not a rename of the real one. The list filtered on sender_id / recipient_id and the create sent subject, message and inquiry_type; none of those columns exist on core.application_inquiries, which is what every inquiry child table actually has a foreign key to. They described a generic person-to-person messaging feature that was never built. No hook and no screen called either — the hooks use getByApplication, getTemplates and getHistory. So the API routes were deleted rather than given a table, and these go with them: the SDK should not advertise a feature the product does not have.
thinkclay
added a commit
that referenced
this pull request
Sep 10, 2026
…24) Follow-up to #23, which removed both methods. Seven tests covered them and now fail with "client.inquiries.list is not a function". Worth recording why they were no help. They passed for as long as they existed, against the mock server in this directory, which answered /v1/inquiries happily. The real endpoint read core.inquiries — a table that has never existed — and returned 500 in production and locally. A test whose fixture invents the endpoint cannot fail when the endpoint is missing. That is the argument for the schema guard in the API repo reading the generated types rather than a mock, and it is left as a comment where the suites were so the next person writing SDK tests sees it. 8 remaining tests pass.
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 10, 2026
… screen (#738) Closes #476. Second step on #660. Two separate faults in one file, and only one of them was the one on the tin. **The phantom routes.** GET / and POST / read core.inquiries, which does not exist. They were not a rename of core.application_inquiries: the list filtered on sender_id / recipient_id and the create inserted subject, message and inquiry_type, none of which are columns on the real table. Every inquiry child table — comments, sections, capability responses, reminders, audit log — has a foreign key to application_inquiries. So these two described a generic person-to-person messaging feature nobody built. Deleted rather than implemented, per the method on #660: nothing called them. Inquiries.list() and Inquiries.create() were the only callers and are retired in Scaffald/sdk#23; no hook or screen used either. Building the table would have shipped it for an endpoint nothing can reach. **The fault that actually mattered, and was not in the issue.** While verifying the above, GET /by-application/{applicationId} — the real thread screen — returned 404 for an employer looking at an application their own list had just shown them. checkApplicationAccess read core.applications with the REQUEST client, and RLS does not expose an org's applications to its staff. It answered "Application not found" to the very people it then goes on to authorise. That is the same fault #608/#649 fixed in employer-applications.ts, in a different file. Fixing only that turned the 404 into a 200 with a null body, because the inquiry itself, its sections, comments, capability responses and the application detail were all read the same way. Measured on one employer: core.applications RLS: NO service: yes core.application_inquiries RLS: NO service: yes So the reads now go through the service client, AFTER checkApplicationAccess has authorised the caller. The authorisation decision is unchanged — same user_id match, same organisation owner, same org-scoped role assignment. Only the read is escalated, which is the difference between "you may not see this" and "this does not exist". before 404 Application not found partial 200 null now 200 inquiry, sections, comments, capabilityResponses, application, candidate, job, capabilityQuestions Found on the way and NOT fixed here, because it is a different problem (#447): /v1/inquiries/templates and /v1/inquiries/{id}/history both 404, and both are called by live hooks on this same screen. The router now serves exactly one path. Reported on #447 rather than folded in. Guard 6/6 with core.inquiries removed from BASELINE_BROKEN, leaving 3 entries, all #658. Deno check on the changed file goes 5 errors -> 3; the remainder are pre-existing narrowing on access.ok. Typecheck 12/12.
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.
Both called
/v1/inquiries, which readcore.inquiries— a table that does not exist and never has (Scaffald/SaaS#476).They were not a rename of the real table:
core.inquiries(imagined)core.application_inquiries(real)sender_id,recipient_idsubject,message,inquiry_typeapplication_id,status,terms,created_by, …Every inquiry child table — comments, sections, capability responses, reminders, audit log — has a foreign key to
application_inquiries. The two retired methods described a generic person-to-person messaging feature that was never built.Nothing called them. The hooks use
getByApplication,getTemplatesandgetHistory. So the API routes were deleted rather than given a table, and these go with them — the SDK should not advertise a feature the product does not have.Builds clean.
🤖 Generated with Claude Code