Skip to content

ol(cli): minimal invoke (POST JSON only; cmdline JSON; -p project)#403

Open
fairozkhan10 wants to merge 2 commits intoopen-lambda:mainfrom
fairozkhan10:feat/invoke-minimal
Open

ol(cli): minimal invoke (POST JSON only; cmdline JSON; -p project)#403
fairozkhan10 wants to merge 2 commits intoopen-lambda:mainfrom
fairozkhan10:feat/invoke-minimal

Conversation

@fairozkhan10
Copy link

@fairozkhan10 fairozkhan10 commented Jan 25, 2026

This implements the minimal ol invoke Professor Caraza-Harter requested:

  • POST-only, JSON-only

  • Usage:
    ol invoke myfunc # POST null body
    ol invoke myfunc '{"A":"B"}' # POST JSON body
    ol invoke myfunc '{"A":"B"}' -p default-ol # project-aware

  • Resolves URL like ol worker up via deploy dir (default project default-ol).
    For container-based dev on macOS, it also respects $OL_URL if set (so
    OL_URL=http://host.docker.internal:5000 works from inside Docker).

  • Flags:
    -p, --project (project/deploy name)
    --pretty (pretty-print JSON)
    --timeout N (seconds)

Manual test evidence:

  • With mock worker on host port 5000:
    ./ol-linux invoke -p default-ol --pretty myfunc
    ./ol-linux invoke -p default-ol --pretty myfunc '{"A":"B"}'
    Both returned 200 with expected echo payloads.

Follow-up:

  • I’ll test on Ubuntu 24.04 with a real worker (ol worker up -d -p default-ol)
    and report results on this PR thread.

Update: Ubuntu 24.04 Verification Results 🟢

I have successfully verified the implementation on a fresh Ubuntu 24.04 VM with a real OpenLambda worker instance.

Test Environment:

  • OS: Ubuntu 24.04 LTS
  • Build: Built binary from source (go build .)
  • Worker: Real worker initialized on port 5000 (ol worker up -p test-worker)

Test Cases Executed:

  1. Project-Aware Lookup:

    • Command: ./ol-linux invoke -p test-worker hello-lambda-example
    • Result: Success ("hello")
    • Confirmed that the CLI correctly resolved the port from the custom project directory.
  2. JSON Payload (Cmdline):

    • Command: ./ol-linux invoke -p test-worker hello-lambda-example '{"some":"json"}'
    • Result: Success ("hello")
    • Confirmed that JSON strings are accepted and transmitted correctly.
  3. Input Validation (Negative Test):

    • Command: ./ol-linux invoke ... '{"broken":"json"'
    • Result: Error: invalid JSON
    • Confirmed that the CLI validates input before transmission.
  4. End-to-End Latency:

    • Verified via worker.out logs that the request triggered a sandbox unpause event.

Ready for review!

@fairozkhan10
Copy link
Author

Update: Ubuntu 24.04 Verification Results 🟢

I have successfully verified the implementation on a fresh Ubuntu 24.04 VM with a real OpenLambda worker instance.

Test Environment:

  • OS: Ubuntu 24.04 LTS
  • Build: Built binary from source (go build .)
  • Worker: Real worker initialized on port 5000 (ol worker up -p test-worker)

Test Cases Executed:

  1. Project-Aware Lookup:

    • Command: ./ol-linux invoke -p test-worker hello-lambda-example
    • Result: Success ("hello")
    • Confirmed that the CLI correctly resolved the port from the custom project directory.
  2. JSON Payload (Cmdline):

    • Command: ./ol-linux invoke -p test-worker hello-lambda-example '{"some":"json"}'
    • Result: Success ("hello")
    • Confirmed that JSON strings are accepted and transmitted correctly.
  3. Input Validation (Negative Test):

    • Command: ./ol-linux invoke ... '{"broken":"json"'
    • Result: Error: invalid JSON
    • Confirmed that the CLI validates input before transmission.
  4. End-to-End Latency:

    • Verified via worker.out logs that the request triggered a sandbox unpause event.

Ready for review!

@fairozkhan10
Copy link
Author

fairozkhan10 commented Jan 26, 2026

Manual Verification on Linux (Screenshot Evidence)

1. Prove we are on the target OS (Ubuntu)
uname -r

2. Basic Invoke (Project Aware) - Proves -p works
./ol-linux invoke -p test-worker hello-lambda-example

3. JSON Payload - Proves we can send data
./ol-linux invoke -p test-worker hello-lambda-example '{"status": "verified"}'

4. Pretty Print - Proves flags work (put flag BEFORE func name!)
./ol-linux invoke -p test-worker --pretty hello-lambda-example '{"A": "B"}'

5. Validation Check - Proves we catch bad input
./ol-linux invoke -p test-worker hello-lambda-example '{"broken": "json"'

Screenshot 2026-01-26 at 12 27 09 AM

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