Skip to content

Align REST client payloads with p_-prefixed function parameters#60

Merged
seanwevans merged 1 commit into
mainfrom
claude/rest-param-alignment
Jun 27, 2026
Merged

Align REST client payloads with p_-prefixed function parameters#60
seanwevans merged 1 commit into
mainfrom
claude/rest-param-alignment

Conversation

@seanwevans

Copy link
Copy Markdown
Owner

Summary

PostgREST maps JSON body keys to the called function's argument names. The
submit_command and fork_session functions declare p_user_id / p_command
/ p_source_command_id, but the HTML form and CLI were posting unprefixed
keys (user_id / command / source_command_id). Against a real PostgREST
deployment those POSTs fail to resolve the function. The GET path for
latest_output already uses p_user_id, so this brings the write paths in line
with the rest of the project.

Changes

  • html/index.html — form fields renamed to p_user_id / p_command.
  • cli/shell_cli.pyexec_command and fork_session send p_-prefixed keys.
  • SPEC.md — the §5 form example matches.
  • tests/test_shell_cli.py — updated the exec body assertion and added a
    fork_session test that pins the p_-prefixed argument names.

Why this direction

All six SQL function parameters use the p_ prefix, the README documents
submit_command(p_user_id, p_command), and the existing GET path already sends
p_user_id — so aligning the three POST call sites to p_ is the minimal,
consistent fix and requires no database/contract change. The alternative
(renaming the DB params to drop p_) would also require touching the
already-working GET path. If you'd prefer that direction instead, this is easy
to flip.

Out of scope

I left the ?p_user_id=eq.<uuid> filter style on the latest_output GET path
untouched — it's consistent across the SPEC, HTML, CLI, and its tests, and
verifying any change there needs a live PostgREST instance.

Verification

  • Full suite against a live Postgres 16: 43 passed.
  • CLI tests (including the new fork-session test): pass without a database.

🤖 Generated with Claude Code


Generated by Claude Code

PostgREST maps JSON body keys to the called function's argument names.
The submit_command and fork_session functions declare p_user_id /
p_command / p_source_command_id, but the HTML form and CLI were posting
unprefixed keys (user_id / command / source_command_id), so these POSTs
would fail against a real PostgREST deployment. The GET path for
latest_output already uses p_user_id, so this aligns the write paths with
the rest of the project.

- html/index.html: form field names use p_user_id / p_command.
- cli/shell_cli.py: exec_command and fork_session send p_-prefixed keys.
- SPEC.md: the section 5 form example matches.
- tests: update the exec assertion and add a fork_session test that locks
  in the p_-prefixed argument names.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BixPb34oe2Ae5cXuz9WxbP
@seanwevans
seanwevans merged commit 719c939 into main Jun 27, 2026
2 checks passed
@seanwevans
seanwevans deleted the claude/rest-param-alignment branch June 27, 2026 00:54
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.

2 participants