Skip to content

feat(stdlib/Http): RSR rewire — surface hpm-http-rsr Zig FFI (10 exports)#425

Merged
hyperpolymath merged 2 commits into
mainfrom
feat/http-server-rsr-rewire
May 28, 2026
Merged

feat(stdlib/Http): RSR rewire — surface hpm-http-rsr Zig FFI (10 exports)#425
hyperpolymath merged 2 commits into
mainfrom
feat/http-server-rsr-rewire

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

Surfaces the 10 HTTP-server Zig FFI exports from hyperpolymath/http-capability-gateway as pub extern declarations in stdlib/Http.affine. This is the last AffineScript stdlib gate for the OikosBot port (oikos#41, bot-integration-affine/) to reach feature parity with the retired ReScript webhook receiver.

The 10 exports

Group Externs
Server lifecycle hpm_http_server_listen, hpm_http_server_port, hpm_http_server_free, hpm_http_server_accept
Request inspection hpm_http_request_method, hpm_http_request_path, hpm_http_request_header, hpm_http_request_body
Response + cleanup hpm_http_request_respond, hpm_http_request_free

Plus two opaque types: pub extern type HpmHttpServer;, pub extern type HpmHttpRequest;.

Effect-row choices

  • / Net for the sync ops (listen, port, free, all request inspectors + respond + request-free)
  • / { Net, Async } for the blocking accept

Native-only — no Deno-ESM lowering

Consistent with the existing http_request_thenable / response* wasm-path externs already in the module. The natural deployment is WasmGC / native-C linking libhttp_capability_gateway alongside libhpm_crypto.

Native lowering is responsible for adapting the Zig size-query convention (isize, NULL/0 → required size, then re-call to write into a caller-provided buffer) into the AS-friendly String / Option<String> returns the externs declare. AS callers never see the two-step protocol.

Verification

  • affinescript check stdlib/Http.affine — type checks
  • dune build — clean
  • dune runtest — same 2 pre-existing failures as main, no regressions (341 tests run vs 340 on main: harness picked up an extra check on the modified file)
  • ✅ External-consumer smoke: a separate .affine module importing all 12 names + sketching the OikosBot webhook accept loop (POST /webhook with HMAC signature placeholder; 404 on other paths) type checks end-to-end

Vocabulary

"Zig FFI" not "C-ABI" — the C calling convention is an implementation detail of Zig's export fn. Estate convention is Zig=FFIs / Idris2=ABIs (matches affinescript#421 for hpm-json-rsr).

Test plan

  • affinescript check stdlib/Http.affine still green after rebase
  • OikosBot port (oikos/bot-integration-affine/) can use Http::{...} the new names and link the native FFI library

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 81 issues detected

Severity Count
🔴 Critical 4
🟠 High 10
🟡 Medium 67

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v6 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in affine-vscode-publish.yml",
    "type": "unknown",
    "file": "affine-vscode-publish.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 81 issues detected

Severity Count
🔴 Critical 4
🟠 High 10
🟡 Medium 67

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v6 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in affine-vscode-publish.yml",
    "type": "unknown",
    "file": "affine-vscode-publish.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

hyperpolymath and others added 2 commits May 28, 2026 13:33
…rts)

Adds the server-side counterpart to `http_request` by surfacing the 10
HTTP-server primitives from `hyperpolymath/http-capability-gateway`'s
Zig FFI as `pub extern` declarations in stdlib/Http.affine. This is the
last AffineScript stdlib gate for the OikosBot port (oikos#41,
`bot-integration-affine/`) to reach feature parity with the retired
ReScript webhook receiver.

The 10 exports:
  * hpm_http_server_listen / _port / _free / _accept
  * hpm_http_request_method / _path / _header / _body / _respond / _free

Effect rows: `/ Net` for the sync ops; `/ { Net, Async }` for the
blocking `accept`. Native lowering is responsible for adapting the Zig
size-query convention (`isize`, NULL/0 → required size, then re-call)
into the AS-friendly `String` / `Option<String>` returns the externs
declare; AS callers never see the two-step protocol.

**Native-only**: no Deno-ESM lowering, consistent with the existing
`http_request_thenable` + `response*` wasm-path externs already in the
module. The natural deployment target is WasmGC / native-C linking
libhttp_capability_gateway alongside libhpm_crypto.

Verified: `affinescript check` passes on stdlib/Http.affine and on an
external smoke consumer importing all 12 names + sketching the
OikosBot webhook accept loop (POST /webhook with HMAC signature
verification placeholder, 404 on other paths). Full test suite: same
2 pre-existing failures as main, no regressions (341 tests run).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath force-pushed the feat/http-server-rsr-rewire branch from 686da15 to 986f33e Compare May 28, 2026 12:34
@hyperpolymath hyperpolymath merged commit 3049be5 into main May 28, 2026
21 of 23 checks passed
@hyperpolymath hyperpolymath deleted the feat/http-server-rsr-rewire branch May 28, 2026 12:34
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 81 issues detected

Severity Count
🔴 Critical 4
🟠 High 10
🟡 Medium 67

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v6 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in affine-vscode-publish.yml",
    "type": "unknown",
    "file": "affine-vscode-publish.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant