Commit Graph
2 Commits
Author SHA1 Message Date
yetone 84ee9b88cc sap-aicore: the token deadline test fires the exchange's deadline once fetch is entered (#984)
"token deadline bounds fetch that ignores abort" rewrote every 15000ms
timer to 20ms. The credential read and the token exchange each arm their
own 15000ms deadline through bounded(), so the read's deadline was cut to
20ms too. When the read took longer than that on a loaded machine, it
timed out with the same "token acquisition timed out" message before
fetch was ever called, and `upstream.aborted` threw on undefined.

The test now keeps both timers at 15000ms, records each deadline's
callback, and fires the exchange's (the second) from inside the fake
fetch. It checks that two deadlines were armed and that fetch was entered
before it checks the abort. The source is unchanged: a separate 15s bound
on the read is intended.

Run (wsl-run, magpie-desktop, Bun 1.4.2, HOME=$(mktemp -d)):
- bun test packages/sap-aicore: 343 pass, 0 fail.
- bun scripts/check.mjs: exit 0.

Injected by hand:
- A 50ms wait at the start of readCredentials' operation. The old test
  failed with "TypeError: undefined is not an object (evaluating
  'upstream.aborted')" at 28ms, the issue's case. The new test passes
  with the same wait.
- The exchange run without bounded() (no deadline). The new test fails.

Not tried: the full root bun test run under load where it first failed.
2026-11-11 17:51:22 +08:00
caikn 0daf0c7421 sap-aicore 0.3.0: a new provider for SAP AI Core's GPT Responses and Claude Messages deployments (caikn, #651)
A new provider package, @magpie-community/opencode-sap-aicore-auth 0.3.0
(packages/sap-aicore). It signs in from a local SAP AI Core client-secret
credential file, discovers the account's running GPT (Responses) and Claude
(Messages, Bedrock) deployments per resource group, and sends requests only to
https://*.authentication.*.hana.ondemand.com (token) and
https://api.ai.*.hana.ondemand.com (inference). Image input is gated per model
on the catalog's inputTypes. Also: the root README row, a registry.json entry,
.DS_Store in .gitignore, and scripts/check.mjs accepts an empty static model
list for a package whose provider.models hook is a function with the same id
(npm and the loader are still required).

Reviewed at head b44b3e1b68889c2a12bcaa37ad5d546a398bdde0, with main 9bba5fed
merged in locally, on a Mac mini (macOS, Bun 1.4.2), no real SAP account:
- bun test packages/sap-aicore scripts: 351 pass, 0 fail.
- bun scripts/check.mjs: every package ok, sap-aicore included.
- The two tests that reached the network at e955194 now use inputs root()
  really rejects (/oauth, /v1), and a new test stubs fetch and checks that
  /oauth/token and /v2 are accepted and the token is posted to
  <authUrl>/oauth/token once. plugin.test.js fails on any unstubbed fetch.
- Whole package under a preload that records every non-loopback fetch, connect
  and DNS lookup: 0 attempts (the preload caught a deliberate fetch to
  example.invalid, so it does record).
- Broken by hand: putting the e955194 inputs back turns the test red through
  the new guard; making root() keep the given path turns the new
  /oauth/token + /v2 test red; letting root() accept any path turns 3 URL
  tests red.
- Not tried: a real SAP AI Core account (the author's run record covers one
  GPT and one Claude turn, plain and with a tool call; no image turn).

The first version goes out through the dist branch (npm doesn't have the name).
2026-11-04 22:19:43 +08:00