Repository navigation
fix(inquiries): delete two phantom routes, and stop 404ing the thread screen - #738
Merged
Merged
Conversation
… screen 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 was referenced Sep 10, 2026
Contributor
📊 Performance Benchmark Results |
3 of 10 tasks
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.
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 /andPOST /readcore.inquiries, which does not exist. 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. Those two routes described a generic person-to-person messaging feature nobody built.Deleted rather than implemented, per the method on #660: nothing called them.
Inquiries.list()andInquiries.create()were the only callers and are retired in Scaffald/sdk#23; no hook or screen used either.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.checkApplicationAccessreadcore.applicationswith 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. Same fault #608/#649 fixed inemployer-applications.ts, in a different file.Fixing only that turned the 404 into a 200 with a null body, because the inquiry, its sections, comments, capability responses and the application detail were all read the same way. Measured on one employer:
So the reads now go through the service client, after
checkApplicationAccesshas authorised the caller. The authorisation decision is unchanged — sameuser_idmatch, 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".This is also what makes #690's per-message report control reachable — it renders on this screen.
Found on the way, not fixed here
/v1/inquiries/templatesand/v1/inquiries/{id}/historyboth 404, and both are called by live hooks on this same screen. The router now serves exactly one path. That is #447's territory, not this issue's, so it is reported there rather than folded in.A note on the SDK tests
Seven tests covered the deleted methods and passed the entire time — against a mock server that answered
/v1/inquirieshappily while the real endpoint 500'd. A test whose fixture invents the endpoint cannot fail when the endpoint is missing. Retired in Scaffald/sdk#24 with that reasoning left in place.Verified
SDK pointer:
4f6730a..e28fa9c.🤖 Generated with Claude Code