Skip to content

[DRAFT] Implement constructive-sdk into function, fixes, and cleanup#8

Open
Jovonni wants to merge 37 commits into
mainfrom
dev/functions-integrate-sdk
Open

[DRAFT] Implement constructive-sdk into function, fixes, and cleanup#8
Jovonni wants to merge 37 commits into
mainfrom
dev/functions-integrate-sdk

Conversation

@Jovonni
Copy link
Copy Markdown
Contributor

@Jovonni Jovonni commented Jan 27, 2026

addresses:

summarized changes:

  • sdk: hooked everything up to the typed constructive-sdk. no more untyped chaos.
  • refactor: cleaned some duplicate deps. now using a single sdk.tgz source of truth for all docker builds
  • testing: fixed test flakes. every single function passes k8s integration tests now, you can try with make test-k8s-all)
  • core infra: updated built node runtime, added experimental rust/python runners, and set up all k8s manifests.

successful tests

Details
0xj0@0xJ0s-MacBook-Pro constructive-functions % make test-k8s-all
Building Shared Node Runtime...
docker build -t constructive/node-runtime:latest functions/_runtimes/node -f functions/_runtimes/node/Dockerfile.runtime
[+] Building 0.2s (12/12) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile.runtime                                                                                                          0.0s
 => => transferring dockerfile: 835B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.2s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                       0.0s
 => [1/7] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 31B                                                                                                                                      0.0s
 => CACHED [2/7] WORKDIR /runtime                                                                                                                                     0.0s
 => CACHED [3/7] RUN npm install -g pnpm@10.12.2                                                                                                                      0.0s
 => CACHED [4/7] RUN echo '{}' > package.json                                                                                                                         0.0s
 => CACHED [5/7] RUN pnpm install express@4.18.2 body-parser@1.20.2 graphql-request@6.1.0 pg@8.11.3 cross-fetch@4.0.0                                                 0.0s
 => CACHED [6/7] COPY runner.js .                                                                                                                                     0.0s
 => CACHED [7/7] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:12d9c77db47cd3d701e91cc70a413f801aa95c69722299ec771410de5855ffde                                                                          0.0s
 => => naming to docker.io/constructive/node-runtime:latest                                                                                                           0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/p6cr6ncmt2ihgz9q0llzwo9cl
Building Docker images for functions...
Building functions/create-db...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 323B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 4.15kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/create-db/package.json ./                                                                                                             0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/create-db/dist ./dist                                                                                                                 0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:23c9a283f9af00ed85b84a97ea1294488124a9c24671f7a213e67bde820f24bc                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/create-db:latest                                                                                      0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/mse8z8kibnz4foo2su52cztrw
Building functions/crypto-login...
[+] Building 0.1s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 329B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 7.67kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/crypto-login/package.json ./                                                                                                          0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/crypto-login/dist ./dist                                                                                                              0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:6dbea667cb35f5bfb638d3f8677e00850d0aa54012c7183bfbbb1b5bc7c29017                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/crypto-login:latest                                                                                   0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/dvhg6ua0qlt6tdq3042lg9wwl
Building functions/github-repo-creator...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 343B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 4.12kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/github-repo-creator/package.json ./                                                                                                   0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/github-repo-creator/dist ./dist                                                                                                       0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:bc6bef86a3a28ac4914743d306a049a3b62bba9d872e9fb655ee501a134b6cb7                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/github-repo-creator:latest                                                                            0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/zf6lepm89ix2fppgq773nslee
Building functions/hello-world...
[+] Building 0.2s (19/19) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 850B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/constructive/node-runtime:latest                                                                                           0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [builder 1/7] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                       0.0s
 => [stage-1 1/6] FROM docker.io/constructive/node-runtime:latest                                                                                                     0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 32.06kB                                                                                                                                  0.0s
 => CACHED [stage-1 2/6] WORKDIR /usr/src/app                                                                                                                         0.0s
 => CACHED [stage-1 3/6] COPY functions/hello-world/package.json ./                                                                                                   0.0s
 => CACHED [stage-1 4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                    0.0s
 => CACHED [stage-1 5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                       0.0s
 => CACHED [builder 2/7] WORKDIR /app                                                                                                                                 0.0s
 => CACHED [builder 3/7] COPY functions/hello-world/package.json ./                                                                                                   0.0s
 => CACHED [builder 4/7] COPY sdk.tgz /sdk.tgz                                                                                                                        0.0s
 => CACHED [builder 5/7] RUN npm install                                                                                                                              0.0s
 => CACHED [builder 6/7] COPY functions/hello-world .                                                                                                                 0.0s
 => CACHED [builder 7/7] RUN npm run build                                                                                                                            0.0s
 => CACHED [stage-1 6/6] COPY --from=builder /app/dist ./dist                                                                                                         0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:f2587233a92e7dd3eae66aebe15b67af012f2f9e6af2e82de2a55a518cc7c12f                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/hello-world:latest                                                                                    0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/b3gwwf27iz3dnygbdcb4ux5aa
Building functions/llm-external...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 329B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 4.66kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/llm-external/package.json ./                                                                                                          0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/llm-external/dist ./dist                                                                                                              0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:f8ac6bf2fe96423103d5405a9fab46fc56de959fa230e619f6e71e829d686835                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/llm-external:latest                                                                                   0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/nm018rp1bqu816808lcntmygb
Building functions/llm-internal-calvin...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 343B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 4.42kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/llm-internal-calvin/package.json ./                                                                                                   0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/llm-internal-calvin/dist ./dist                                                                                                       0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:6c18cae6909194cec795d84bbc73d9f34291e36601a4efa716daa66be899ccd1                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/llm-internal-calvin:latest                                                                            0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/p9n5jts6g9ukbaw5ge7gvf8qw
Building functions/opencode-headless...
[+] Building 0.2s (12/12) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 355B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/7] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 7.69kB                                                                                                                                   0.0s
 => CACHED [2/7] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/7] COPY functions/opencode-headless/package.json ./                                                                                                     0.0s
 => CACHED [4/7] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/7] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/7] COPY functions/opencode-headless/dist ./dist                                                                                                         0.0s
 => CACHED [7/7] COPY bin ./bin                                                                                                                                       0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:4419ad1e64321015e5d3ccc807edd78c205d4ca5421f05c18e88e6d5697b19fe                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/opencode-headless:latest                                                                              0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/0q0wtwbsm8ovtq6pqc3z86cq3
Building functions/pgpm-dump...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 323B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 4.36kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/pgpm-dump/package.json ./                                                                                                             0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/pgpm-dump/dist ./dist                                                                                                                 0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:a43eb7921cced79bf80d07a9913dec9ea6559636a9d3977f2e90e32bb4362105                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/pgpm-dump:latest                                                                                      0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/qmha7jfh5xnhm1vms7g049dl6
Building functions/pytorch-gpu...
[+] Building 0.2s (10/10) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 607B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/python:3.9-slim                                                                                                    0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/5] FROM docker.io/library/python:3.9-slim@sha256:2d97f6910b16bd338d3060f261f53f144965f755599aab1acda1e13cf1731b1b                                              0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 886B                                                                                                                                     0.0s
 => CACHED [2/5] WORKDIR /app                                                                                                                                         0.0s
 => CACHED [3/5] RUN apt-get update && apt-get install -y gcc                                                                                                         0.0s
 => CACHED [4/5] RUN pip install flask torch --no-cache-dir                                                                                                           0.0s
 => CACHED [5/5] COPY functions/pytorch-gpu/src/ ./src/                                                                                                               0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:f85c59eed23b18f350249a8481d63a0e0ae5108695292b32ffc24b2ef5bd78cb                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/pytorch-gpu:latest                                                                                    0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/z947sqqoneqlwuqcu1hy7y6ut
Building functions/runtime-script...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 333B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 548.62kB                                                                                                                                 0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/runtime-script/package.json ./                                                                                                        0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/runtime-script/dist ./dist                                                                                                            0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:8699e1f9ede515a371e43b47ca4a8b5f6303ae8d14f8c902c30cddf803ee9752                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/runtime-script:latest                                                                                 0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/383rsnpmg8rmexpfcm7tew35y
Building functions/rust-hello-world...
[+] Building 0.2s (19/19) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 1.01kB                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/alpine:3.19                                                                                                        0.1s
 => [internal] load metadata for docker.io/library/rust:1.83-alpine                                                                                                   0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [builder 1/9] FROM docker.io/library/rust:1.83-alpine@sha256:0ac946ed7597a9f053a1be2ce38c09aa88b3d7079a91ea491493615294b1f699                                     0.0s
 => [stage-1 1/4] FROM docker.io/library/alpine:3.19@sha256:6baf43584bcb78f2e5847d1de515f23499913ac9f12bdf834811a3145eb11ca1                                          0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 991B                                                                                                                                     0.0s
 => CACHED [stage-1 2/4] WORKDIR /usr/src/app                                                                                                                         0.0s
 => CACHED [builder 2/9] WORKDIR /build                                                                                                                               0.0s
 => CACHED [builder 3/9] RUN apk add --no-cache musl-dev                                                                                                              0.0s
 => CACHED [builder 4/9] COPY functions/rust-hello-world/Cargo.toml ./                                                                                                0.0s
 => CACHED [builder 5/9] RUN mkdir src && echo "fn main() {}" > src/main.rs                                                                                           0.0s
 => CACHED [builder 6/9] RUN cargo build --release                                                                                                                    0.0s
 => CACHED [builder 7/9] RUN rm -rf src                                                                                                                               0.0s
 => CACHED [builder 8/9] COPY functions/rust-hello-world/src ./src                                                                                                    0.0s
 => CACHED [builder 9/9] RUN touch src/main.rs && cargo build --release                                                                                               0.0s
 => CACHED [stage-1 3/4] COPY --from=builder /build/target/release/rust-hello-world ./app                                                                             0.0s
 => CACHED [stage-1 4/4] RUN addgroup -g 1000 appuser &&     adduser -D -u 1000 -G appuser appuser &&     chown -R appuser:appuser /usr/src/app                       0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:9299bc272341f37bbcda800cb6bdb70722336e08da968ee607f52c46e84f1ad1                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/rust-hello-world:latest                                                                               0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/f7z0j9yfw1p1d54qkgn9x8meu
Building functions/send-email-link...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 336B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 557.42kB                                                                                                                                 0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/send-email-link/package.json ./                                                                                                       0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/send-email-link/dist ./dist                                                                                                           0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:c312f377854d24bcfa20f5dc5204c27de22b38c29f8dcaab94c89d86d2bc8c23                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/send-email-link:latest                                                                                0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/iefutj97ixq419cyqg57prt50
Building functions/simple-bash...
[+] Building 0.1s (10/10) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 191B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/alpine:3.19                                                                                                        0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/5] FROM docker.io/library/alpine:3.19@sha256:6baf43584bcb78f2e5847d1de515f23499913ac9f12bdf834811a3145eb11ca1                                                  0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 267B                                                                                                                                     0.0s
 => CACHED [2/5] RUN apk add --no-cache bash                                                                                                                          0.0s
 => CACHED [3/5] WORKDIR /app                                                                                                                                         0.0s
 => CACHED [4/5] COPY functions/simple-bash/src/index.sh .                                                                                                            0.0s
 => CACHED [5/5] RUN chmod +x index.sh                                                                                                                                0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:140584e34ce30c7024fc8733dccf8f1c7c4f2a5afc8a43f63d9bb1d7c56cd1bd                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/simple-bash:latest                                                                                    0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/t7ahrsickc311760wwbcnivvb
Building functions/simple-email...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 329B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 548.99kB                                                                                                                                 0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/simple-email/package.json ./                                                                                                          0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/simple-email/dist ./dist                                                                                                              0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:a729c0d7e416a3e60e621c3d72b4a96b8036c983e7d30397f35254392708da46                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/simple-email:latest                                                                                   0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/monkfwo4xjx86ltomba7h08xo
Building functions/stripe-function...
[+] Building 0.1s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 335B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 4.88kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/stripe-function/package.json ./                                                                                                       0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/stripe-function/dist ./dist                                                                                                           0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:f4818512c5aaae40df704a477eb23f1fd701555e49afaaaf03884bee32a6ff77                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/stripe-function:latest                                                                                0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/jaulilev3orggt55zjkwdnpdn
Building functions/twilio-sms...
[+] Building 0.2s (11/11) FINISHED                                                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                  0.0s
 => => transferring dockerfile: 325B                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:22-alpine                                                                                                     0.1s
 => [internal] load .dockerignore                                                                                                                                     0.0s
 => => transferring context: 80B                                                                                                                                      0.0s
 => [1/6] FROM docker.io/library/node:22-alpine@sha256:a9cd9bac76cf2396abf14ff0d1c3671a8175fe577ce350e62ab0fc1678050176                                               0.0s
 => [internal] load build context                                                                                                                                     0.0s
 => => transferring context: 4.26kB                                                                                                                                   0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                                                                 0.0s
 => CACHED [3/6] COPY functions/twilio-sms/package.json ./                                                                                                            0.0s
 => CACHED [4/6] COPY sdk.tgz /usr/sdk.tgz                                                                                                                            0.0s
 => CACHED [5/6] RUN npm install -g pnpm@10.12.2 && pnpm install --prod                                                                                               0.0s
 => CACHED [6/6] COPY functions/twilio-sms/dist ./dist                                                                                                                0.0s
 => exporting to image                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                               0.0s
 => => writing image sha256:8365e1e4ff03aff079dc7ebf4f61ba2d5ce2f3fb516a5565bb44b049d2b446c5                                                                          0.0s
 => => naming to ghcr.io/constructive-io/constructive-functions/twilio-sms:latest                                                                                     0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/vr85ex675v68c054exoq5wylf
Loading all function images into Kind...
Loading functions/create-db...
Image: "ghcr.io/constructive-io/constructive-functions/create-db:latest" with ID "sha256:23c9a283f9af00ed85b84a97ea1294488124a9c24671f7a213e67bde820f24bc" found to be already present on all nodes.
Loading functions/crypto-login...
Image: "ghcr.io/constructive-io/constructive-functions/crypto-login:latest" with ID "sha256:6dbea667cb35f5bfb638d3f8677e00850d0aa54012c7183bfbbb1b5bc7c29017" found to be already present on all nodes.
Loading functions/github-repo-creator...
Image: "ghcr.io/constructive-io/constructive-functions/github-repo-creator:latest" with ID "sha256:bc6bef86a3a28ac4914743d306a049a3b62bba9d872e9fb655ee501a134b6cb7" found to be already present on all nodes.
Loading functions/hello-world...
Image: "ghcr.io/constructive-io/constructive-functions/hello-world:latest" with ID "sha256:f2587233a92e7dd3eae66aebe15b67af012f2f9e6af2e82de2a55a518cc7c12f" not yet present on node "interweb-local-control-plane", loading...
Loading functions/llm-external...
Image: "ghcr.io/constructive-io/constructive-functions/llm-external:latest" with ID "sha256:f8ac6bf2fe96423103d5405a9fab46fc56de959fa230e619f6e71e829d686835" found to be already present on all nodes.
Loading functions/llm-internal-calvin...
Image: "ghcr.io/constructive-io/constructive-functions/llm-internal-calvin:latest" with ID "sha256:6c18cae6909194cec795d84bbc73d9f34291e36601a4efa716daa66be899ccd1" found to be already present on all nodes.
Loading functions/opencode-headless...
Image: "ghcr.io/constructive-io/constructive-functions/opencode-headless:latest" with ID "sha256:4419ad1e64321015e5d3ccc807edd78c205d4ca5421f05c18e88e6d5697b19fe" found to be already present on all nodes.
Loading functions/pgpm-dump...
Image: "ghcr.io/constructive-io/constructive-functions/pgpm-dump:latest" with ID "sha256:a43eb7921cced79bf80d07a9913dec9ea6559636a9d3977f2e90e32bb4362105" found to be already present on all nodes.
Loading functions/pytorch-gpu...
Image: "ghcr.io/constructive-io/constructive-functions/pytorch-gpu:latest" with ID "sha256:f85c59eed23b18f350249a8481d63a0e0ae5108695292b32ffc24b2ef5bd78cb" found to be already present on all nodes.
Loading functions/runtime-script...
Image: "ghcr.io/constructive-io/constructive-functions/runtime-script:latest" with ID "sha256:8699e1f9ede515a371e43b47ca4a8b5f6303ae8d14f8c902c30cddf803ee9752" found to be already present on all nodes.
Loading functions/rust-hello-world...
Image: "ghcr.io/constructive-io/constructive-functions/rust-hello-world:latest" with ID "sha256:9299bc272341f37bbcda800cb6bdb70722336e08da968ee607f52c46e84f1ad1" found to be already present on all nodes.
Loading functions/send-email-link...
Image: "ghcr.io/constructive-io/constructive-functions/send-email-link:latest" with ID "sha256:c312f377854d24bcfa20f5dc5204c27de22b38c29f8dcaab94c89d86d2bc8c23" found to be already present on all nodes.
Loading functions/simple-bash...
Image: "ghcr.io/constructive-io/constructive-functions/simple-bash:latest" with ID "sha256:140584e34ce30c7024fc8733dccf8f1c7c4f2a5afc8a43f63d9bb1d7c56cd1bd" found to be already present on all nodes.
Loading functions/simple-email...
Image: "ghcr.io/constructive-io/constructive-functions/simple-email:latest" with ID "sha256:a729c0d7e416a3e60e621c3d72b4a96b8036c983e7d30397f35254392708da46" found to be already present on all nodes.
Loading functions/stripe-function...
Image: "ghcr.io/constructive-io/constructive-functions/stripe-function:latest" with ID "sha256:f4818512c5aaae40df704a477eb23f1fd701555e49afaaaf03884bee32a6ff77" found to be already present on all nodes.
Loading functions/twilio-sms...
Image: "ghcr.io/constructive-io/constructive-functions/twilio-sms:latest" with ID "sha256:8365e1e4ff03aff079dc7ebf4f61ba2d5ce2f3fb516a5565bb44b049d2b446c5" found to be already present on all nodes.
Running all K8s tests via centralized KubernetesJS runner...
pnpm exec ts-node scripts/test-runner.ts
[dotenv@17.2.3] injecting env (15) from .env -- tip: 🔐 prevent building .env in docker: https://dotenvx.com/prebuild
Starting kubectl proxy on port 8966...
[Runner] Running in ALL mode
[Runner] Starting test for: create-db (Job: test-create-db-1769557247)
[Runner] Waiting for job test-create-db-1769557247 to complete...
[Runner] create-db: Succeeded
[Runner] Fetching logs for test-create-db-1769557247-s5xkw...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
[test-connector] INFO: 🔌 New PgTestClient connected to db-a9db0344-dbcf-4896-bec9-8a22030230da
[test-connector] INFO: 🔌 New PgTestClient connected to db-a9db0344-dbcf-4896-bec9-8a22030230da
[test-connector] INFO: 🔌 New PgTestClient connected to db-a9db0344-dbcf-4896-bec9-8a22030230da
  console.log
    [Test] Orchestrating Job: create-db-exec-1769557251

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:42:17)

  console.log
    [Test] Waiting for pod for job create-db-exec-1769557251 to be Running...

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:92:17)

  console.log
    [Test] Found Pod: create-db-exec-1769557251-whqfb

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:107:33)

  console.log
    [Test] Service is listening! Success.

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:118:37)

  console.log
    
    [Evidence] Function Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/create-db/src/index.ts' listening on port 8080

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:119:37)

  console.log
    [Test] Invoking create-db function via proxy...

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:124:37)

  console.log
    [Test] Invocation Response: {"created":true,"exists":true,"message":"Database test_db_1769557255 created successfully"}

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:143:37)

  console.log
    [Test] Function reported success for test_db_1769557255

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:152:37)

  console.log
    [Test] Verified: Database exists in Postgres catalog.

      at Object.<anonymous> (functions/create-db/__tests__/index.test.ts:159:37)

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for db-a9db0344-dbcf-4896-bec9-8a22030230da
[test-connector] SUCCESS: ✅ Closed client for db-a9db0344-dbcf-4896-bec9-8a22030230da
[test-connector] SUCCESS: ✅ Closed client for db-a9db0344-dbcf-4896-bec9-8a22030230da
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: db-a9db0344-dbcf-4896-bec9-8a22030230da
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/create-db/__tests__/index.test.ts (7.043 s)
  Create DB Function (Integration)
    ✓ should orchestrate the create-db job and verify database creation (4344 ms)
    ✓ should verify database connectivity via pgsql-test (1 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        7.211 s
Ran all test suites matching functions/create-db/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: crypto-login (Job: test-crypto-login-1769557259)
[Runner] Waiting for job test-crypto-login-1769557259 to complete...
[Runner] crypto-login: Succeeded
[Runner] Fetching logs for test-crypto-login-1769557259-wknsx...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    [Test] Invoking crypto-login via proxy...

      at Object.<anonymous> (functions/crypto-login/__tests__/index.test.ts:90:37)

  console.log
    
    [Evidence] Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/crypto-login/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "email",
          "password"
        ]
      }
    }
    [runner] Incoming Request Body: {"email":"test","password":"test"}
    [crypto-login] Request received

      at Object.<anonymous> (functions/crypto-login/__tests__/index.test.ts:102:37)

  console.log
    [Teardown] Cleaning up job: crypto-login-exec-1769557263

      at functions/test-utils.ts:22:17

PASS functions/crypto-login/__tests__/index.test.ts (8.463 s)
  Crypto Login Function (Integration)
    ✓ should orchestrate the crypto-login job and verify startup (6205 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        8.613 s
Ran all test suites matching functions/crypto-login/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: github-repo-creator (Job: test-github-repo-creator-1769557273)
[Runner] Waiting for job test-github-repo-creator-1769557273 to complete...
[Runner] github-repo-creator: Succeeded
[Runner] Fetching logs for test-github-repo-creator-1769557273-jszgf...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    [Test] Invoking github-repo-creator via proxy...

      at Object.<anonymous> (functions/github-repo-creator/__tests__/index.test.ts:71:37)

  console.log
    
    [Evidence] Pod Logs:
      }
    }
    [runner] Incoming Request Body: {"repoName":"test","githubToken":"abc"}
    [github-repo-creator] Request received
    Creating repo: test
    RequestError [HttpError]: Bad credentials - https://docs.github.com/rest
        at /app/node_modules/.pnpm/@octokit+request@8.4.1/node_modules/@octokit/request/dist-node/index.js:125:21
        at processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async requestWithGraphqlErrorHandling (/app/node_modules/.pnpm/@octokit+plugin-retry@6.1.0_@octokit+core@5.2.2/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)
        at async Job.doExecute (/app/node_modules/.pnpm/bottleneck@2.19.5/node_modules/bottleneck/light.js:405:18) {
      status: 401,
      response: {
        url: 'https://api.github.com/user/repos',
        status: 401,
        headers: {
          'access-control-allow-origin': '*',
          'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
          connection: 'close',
          'content-security-policy': "default-src 'none'",
          'content-type': 'application/json; charset=utf-8',
          date: 'Tue, 27 Jan 2026 23:41:22 GMT',
          'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
          server: 'github.com',
          'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
          vary: 'Accept-Encoding, Accept, X-Requested-With',
          'x-content-type-options': 'nosniff',
          'x-frame-options': 'deny',
          'x-github-media-type': 'github.v3; format=json',
          'x-github-request-id': 'CBD2:2325D3:3D5388:1126CFA:69794D22',
          'x-xss-protection': '0'
        },
        data: {
          message: 'Bad credentials',
          documentation_url: 'https://docs.github.com/rest',
          status: '401'
        }
      },
      request: {
        method: 'POST',
        url: 'https://api.github.com/user/repos',
        headers: {
          accept: 'application/vnd.github.v3+json',
          'user-agent': 'octokit.js/3.2.2 octokit-core.js/5.2.2 Node.js/20.19.4 (linux; arm64)',
          authorization: 'token [REDACTED]',
          'content-type': 'application/json; charset=utf-8'
        },
        body: '{"name":"test","private":true}',
        request: { hook: [Function: bound bound register] }
      }
    }

      at Object.<anonymous> (functions/github-repo-creator/__tests__/index.test.ts:82:37)

  console.log
    [Teardown] Cleaning up job: gh-repo-create-exec-1769557278

      at functions/test-utils.ts:22:17

PASS functions/github-repo-creator/__tests__/index.test.ts (8.608 s)
  Github Repo Creator Function (Integration)
    ✓ should orchestrate the github-repo-creator job (6398 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        8.764 s
Ran all test suites matching functions/github-repo-creator/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: hello-world (Job: test-hello-world-1769557289)
[Runner] Waiting for job test-hello-world-1769557289 to complete...
[Runner] hello-world: Succeeded
[Runner] Fetching logs for test-hello-world-1769557289-lvbdh...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
[test-connector] INFO: 🔌 New PgTestClient connected to hello_world_test_46857
[test-connector] INFO: 🔌 New PgTestClient connected to hello_world_test_46857
[test-connector] INFO: 🔌 New PgTestClient connected to hello_world_test_46857
  console.log
    [Test] Orchestrating Job: hello-world-exec-1769557296

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:57:17)

  console.log
    [Test] Waiting for pod for job hello-world-exec-1769557296 to be Running...

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:105:17)

  console.log
    [Test] Found Pod: hello-world-exec-1769557296-qbfrd

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:121:33)

  console.log
    [Test] Service is listening! Success.

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:133:37)

  console.log
    
    [Evidence] Function Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/hello-world/src/index.ts' listening on port 8080

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:134:37)

  console.log
    [Test] Invoking hello-world function via proxy...

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:138:37)

  console.log
    [Test] Invocation Response: {"message":"Hello World","received":{"name":"Test User"},"user":{"id":"user_123"},"apis":{"apis":{"nodes":[{"id":"a1a5ec6f-eff4-47b4-a372-2487cab792fe","name":"main-api"}],"totalCount":1,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false,"startCursor":"WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d","endCursor":"WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d"}}}}

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:155:37)

  console.log
    [Test] Verified: User Context injected correctly (X-User-Id priority).

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:159:41)

  console.log
    [Test] Fetching post-invocation logs...

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:165:37)

  console.log
    
    [Evidence] Post-Invocation Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/hello-world/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "name"
        ]
      }
    }
    [runner] Incoming Request Body: {"name":"Test User"}
    Incoming Headers: {"host":"10.96.0.1:443","user-agent":"node","content-length":"20","accept":"*/*","accept-encoding":"gzip, deflate","accept-language":"*","content-type":"application/json","sec-fetch-mode":"cors","x-forwarded-for":"127.0.0.1, 10.244.0.73","x-forwarded-uri":"/api/v1/namespaces/default/pods/hello-world-exec-1769557296-qbfrd:8080/proxy/","x-user-id":"user_123"}
    [hello-world] GQL Response: {
      "apis": {
        "nodes": [
          {
            "id": "a1a5ec6f-eff4-47b4-a372-2487cab792fe",
            "name": "main-api"
          }
        ],
        "totalCount": 1,
        "pageInfo": {
          "hasNextPage": false,
          "hasPreviousPage": false,
          "startCursor": "WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d",
          "endCursor": "WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d"
        }
      }
    }

      at Object.<anonymous> (functions/hello-world/__tests__/index.test.ts:169:37)

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for hello_world_test_46857
[test-connector] SUCCESS: ✅ Closed client for hello_world_test_46857
[test-connector] SUCCESS: ✅ Closed client for hello_world_test_46857
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: hello_world_test_46857
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/hello-world/__tests__/index.test.ts (11.833 s)
  Hello World Function (Integration)
    ✓ should orchestrate the hello-world job and verify completion (6147 ms)
    ✓ should verify database connectivity via pgsql-test (6 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        12.007 s
Ran all test suites matching functions/hello-world/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: llm-external (Job: test-llm-external-1769557305)
[Runner] Waiting for job test-llm-external-1769557305 to complete...
[Runner] llm-external: Succeeded
[Runner] Fetching logs for test-llm-external-1769557305-2mdlq...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    [dotenv@17.2.3] injecting env (0) from .env -- tip: 🔐 encrypt with Dotenvx: https://dotenvx.com

      at _log (node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js:142:11)

  console.log
    [Test] Triggering function...

      at Object.<anonymous> (functions/llm-external/__tests__/index.test.ts:77:37)

  console.log
    [Test] Response: {
      result: 'Mock logic works',
      users: { apis: { nodes: [Array], totalCount: 1, pageInfo: [Object] } },
      works: true
    }

      at Object.<anonymous> (functions/llm-external/__tests__/index.test.ts:89:41)

  console.log
    
    [Evidence] Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/llm-external/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "provider",
          "prompt"
        ]
      }
    }
    [runner] Incoming Request Body: {"provider":"test","prompt":"Can you explain the quantum field theory in simple terms?"}
    Constructive KNS: Request Received
    [llm-external] Request received

      at Object.<anonymous> (functions/llm-external/__tests__/index.test.ts:97:45)

  console.log
    
    [Evidence] Function Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/llm-external/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "provider",
          "prompt"
        ]
      }
    }
    [runner] Incoming Request Body: {"provider":"test","prompt":"Can you explain the quantum field theory in simple terms?"}
    Constructive KNS: Request Received
    [llm-external] Request received

      at Object.<anonymous> (functions/llm-external/__tests__/index.test.ts:115:25)

  console.log
    [Teardown] Cleaning up job: llm-ext-exec-1769557309

      at functions/test-utils.ts:22:17

PASS functions/llm-external/__tests__/index.test.ts (8.422 s)
  LLM External Function (Integration)
    ✓ should orchestrate the llm-external job (6174 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        8.576 s
Ran all test suites matching functions/llm-external/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: llm-internal-calvin (Job: test-llm-internal-calvin-1769557319)
[Runner] Waiting for job test-llm-internal-calvin-1769557319 to complete...
[Runner] llm-internal-calvin: Succeeded
[Runner] Fetching logs for test-llm-internal-calvin-1769557319-dl9g4...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
[test-connector] INFO: 🔌 New PgTestClient connected to db-758ed814-e605-4395-bacf-67d99258f455
[test-connector] INFO: 🔌 New PgTestClient connected to db-758ed814-e605-4395-bacf-67d99258f455
[test-connector] INFO: 🔌 New PgTestClient connected to db-758ed814-e605-4395-bacf-67d99258f455
  console.log
    [Test] Triggering Cloud Function (Attempt 1)...

      at Object.<anonymous> (functions/llm-internal-calvin/__tests__/index.test.ts:115:41)

  console.log
    [Test] Cloud Function Result: {
      "result": "Hello to you too! 😊 \n\nIs there anything I can help you with today?",
      "meta": {
        "id": "chatcmpl-b0d811c27909fd4a1634976b082e6a89",
        "object": "chat.completion",
        "created": 1769557328,
        "model": "RedHatAI/gemma-3-12b-it-quantized.w8a8",
        "choices": [
          {
            "index": 0,
            "message": {
              "role": "assistant",
              "content": "Hello to you too! 😊 \n\nIs there anything I can help you with today?",
              "refusal": null,
              "annotations": null,
              "audio": null,
              "function_call": null,
              "tool_calls": [],
              "reasoning": null,
              "reasoning_content": null
            },
            "logprobs": null,
            "finish_reason": "stop",
            "stop_reason": 106,
            "token_ids": null
          }
        ],
        "service_tier": null,
        "system_fingerprint": null,
        "usage": {
          "prompt_tokens": 11,
          "total_tokens": 30,
          "completion_tokens": 19,
          "prompt_tokens_details": null
        },
        "prompt_logprobs": null,
        "prompt_token_ids": null,
        "kv_transfer_params": null
      }
    }

      at Object.<anonymous> (functions/llm-internal-calvin/__tests__/index.test.ts:129:49)

  console.log
    
    [Evidence] Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/llm-internal-calvin/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "prompt"
        ]
      }
    }
    [runner] Incoming Request Body: {"prompt":"hello world"}
    [llm-internal-calvin] Request received
    Calling Calvin API with prompt: hello world...
    Calvin API Response received

      at Object.<anonymous> (functions/llm-internal-calvin/__tests__/index.test.ts:147:37)

  console.log
    ✅ Final Verified Calvin Response: Hello to you too! 😊 
    
    Is there anything I can help you with today?

      at Object.<anonymous> (functions/llm-internal-calvin/__tests__/index.test.ts:172:17)

  console.log
    [Teardown] Cleaning up job: llm-calvin-exec-1769557323

      at functions/test-utils.ts:22:17

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for db-758ed814-e605-4395-bacf-67d99258f455
[test-connector] SUCCESS: ✅ Closed client for db-758ed814-e605-4395-bacf-67d99258f455
[test-connector] SUCCESS: ✅ Closed client for db-758ed814-e605-4395-bacf-67d99258f455
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: db-758ed814-e605-4395-bacf-67d99258f455
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/llm-internal-calvin/__tests__/index.test.ts (11.01 s)
  LLM Internal Calvin Function (Integration)
    ✓ should orchestrate the llm-internal-calvin job (8417 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        11.162 s
Ran all test suites matching functions/llm-internal-calvin/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: opencode-headless (Job: test-opencode-headless-1769557335)
[Runner] Waiting for job test-opencode-headless-1769557335 to complete...
[Runner] opencode-headless: Succeeded
[Runner] Fetching logs for test-opencode-headless-1769557335-vplwb...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    Attempting to trigger opencode-headless via proxy...

      at Object.<anonymous> (functions/opencode-headless/__tests__/index.test.ts:71:41)

  console.log
    Trigger status: 200 OK

      at Object.<anonymous> (functions/opencode-headless/__tests__/index.test.ts:77:41)

  console.log
    Trigger response: {"success":true,"status":"running","pid":37}

      at Object.<anonymous> (functions/opencode-headless/__tests__/index.test.ts:79:41)

  console.log
    
    [Evidence] Function Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/opencode-headless/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "prompt"
        ]
      }
    }
    [runner] Incoming Request Body: {"prompt":"test"}
    [opencode-headless] Request received
    Starting Opencode Agent for: No URL - test
    [opencode-headless] Using binary at: /app/functions/opencode-headless/bin/opencode
    [opencode-headless] Spawning: /app/functions/opencode-headless/bin/opencode with args: serve --port 8081
    [opencode-headless] Child PID: 37
    [opencode] opencode server listening on http://127.0.0.1:8081

      at Object.<anonymous> (functions/opencode-headless/__tests__/index.test.ts:104:21)

PASS functions/opencode-headless/__tests__/index.test.ts (9 s)
  Opencode Headless Function (Integration)
    ✓ should orchestrate the opencode-headless job (6797 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        9.154 s
Ran all test suites matching functions/opencode-headless/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: pgpm-dump (Job: test-pgpm-dump-1769557349)
[Runner] Waiting for job test-pgpm-dump-1769557349 to complete...
[Runner] pgpm-dump: Succeeded
[Runner] Fetching logs for test-pgpm-dump-1769557349-p69hg...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
[test-connector] INFO: 🔌 New PgTestClient connected to db-d1579258-023e-468c-8d97-fe0e384cfbac
[test-connector] INFO: 🔌 New PgTestClient connected to db-d1579258-023e-468c-8d97-fe0e384cfbac
[test-connector] INFO: 🔌 New PgTestClient connected to db-d1579258-023e-468c-8d97-fe0e384cfbac
  console.log
    [Test] Orchestrating Job: pgpm-dump-exec-1769557354

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:42:17)

  console.log
    [Test] Waiting for pod for job pgpm-dump-exec-1769557354 to be Running...

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:93:17)

  console.log
    [Test] Found Pod: pgpm-dump-exec-1769557354-869p6

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:108:33)

  console.log
    [Test] Service is listening! Success.

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:119:37)

  console.log
    
    [Evidence] Function Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/pgpm-dump/src/index.ts' listening on port 8080

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:120:37)

  console.log
    [Test] Invoking pgpm-dump function via proxy...

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:125:37)

  console.log
    [Test] Invocation Response: {"message":"PGPM Dump executed successfully","args":{"_":[],"database":"postgres","out":"/tmp/test_dump.sql","user":"postgres"}}

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:147:37)

  console.log
    [Test] Function invocation reported success. Verifying file existence in pod...

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:157:37)

  console.log
    [Test] Verified: Function returned success message.

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:162:37)

  console.log
    [Test] Verified: SQL dump file exists inside the container.

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:164:37)

  console.log
    
    [Evidence] Final Pod Logs (incl. Dump Output):
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/pgpm-dump/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "database",
          "out",
          "user"
        ]
      }
    }
    [runner] Incoming Request Body: {"database":"postgres","out":"/tmp/test_dump.sql","user":"postgres"}
    Pgpm Dump Request received { database: 'postgres', out: '/tmp/test_dump.sql', user: 'postgres' }
    GQL Query Result: {"ok":true,"data":{"apis":{"nodes":[{"id":"a1a5ec6f-eff4-47b4-a372-2487cab792fe","name":"main-api"}],"totalCount":1,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false,"startCursor":"WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d","endCursor":"WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d"}}}}
    Executing pgpm dump programmatically with args: {"_":[],"database":"postgres","out":"/tmp/test_dump.sql","user":"postgres"}
    [dump] INFO: dumping database postgres
    [dump] INFO: writing to /tmp/test_dump.sql
    [dump] SUCCESS: dump complete

      at Object.<anonymous> (functions/pgpm-dump/__tests__/index.test.ts:169:37)

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for db-d1579258-023e-468c-8d97-fe0e384cfbac
[test-connector] SUCCESS: ✅ Closed client for db-d1579258-023e-468c-8d97-fe0e384cfbac
[test-connector] SUCCESS: ✅ Closed client for db-d1579258-023e-468c-8d97-fe0e384cfbac
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: db-d1579258-023e-468c-8d97-fe0e384cfbac
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/pgpm-dump/__tests__/index.test.ts (6.804 s)
  Pgpm Dump Function (Integration)
    ✓ should orchestrate the pgpm-dump job and verify completion (4184 ms)
    ✓ should verify database connectivity via pgsql-test (4 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        7 s
Ran all test suites matching functions/pgpm-dump/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: pytorch-gpu (Job: test-pytorch-gpu-1769557361)
[Runner] Waiting for job test-pytorch-gpu-1769557361 to complete...
[Runner] pytorch-gpu: Succeeded
[Runner] Fetching logs for test-pytorch-gpu-1769557361-7d7rv...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
PASS functions/pytorch-gpu/__tests__/index.test.ts (6.313 s)
  PyTorch GPU Function (Integration)
    ✓ should orchestrate the pytorch-gpu job (4140 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        6.463 s
Ran all test suites matching functions/pytorch-gpu/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: runtime-script (Job: test-runtime-script-1769557373)
[Runner] Waiting for job test-runtime-script-1769557373 to complete...
[Runner] runtime-script: Succeeded
[Runner] Fetching logs for test-runtime-script-1769557373-bzxh7...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
[test-connector] INFO: 🔌 New PgTestClient connected to runtime_script_test_33675
[test-connector] INFO: 🔌 New PgTestClient connected to runtime_script_test_33675
[test-connector] INFO: 🔌 New PgTestClient connected to runtime_script_test_33675
  console.log
    [Test] Waiting for pod for job runtime-script-exec-1769557378 to be Running...

      at Object.<anonymous> (functions/runtime-script/__tests__/index.test.ts:94:17)

  console.log
    [Test] Found Pod: runtime-script-exec-1769557378-b4r5w

      at Object.<anonymous> (functions/runtime-script/__tests__/index.test.ts:109:33)

  console.log
    [Test] Service is listening! Success.

      at Object.<anonymous> (functions/runtime-script/__tests__/index.test.ts:119:37)

  console.log
    [Test] Invoking runtime-script function via proxy...

      at Object.<anonymous> (functions/runtime-script/__tests__/index.test.ts:136:17)

  console.log
    [Test] Invocation Response: {"message":"Script executed successfully","rowCount":1,"rows":[{"num":1}],"users":{"apis":{"nodes":[{"id":"a1a5ec6f-eff4-47b4-a372-2487cab792fe","name":"main-api"}],"totalCount":1,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false,"startCursor":"WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d","endCursor":"WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d"}}}}

      at Object.<anonymous> (functions/runtime-script/__tests__/index.test.ts:155:17)

  console.log
    [Test] Fetching post-invocation logs...

      at Object.<anonymous> (functions/runtime-script/__tests__/index.test.ts:158:17)

  console.log
    
    [Evidence] Post-Invocation Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/runtime-script/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "query"
        ]
      }
    }
    [runner] Incoming Request Body: {"query":"SELECT 1 as num"}
    [runtime-script] PARAMS: {"query":"SELECT 1 as num"}
    [runtime-script] Received script request
    [runtime-script] GQL Response: {
      "ok": true,
      "data": {
        "apis": {
          "nodes": [
            {
              "id": "a1a5ec6f-eff4-47b4-a372-2487cab792fe",
              "name": "main-api"
            }
          ],
          "totalCount": 1,
          "pageInfo": {
            "hasNextPage": false,
            "hasPreviousPage": false,
            "startCursor": "WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d",
            "endCursor": "WyJwcmltYXJ5X2tleV9hc2MiLFsiYTFhNWVjNmYtZWZmNC00N2I0LWEzNzItMjQ4N2NhYjc5MmZlIl1d"
          }
        }
      }
    }
    [runtime-script] Executing query: SELECT 1 as num
    [runtime-script] Query executed. Rows: 1

      at Object.<anonymous> (functions/runtime-script/__tests__/index.test.ts:162:17)

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for runtime_script_test_33675
[test-connector] SUCCESS: ✅ Closed client for runtime_script_test_33675
[test-connector] SUCCESS: ✅ Closed client for runtime_script_test_33675
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: runtime_script_test_33675
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/runtime-script/__tests__/index.test.ts (8.901 s)
  Runtime Script Function (Integration)
    ✓ should orchestrate runtime-script service (6196 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        9.045 s
Ran all test suites matching functions/runtime-script/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: rust-hello-world (Job: test-rust-hello-world-1769557388)
[Runner] Waiting for job test-rust-hello-world-1769557388 to complete...
[Runner] rust-hello-world: Succeeded
[Runner] Fetching logs for test-rust-hello-world-1769557388-gt789...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    [Test] Orchestrating Job: rust-hw-exec-1769557392

      at Object.<anonymous> (functions/rust-hello-world/__tests__/index.test.ts:32:17)

PASS functions/rust-hello-world/__tests__/index.test.ts
  Rust Hello World Function (Integration)
    ✓ should orchestrate the rust-hello-world job and verify log output (2104 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        4.508 s
Ran all test suites matching functions/rust-hello-world/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: send-email-link (Job: test-send-email-link-1769557398)
[Runner] Waiting for job test-send-email-link-1769557398 to complete...
[Runner] send-email-link: Succeeded
[Runner] Fetching logs for test-send-email-link-1769557398-t754r...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
[test-connector] INFO: 🔌 New PgTestClient connected to send_email_link_test_90182 
[test-connector] INFO: 🔌 New PgTestClient connected to send_email_link_test_90182 
[test-connector] INFO: 🔌 New PgTestClient connected to send_email_link_test_90182 
  console.log
    [Test] Waiting for pod for job send-email-link-exec-1769557403 to be Running...

      at Object.<anonymous> (functions/send-email-link/__tests__/index.test.ts:98:17)

  console.log
    [Test] Found Pod: send-email-link-exec-1769557403-54pln

      at Object.<anonymous> (functions/send-email-link/__tests__/index.test.ts:114:33)

  console.log
    [Test] Attempting to trigger function...

      at Object.<anonymous> (functions/send-email-link/__tests__/index.test.ts:133:37)

  console.log
    [Test] Trigger response: { missing: 'email_type' }

      at Object.<anonymous> (functions/send-email-link/__tests__/index.test.ts:147:37)

  console.log
    [Test] Trigger Verification Succeeded! Fetching logs...

      at Object.<anonymous> (functions/send-email-link/__tests__/index.test.ts:156:41)

  console.log
    [Evidence] Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/send-email-link/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {
        "x-database-id": "00000000-0000-0000-0000-000000000000"
      },
      "body": {
        "keys": [
          "email_type",
          "email"
        ]
      }
    }
    [runner] Incoming Request Body: {"email_type":"unknown_type_for_validation_check","email":"test@example.com"}

      at Object.<anonymous> (functions/send-email-link/__tests__/index.test.ts:160:41)

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for send_email_link_test_90182 
[test-connector] SUCCESS: ✅ Closed client for send_email_link_test_90182 
[test-connector] SUCCESS: ✅ Closed client for send_email_link_test_90182 
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: send_email_link_test_90182 
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/send-email-link/__tests__/index.test.ts (8.968 s)
  Send Email Link Function (Integration)
    ✓ should orchestrate send-email-link service and verify trigger (6181 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        9.127 s
Ran all test suites matching functions/send-email-link/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: simple-bash (Job: test-simple-bash-1769557412)
[Runner] Waiting for job test-simple-bash-1769557412 to complete...
[Runner] simple-bash: Succeeded
[Runner] Fetching logs for test-simple-bash-1769557412-xcrb2...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    [Test] Orchestrating Job: simple-bash-exec-1769557416

      at Object.<anonymous> (functions/simple-bash/__tests__/index.test.ts:35:17)

  console.log
    [Test] Waiting for job simple-bash-exec-1769557416 to complete...

      at Object.<anonymous> (functions/simple-bash/__tests__/index.test.ts:76:17)

  console.log
    Job Logs: Hello Bash! Arguments: arg1
    Done.

      at Object.<anonymous> (functions/simple-bash/__tests__/index.test.ts:114:25)

PASS functions/simple-bash/__tests__/index.test.ts (7.337 s)
  Simple Bash Function (Integration)
    ✓ should orchestrate simple-bash job (5145 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        7.484 s
Ran all test suites matching functions/simple-bash/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: simple-email (Job: test-simple-email-1769557424)
[Runner] Waiting for job test-simple-email-1769557424 to complete...
[Runner] simple-email: Succeeded
[Runner] Fetching logs for test-simple-email-1769557424-zrh7l...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
[test-connector] INFO: 🔌 New PgTestClient connected to simple_email_test_27236 
[test-connector] INFO: 🔌 New PgTestClient connected to simple_email_test_27236 
[test-connector] INFO: 🔌 New PgTestClient connected to simple_email_test_27236 
  console.log
    [Test] Waiting for pod for job simple-email-exec-1769557432 to be Running...

      at Object.<anonymous> (functions/simple-email/__tests__/index.test.ts:96:17)

  console.log
    [Test] Found Pod: simple-email-exec-1769557432-mdvs4

      at Object.<anonymous> (functions/simple-email/__tests__/index.test.ts:111:33)

  console.log
    [Test] Service is listening! Success.

      at Object.<anonymous> (functions/simple-email/__tests__/index.test.ts:121:37)

  console.log
    [Test] Invoking simple-email via proxy...

      at Object.<anonymous> (functions/simple-email/__tests__/index.test.ts:126:37)

  console.log
    [Test] Invocation Response: {"error":"Forbidden"}

      at Object.<anonymous> (functions/simple-email/__tests__/index.test.ts:134:37)

  console.log
    
    [Evidence] Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/simple-email/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "to",
          "subject",
          "text"
        ]
      }
    }
    [runner] Incoming Request Body: {"to":"test@example.com","subject":"Integration Test","text":"Hello World"}
    [simple-email] processing request
    Error: Forbidden
        at IncomingMessage.<anonymous> (/app/node_modules/.pnpm/mailgun-js@0.22.0/node_modules/mailgun-js/lib/request.js:327:17)
        at IncomingMessage.emit (node:events:536:35)
        at IncomingMessage.emit (node:domain:489:12)
        at endReadableNT (node:internal/streams/readable:1698:12)
        at processTicksAndRejections (node:internal/process/task_queues:82:21) {
      statusCode: 401
    }

      at Object.<anonymous> (functions/simple-email/__tests__/index.test.ts:139:37)

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for simple_email_test_27236 
[test-connector] SUCCESS: ✅ Closed client for simple_email_test_27236 
[test-connector] SUCCESS: ✅ Closed client for simple_email_test_27236 
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: simple_email_test_27236 
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/simple-email/__tests__/index.test.ts (16.234 s)
  Simple Email Function (Integration)
    ✓ should orchestrate simple-email service (13385 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        16.66 s
Ran all test suites matching functions/simple-email/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: stripe-function (Job: test-stripe-function-1769557450)
[Runner] Waiting for job test-stripe-function-1769557450 to complete...
[Runner] stripe-function: Succeeded
[Runner] Fetching logs for test-stripe-function-1769557450-sdjsc...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    [Test] Invoking stripe-fn via proxy...

      at Object.<anonymous> (functions/stripe-function/__tests__/index.test.ts:74:37)

  console.log
    
    [Evidence] Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/stripe-function/src/index.ts' listening on port 8080
    [knative-job-fn] INFO: Incoming job request {
      "method": "POST",
      "path": "/",
      "headers": {},
      "body": {
        "keys": [
          "type"
        ]
      }
    }
    [runner] Incoming Request Body: {"type":"payment_intent.succeeded"}
    [stripe-fn] Request received
    Stripe Error: Invalid API Key provided: sk_test_****_123

      at Object.<anonymous> (functions/stripe-function/__tests__/index.test.ts:85:37)

PASS functions/stripe-function/__tests__/index.test.ts (10.96 s)
  Stripe Function (Integration)
    ✓ should orchestrate the stripe-fn job and verify startup (8542 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        11.553 s
Ran all test suites matching functions/stripe-function/__tests__/index.test.ts.

==============================================================

[Runner] Starting test for: twilio-sms (Job: test-twilio-sms-1769557468)
[Runner] Waiting for job test-twilio-sms-1769557468 to complete...
[Runner] twilio-sms: Succeeded
[Runner] Fetching logs for test-twilio-sms-1769557468-lhkql...

=================== EVIDENCE LOGS (STDOUT) ===================
ts-jest[config] (WARN) 
    The "ts-jest" config option "isolatedModules" is deprecated and will be removed in v30.0.0. Please use "isolatedModules: true" in /app/tsconfig.json instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules
  
  console.log
    [dotenv@17.2.3] injecting env (0) from .env -- tip: 🔄 add secrets lifecycle management: https://dotenvx.com/ops

      at _log (node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js:142:11)

[test-connector] INFO: 🔌 New PgTestClient connected to twilio_sms_test_78091
[test-connector] INFO: 🔌 New PgTestClient connected to twilio_sms_test_78091
[test-connector] INFO: 🔌 New PgTestClient connected to twilio_sms_test_78091
  console.log
    [Test] Triggering Twilio SMS...

      at Object.<anonymous> (functions/twilio-sms/__tests__/index.test.ts:101:37)

  console.log
    
    [Evidence] Function Pod Logs:
    [runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: http://constructive-server:3000/graphql
    [runner] Function 'functions/twilio-sms/src/index.ts' listening on port 8080

      at Object.<anonymous> (functions/twilio-sms/__tests__/index.test.ts:122:25)

[test-connector] INFO: 🧹 Closing all PgTestClients...
[test-connector] SUCCESS: ✅ Closed client for twilio_sms_test_78091
[test-connector] SUCCESS: ✅ Closed client for twilio_sms_test_78091
[test-connector] SUCCESS: ✅ Closed client for twilio_sms_test_78091
[test-connector] INFO: 🧯 Disposing pg pools...
[test-connector] INFO: 🗑️ Dropping seen databases...
[test-connector] WARN: 🧨 Dropped database: twilio_sms_test_78091
[test-connector] SUCCESS: ✅ All PgTestClients closed, pools disposed, databases dropped.
PASS functions/twilio-sms/__tests__/index.test.ts (7.067 s)
  Twilio SMS Function (Integration)
    ✓ should verify database connectivity via pgsql-test (25 ms)
    ✓ should orchestrate the twilio-sms job and verify startup (4086 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        7.282 s
Ran all test suites matching functions/twilio-sms/__tests__/index.test.ts.

==============================================================

0xj0@0xJ0s-MacBook-Pro constructive-functions % 

Jovonni and others added 30 commits January 8, 2026 14:37
RUN echo '{}' > package.json

# Install common runtime deps
RUN pnpm install express@4.18.2 body-parser@1.20.2 graphql-request@6.1.0 pg@8.11.3 cross-fetch@4.0.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about a package.json? why install manualy?


NOTE: ALL INDEX.TS MUST HAVE A TYPED GRAPHQL QUERY, PERIOD, DONT EVER USE STRING BASED GQL QUERY.. EEVR...

okay so how do we know everything belowis impemented and tested then? THEN ANALYSE ALL OF THE GIT STATUS AND GIT DIFFS TO EDUCATE ME ON WHAT WAS CHANGED AND HOW IT ALIGNS TO WHAT WAS ASKED OF ME BELOW:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's clean up some english, looks fun maybe that helps llm lol — I'd just have an agent pass over to clean up grammer/spelling

try {
// Priority 2: Runtime's node_modules (Base Image context)
return require(require.resolve(name, { paths: [__dirname] }));
} catch (e2) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's avoid require? and go in an TS?

// 5. Setup Route
// 5. Setup Route
// 6. Start Server
const port = Number(process.env.PORT ?? 8080);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's iron out our env stuff, we may need to cleanup 12factor-env but I think it should support env vars now


// Use standard PG env vars
const pgClient = new Client({
user: process.env.PGUSER || 'postgres',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also use our env vars from either pg-env or another — @Anmol1696 let's figure out how we want to extract some of the env stuff


beforeAll(async () => {
// Start kubectl proxy in background to handle auth
const { spawn } = require('child_process');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use import and hoist these


// Connect to local proxy
k8s = new KubernetesClient({
restEndpoint: 'http://127.0.0.1:8001'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endpoint like this should def be an env var

{ name: "PGHOST", value: "postgres" },
{ name: "PGUSER", value: "postgres" },
{ name: "PGDATABASE", value: "postgres" },
{ name: "PGPASSWORD", value: process.env.PGPASSWORD }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are we aiming to handle secrets?

if (podName) {
try {
// Use raw fetch via proxy because kubernetesjs might fail to parse text logs
const res = await fetch(`http://127.0.0.1:8001/api/v1/namespaces/${NAMESPACE}/pods/${podName}/log?tailLines=50`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does k8s js have this route, I would imagine it does? why not import that and make it a bit more tight/clean? (cc @Anmol1696 )

// We use process.env vars which should be injected by the runner/container
const client = new Client({
host: process.env.PGHOST || 'localhost',
port: parseInt(process.env.PGPORT || '5432'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be using pg-env, similar to before

"access": "public",
"directory": "dist"
},
"main": "dist/index.js",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dist/ should not be in main if publishConfig is set to dist

the publishConfig is correct, the main, types, and files are incorrect

['host', 'content-length', 'connection', 'content-type', 'accept', 'user-agent', 'accept-encoding'].forEach(k => delete safeHeaders[k]);

const sdk = createClient({
endpoint: process.env.GRAPHQL_ENDPOINT || 'http://constructive-server:3000/graphql',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's hoist all env vars to top of all functions

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Integrates the typed @constructive-db/constructive-sdk across functions and standardizes builds/tests to reduce flakiness while adding local dev tooling for invoking and running functions.

Changes:

  • Replaced graphql-request usage inside functions with @constructive-db/constructive-sdk (via shared sdk.tgz).
  • Added local dev gateway + config loader + CLI invoker scripts.
  • Updated K8s manifests, Dockerfiles, and k8s integration tests/test-runner image usage.

Reviewed changes

Copilot reviewed 107 out of 111 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
scripts/test-runner.ts Updates test runner image/flags; adds kubectl clusterrolebinding creation.
scripts/invoke.ts Adds a simple CLI to POST to a function endpoint.
scripts/gateway.ts Adds a local Express gateway that auto-mounts functions.
scripts/config-loader.ts Adds .env / config.json loader for function config.
package.json Adds dev script and gateway/invoke dependencies.
k8s/overlays/local/kustomization.yaml Adds local image overrides and Knative bypass annotation patches.
k8s/base/functions/stripe-function.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/simple-email.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/simple-bash.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/send-email-link.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/rust-hello-world.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/runtime-script.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/pytorch-gpu.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/opencode-headless.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/llm-internal-calvin.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/llm-external.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/github-repo-creator.yaml Adds imagePullSecrets for GHCR pulls.
k8s/base/functions/crypto-login.yaml Adds imagePullSecrets for GHCR pulls.
functions/twilio-sms/src/index.ts Migrates to constructive SDK and header sanitization.
functions/twilio-sms/sdk.tgz Points function to shared sdk.tgz.
functions/twilio-sms/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/twilio-sms/tests/index.test.ts Bumps test runner image tag.
functions/twilio-sms/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/stripe-function/src/index.ts Migrates to constructive SDK and header sanitization.
functions/stripe-function/sdk.tgz Points function to shared sdk.tgz.
functions/stripe-function/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/stripe-function/tests/index.test.ts Bumps test runner image tag and adds invocation evidence.
functions/stripe-function/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/simple-email/src/index.ts Migrates to constructive SDK and header sanitization.
functions/simple-email/sdk.tgz Points function to shared sdk.tgz.
functions/simple-email/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/simple-email/tests/index.test.ts Bumps test runner image tag and adds invocation evidence.
functions/simple-email/Dockerfile Updates Dockerfile copy paths + shared sdk.tgz.
functions/simple-bash/sdk.tgz Points function to shared sdk.tgz.
functions/simple-bash/package.json Renames package and adjusts publish/start metadata.
functions/simple-bash/tests/index.test.ts Removes DB setup; bumps test runner image tag; uses /bin/sh.
functions/simple-bash/Dockerfile Fixes COPY path for repo-root docker builds.
functions/send-email-link/src/index.ts Migrates to constructive SDK; refactors DB/user lookups.
functions/send-email-link/sdk.tgz Points function to shared sdk.tgz.
functions/send-email-link/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/send-email-link/tests/index.test.ts Bumps test runner image tag and adds log capture.
functions/send-email-link/Dockerfile Updates Dockerfile copy paths + shared sdk.tgz.
functions/rust-hello-world/sdk.tgz Points function to shared sdk.tgz.
functions/rust-hello-world/package.json Adds metadata/scripts for Rust function folder.
functions/rust-hello-world/tests/index.test.ts Updates test comments re build responsibility.
functions/rust-hello-world/Dockerfile Fixes COPY paths for repo-root docker builds.
functions/rust-hello-world/Cargo.lock Adds Rust lockfile for reproducible builds.
functions/runtime-script/src/index.ts Migrates to constructive SDK and header sanitization.
functions/runtime-script/sdk.tgz Points function to shared sdk.tgz.
functions/runtime-script/package.json Switches dependency to @constructive-db/constructive-sdk (+ graphql dep).
functions/runtime-script/tests/index.test.ts Bumps test runner image tag and adds invocation evidence.
functions/runtime-script/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/pytorch-gpu/sdk.tgz Points function to shared sdk.tgz.
functions/pytorch-gpu/package.json Adds metadata/scripts for Python function folder.
functions/pytorch-gpu/tests/index.test.ts Updates test comments re build responsibility.
functions/pytorch-gpu/Dockerfile Fixes COPY paths for repo-root docker builds.
functions/pgpm-dump/src/index.ts Migrates to constructive SDK and header sanitization.
functions/pgpm-dump/sdk.tgz Points function to shared sdk.tgz.
functions/pgpm-dump/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/pgpm-dump/tests/index.test.ts Bumps test runner image tag; adjusts env/log tailLines/verification.
functions/pgpm-dump/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/opencode-headless/src/index.ts Migrates to constructive SDK and header sanitization.
functions/opencode-headless/sdk.tgz Points function to shared sdk.tgz.
functions/opencode-headless/scripts/build-calvin.sh Adds build fixes/patching for bun workspace deps.
functions/opencode-headless/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/opencode-headless/tests/index.test.ts Bumps test runner image tag.
functions/opencode-headless/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/llm-internal-calvin/src/index.ts Migrates to constructive SDK and header sanitization.
functions/llm-internal-calvin/sdk.tgz Points function to shared sdk.tgz.
functions/llm-internal-calvin/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/llm-internal-calvin/tests/index.test.ts Bumps test runner image tag and adjusts evidence logging.
functions/llm-internal-calvin/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/llm-external/src/index.ts Migrates to constructive SDK; refactors provider handling.
functions/llm-external/sdk.tgz Points function to shared sdk.tgz.
functions/llm-external/package.json Switches dependency to @constructive-db/constructive-sdk (+ graphql dep).
functions/llm-external/tests/index.test.ts Bumps test runner image tag and adds evidence logging.
functions/llm-external/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/hello-world/src/index.ts Migrates to constructive SDK; returns user context.
functions/hello-world/sdk.tgz Points function to shared sdk.tgz.
functions/hello-world/package.json Fixes runner path; switches dependency to SDK (+ graphql dep).
functions/hello-world/tests/index.test.ts Bumps test runner image tag; adds invocation/user-context verification.
functions/hello-world/Dockerfile Adds multi-stage build + shared runtime usage.
functions/hello-world/.dockerignore Adds function-level dockerignore.
functions/github-repo-creator/src/index.ts Migrates to constructive SDK and header sanitization.
functions/github-repo-creator/sdk.tgz Points function to shared sdk.tgz.
functions/github-repo-creator/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/github-repo-creator/tests/index.test.ts Bumps test runner image tag and adds invocation evidence.
functions/github-repo-creator/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/crypto-login/src/index.ts Migrates to constructive SDK and header sanitization.
functions/crypto-login/sdk.tgz Points function to shared sdk.tgz.
functions/crypto-login/package.json Switches dependency to @constructive-db/constructive-sdk.
functions/crypto-login/tests/index.test.ts Bumps test runner image tag and adds invocation evidence.
functions/crypto-login/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/create-db/tsconfig.json Adds TS config for new create-db function.
functions/create-db/src/index.ts Adds a function that creates a Postgres database.
functions/create-db/sdk.tgz Points function to shared sdk.tgz.
functions/create-db/package.json Adds create-db function package metadata/scripts/deps.
functions/create-db/tests/run-k8s.sh Switches test runner invocation to npx ts-node.
functions/create-db/tests/index.test.ts Adds k8s integration test for create-db.
functions/create-db/Makefile Adds per-function make targets (and image vars).
functions/create-db/Dockerfile Adds per-function Docker build using shared sdk.tgz.
functions/_runtimes/sdk.tgz Points runtime to shared sdk.tgz.
functions/_runtimes/node/runner.js Enhances runtime dependency resolution + user/async flow context.
functions/_runtimes/node/Dockerfile.test Adjusts test image cleanup steps.
functions/_runtimes/node/Dockerfile.runtime Adds shared node runtime image for functions.
Makefile Adds runtime build step, kind-load-all, bumps test runner tag, expands targets.
.gitignore Keeps sdk.tgz tracked while ignoring other tgz files.
.dockerignore Broadens node_modules ignore pattern.
.agent/rules/new-func-requirements.md Adds agent guidance doc for function requirements.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +119 to +123
- patch: |-
- op: add
path: /spec/template/metadata/annotations
value:
serving.knative.dev/bypass-tag-resolution: "true"
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This JSON6902 patch adds /spec/template/metadata/annotations as a whole, which will replace the existing annotations map in the base Knative Service (timeouts/autoscaling/etc.). Patch the specific annotation key instead (e.g., add/replace /spec/template/metadata/annotations/serving.knative.dev~1bypass-tag-resolution) to avoid clobbering existing annotations.

Copilot uses AI. Check for mistakes.
Comment on lines 28 to 31
const value = process.env[name];
if (!value) {
throw new Error(`Missing required environment variable ${name}`);
throw new Error(`Missing required environment variable ${name} `);
}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thrown error message has a trailing space after the env var name, which can cause brittle string matching in logs/tests and looks like a typo. Remove the extra whitespace.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +22
const result = await sdk.api.findMany({ select: { id: true, name: true }, first: 1 }).execute();
if (result.ok) console.error('[twilio-sms] GQL Response:', JSON.stringify(result.data, null, 2));
if (!result.ok) {
console.error('[twilio-sms] GQL Request failed:', result.errors);
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successful GraphQL responses are logged with console.error, which will be treated as an error by log collectors/alerting. Use console.log/console.info for success paths and reserve console.error for failures.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,22 @@

IMAGE_NAME ?= constructive/pgpm-dump-test:v1
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMAGE_NAME is set to constructive/pgpm-dump-test:v1, which appears unrelated to the create-db function and looks like a copy/paste artifact. Either remove it if unused or update it to the correct create-db image name to avoid confusion.

Suggested change
IMAGE_NAME ?= constructive/pgpm-dump-test:v1

Copilot uses AI. Check for mistakes.
Comment thread scripts/test-runner.ts
Comment on lines +185 to +188
// Ensure default SA has permissions for test runner jobs
try {
spawnSync('kubectl', ['create', 'clusterrolebinding', 'default-admin', '--clusterrole=cluster-admin', '--serviceaccount=default:default'], { stdio: 'ignore' });
} catch (e) { }
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test runner is granting cluster-admin to the default service account by creating a ClusterRoleBinding. This is a high-privilege, cluster-wide permission escalation that can persist beyond tests and affect other workloads. Prefer documenting RBAC as a prerequisite, or create a tightly-scoped Role/RoleBinding in the test namespace (and only when a dedicated flag is set), with idempotent checks (e.g., kubectl get clusterrolebinding ... / kubectl auth can-i).

Copilot uses AI. Check for mistakes.
first: 5
}).execute();

const users = result.ok ? result.data : null;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable users.

Suggested change
const users = result.ok ? result.data : null;

Copilot uses AI. Check for mistakes.
first: 5
}).execute();

const users = result.ok ? result.data : null;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable users.

Suggested change
const users = result.ok ? result.data : null;

Copilot uses AI. Check for mistakes.
import axios from 'axios';
import gql from 'graphql-tag';
import { createClient } from '@constructive-db/constructive-sdk';
import axios from 'axios'; // kept although fetch is used below? fetch is imported from cross-fetch.
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import axios.

Copilot uses AI. Check for mistakes.
const safeHeaders = { ...headers };
['host', 'content-length', 'connection', 'content-type', 'accept', 'user-agent', 'accept-encoding'].forEach(k => delete safeHeaders[k]);

const sdk = createClient({
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable sdk.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +23

# The user's code will be mounted/copied here
WORKDIR /usr/src/app

Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node runtime image runs processes as root because there is no USER directive to drop privileges, so any compromise of user code executed by runner.js results in full root access inside the container and increases the risk of container breakout on a shared cluster. To reduce impact, run the runtime under a dedicated unprivileged user (for example, the built-in node user) and ensure files and ports are configured so root is not required.

Suggested change
# The user's code will be mounted/copied here
WORKDIR /usr/src/app
# Ensure the user code directory exists and is writable by the node user
RUN mkdir -p /usr/src/app && chown -R node:node /usr/src/app
# The user's code will be mounted/copied here
WORKDIR /usr/src/app
# Run the runtime as an unprivileged user
USER node

Copilot uses AI. Check for mistakes.

// Invoke to trigger GQL log
console.log('[Test] Invoking github-repo-creator via proxy...');
const proxyUrl = `http://127.0.0.1:8007/api/v1/namespaces/${NAMESPACE}/pods/${podName}:8080/proxy/`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Anmol1696 — all these k8s things to implement, is this really something we're going to allow?

@Jovonni I think we should ideally be writing these as code, not pinging our infra to spin up new things? I'm a bit confused on this one to be honest, maybe we can walk through it

});

// Execute GQL Query as proof of connectivity (without try-catch)
const result = await sdk.api.findMany({ select: { id: true, name: true }, first: 1 }).execute();
Copy link
Copy Markdown
Contributor

@pyramation pyramation Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is needed this pgpm-dump? first api? Do you mean to get apis for a db?

endpoint: metaGraphqlUrl,
headers: {
...(process.env.GRAPHQL_AUTH_TOKEN ? { Authorization: `Bearer ${process.env.GRAPHQL_AUTH_TOKEN}` } : {}),
...(process.env.META_GRAPHQL_HOST_HEADER ? { host: process.env.META_GRAPHQL_HOST_HEADER } : {})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, let's hoist these into a env.ts

"private": true,
"private": false,
"main": "dist/index.js",
"types": "dist/index.d.ts",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont' use dist/ in main, typesor files — jsut publishConfig.directory = dist

client: GraphQLClient;
meta: GraphQLClient;
client: any; // Type as 'any' or SDK client type if strictly typed, but for now 'any' allows passing sdk
meta: any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any?

Comment thread scripts/config-loader.ts
@@ -0,0 +1,55 @@

import dotenv from 'dotenv';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's avoid dotenv, creates a "works on my machine" scenarios

Comment thread scripts/gateway.ts
import fs from 'fs';
import path from 'path';
import { GraphQLClient } from 'graphql-request';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file for testing?

Comment thread scripts/invoke.ts
import fetch from 'cross-fetch';

const GATEWAY_URL = process.env.GATEWAY_URL || 'http://localhost:3000';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file for testing?

Copy link
Copy Markdown
Contributor

@pyramation pyramation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • A lot of hard-coded URLs that should be using k8s js
  • but maybe we should be questioning the usage of calling k8s proxy in a function? (cc @Anmol1696 )
  • lots of code that has mixed variables, paths, env vars scattered throughout code needs to be hoisted and systematized in a env.ts file
  • lots of JS style, we should be more TS and can tighten things up a lot
  • small thing, but let's go with 2 spaces indent for formatting similar to our other repos and standards
  • ideally everything uses a package.json, I saw a few manually npm installs in runners? maybe others?
  • passwords all over, let's standardize this
  • seeing lots of duplicated code, that is querying APIs, but not sure that it's doing what it should, e.g using a database id (e.g. pgpm-dump)
  • found some any types in GraphQLClient — there should be someway to fix that we can brainstorm
  • remove dotenv usage in favor of 12factor-env setup — dotenv creates a "works on my machine scenario" or let's at least strategize this so we can have cohesion

@Jovonni
Copy link
Copy Markdown
Contributor Author

Jovonni commented Jan 28, 2026

Awesome feedback! Thank you bro, will address all of these 🚀

@Anmol1696
Copy link
Copy Markdown
Contributor

Heads-up: repository history was rewritten on 2026-05-12 to scrub leaked secrets (Postgres/pgAdmin default passwords, an AWS access key ID, generated k8s/manifests/interweb-*.yaml files) from every commit. Every branch on origin was force-pushed with new commit SHAs.

This PR shows "DIRTY" / merge-conflict status because main has a cleanup commit and this branch is based on pre-rewrite main. To clear it:

git fetch --all --prune
git checkout <this-branch>
git reset --hard origin/<this-branch>    # your local branch tip moved too — pick up the rewritten version
git rebase origin/main                    # rebase onto rewritten main
# resolve conflicts (usually trivial — mostly secret-placeholder + the 4 deleted interweb-*.yaml files)
git push --force-with-lease

Or merge instead of rebase if the branch is shared with others:

git merge origin/main
git push

Notes:

  • The secrets that leaked were all either dead (rotated AWS key) or were defaults that have since been rotated/replaced; no active credential is exposed.
  • Old commit SHAs are still accessible by direct URL on GitHub for ~90 days (can be expedited via GitHub Support if needed).
  • See k8s/SECRET-EXPOSURE-AUDIT.md on main for the full incident audit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants