Skip to content

fix(inquiries): retire list() and create(), which called a table that never existed - #23

Merged
thinkclay merged 1 commit into
mainfrom
fix/retire-phantom-inquiry-methods
Sep 10, 2026
Merged

thinkclay merged 1 commit into
mainfrom
fix/retire-phantom-inquiry-methods

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Both called /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 table:

core.inquiries (imagined) core.application_inquiries (real)
list filtered on sender_id, recipient_id —
create sent subject, message, inquiry_type —
actually has — application_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, 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.

Builds clean.

🤖 Generated with Claude Code

… 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
thinkclay merged commit 79240d7 into main Sep 10, 2026
@thinkclay
thinkclay deleted the fix/retire-phantom-inquiry-methods branch September 10, 2026 20:45
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.
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.

1 participant