Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rewrite to run on plv8 and add support for pg_tle #3

Merged
merged 10 commits into from
Jun 2, 2024
Merged

Conversation

mhmd-azeez
Copy link
Collaborator

@mhmd-azeez mhmd-azeez commented Mar 24, 2024

  • make sure the api matchs js-sdk as much as possible. CurrentPlugin's functions don't match currently
  • WASI
  • tests
  • Better readme
  • CI

@mhmd-azeez mhmd-azeez marked this pull request as ready for review June 2, 2024 14:24
@mhmd-azeez
Copy link
Collaborator Author

i updated the readme a bit, but still not very happy with it. however, I am going to merge the PR and come back to it later on. One thing that doesn't work is Haskell plugins:

PS D:\dylibso\pg_extism> npm run test

> @extism/extism-plv8@1.0.0-rc1 test
> cross-env NODE_OPTIONS='--experimental-wasi-unstable-preview1' jest --coverage --config jest.config.js

  console.debug
    Haskell (reactor) runtime detected.

      at debug (src/index.ts:631:11)

  console.log
    newBoundTask: RTS is not initialised; call hs_init() first

      at log (src/index.ts:423:17)

  console.log


      at log (src/index.ts:423:17)

 FAIL  tests/index.test.ts
  test extism
    √ fails on hash mismatch (32 ms)
    √ can create and call a plugin (8 ms)
    √ can detect if function exists or not (4 ms)
    √ errors when function is not known (8 ms)
    √ plugin can allocate memory (268 ms)
    √ plugin can fail gracefuly (4 ms)
    √ host functions works (7 ms)
    √ can deny http requests (10 ms)
    × can initialize haskell runtime (60 ms)

  ● test extism › can initialize haskell runtime

    proc_exit: 1

      489 |       },
      490 |       proc_exit(rval: number): void {
    > 491 |         throw new Error(`proc_exit: ${rval}`);
          |               ^
      492 |       },
      493 |       clock_time_get(id: number, precision: bigint, time: number): number {
      494 |         const buffer = new DataView(memory().buffer);

      at proc_exit (src/index.ts:491:15)
      at __wasi_proc_exit (wasm:/wasm/00459472:1:27082)
      at _Exit (wasm:/wasm/00459472:1:45622)
      at exit (wasm:/wasm/00459472:1:90271)
      at stg_exit (wasm:/wasm/00459472:1:695506)
      at newBoundTask (wasm:/wasm/00459472:1:82416)
      at rts_lock (wasm:/wasm/00459472:1:572802)
      at testing (wasm:/wasm/00459472:1:790932)
      at Plugin.func [as callRaw] (src/index.ts:101:5)
      at Plugin.callRaw [as call] (src/index.ts:107:25)
      at Object.<anonymous> (tests/index.test.ts:124:35)

----------|---------|----------|---------|---------|--------------------------------------------------------------------------------------------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|--------------------------------------------------------------------------------------------------------
All files |   64.28 |    48.61 |   59.09 |   64.72 |
 index.ts |   64.28 |    48.61 |   59.09 |   64.72 | ...399,430-488,494-525,533,539-550,561,586,588-592,598,627,647,650,655-657,669,707-732,775,796,814,824
----------|---------|----------|---------|---------|--------------------------------------------------------------------------------------------------------
Test Suites: 1 failed, 1 total
Tests:       1 failed, 8 passed, 9 total
Snapshots:   0 total
Time:        1.681 s, estimated 2 s
Ran all test suites.

I will open a new issue for it

@mhmd-azeez mhmd-azeez merged commit 598d257 into main Jun 2, 2024
3 checks passed
@mhmd-azeez mhmd-azeez deleted the pg_tle branch June 2, 2024 14:25
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