Skip to content

feat(stdlib): httpPostJson async-extern for out-of-process JSON POST#210

Merged
hyperpolymath merged 1 commit into
mainfrom
pr5db/http-post-json
May 18, 2026
Merged

feat(stdlib): httpPostJson async-extern for out-of-process JSON POST#210
hyperpolymath merged 1 commit into
mainfrom
pr5db/http-post-json

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Adds pub extern fn httpPostJson(url, body_json) -> Thenable / Async to stdlib/Vscode.affine + canonical runtime impl in packages/affine-vscode/mod.js, following the exact #205 thenable convention (register the response Thenable; guest observes via thenableThen/thenableResultJson, identical to languageClientSendRequest).

Why: lets a VS Code extension reach a BoJ-server cartridge endpoint (e.g. reposystem_run_audit on boj-server :7700) as a real in-process request instead of shelling a CLI. Unblocks the BoJ-primary tier of the rsr-certifier extension rewire (PR-5d-B).

Failed/non-JSON responses settle as { __error } (same shape thenableThen uses for rejections) so guests can branch to a fallback.

Full dune test --force gate green: 257/257, zero regression.

Refs #103 #199 #205

🤖 Generated with Claude Code

Adds `pub extern fn httpPostJson(url, body_json) -> Thenable / Async`
to stdlib/Vscode.affine plus the canonical runtime impl in
packages/affine-vscode/mod.js, following the exact #205 thenable
convention (reg the response Thenable; guest observes via thenableThen
/ thenableResultJson, same as languageClientSendRequest).

Motivation: lets a VS Code extension reach a BoJ-server cartridge
endpoint (e.g. reposystem_run_audit on :7700) as a real in-process
request rather than shelling a CLI. Unblocks the BoJ-primary tier of
the rsr-certifier extension rewire (PR-5d-B).

Resolves/rejects settle as { __error } (same shape thenableThen uses
for rejections) so guests can branch to a fallback. Full dune gate
green (257/257), zero regression.

Refs #103 #199 #205

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath merged commit 464765e into main May 18, 2026
11 of 12 checks passed
@hyperpolymath hyperpolymath deleted the pr5db/http-post-json branch May 18, 2026 09:34
hyperpolymath added a commit that referenced this pull request May 18, 2026
…er (#213)

stdlib/Vscode.affine:307 declares
`withProgressNotification(title, work: fn(Unit) -> Thenable) -> Thenable / Async`,
but packages/affine-vscode/mod.js had no runtime impl — calling it from
the wasm/Node backend faulted (undefined extern). Surfaced by the first
#205 consumer (rsr-certifier extension rewire, standards#123), which had
to omit progress UI and document the gap.

Adds the impl following the established async-extern convention exactly:

  - `work` is the #199 closure (`fn(Unit) -> Thenable`); invoking it via
    wrapHandler returns the guest's Thenable *handle*, resolved through
    the shared handle table.
  - The overall progress Thenable is `reg`-ed so the guest observes
    completion with thenableThen / thenableResultJson, identical to
    httpPostJson (#210).
  - Failures settle as `{ __error }` — the same reject shape thenableThen
    / httpPostJson use, so guests branch to a fallback uniformly.
  - Graceful degradation: if the host has no `withProgress`
    (non-VS Code / test runner), the work still runs; only the progress
    chrome is skipped (mirrors httpPostJson's fetch-unavailable stance).

Pure adapter addition — no stdlib/compiler change (the extern was
already declared). Node syntax-checked; full dune gate green (257/257),
zero regression.

Closes #212
Refs #199 #205 #210 #211 ; consumer hyperpolymath/standards#123

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 44 issues detected

Severity Count
🔴 Critical 12
🟠 High 21
🟡 Medium 11

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stray AI.a2ml in root -- use 0-AI-MANIFEST.a2ml only",
    "type": "banned",
    "file": "AI.a2ml",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Superseded by 0-AI-MANIFEST.a2ml",
    "type": "banned",
    "file": "AI.djot",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/example/smoke_driver.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/cli.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/compile.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/runner.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

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