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(types): coreEvalEnv #8666

Merged
merged 3 commits into from
Dec 16, 2023
Merged

feat(types): coreEvalEnv #8666

merged 3 commits into from
Dec 16, 2023

Conversation

turadg
Copy link
Member

@turadg turadg commented Dec 15, 2023

closes: #8643

Description

Provides a typedef file that puts into global env what is available within a Core-Eval

Eslint still needs to have the globals declared. I looked into the eslint-env directive, but that appears not to be extensible and is going away in v9 anyway.

Security Considerations

n/a

Scaling Considerations

n/a

Documentation Considerations

Something to put into docs.agoric.com?

Testing Considerations

CI

Upgrade Considerations

n/a

@turadg turadg requested review from dckc and michaelfig December 15, 2023 19:24
@turadg turadg force-pushed the 8643-core-eval-types branch from 8ecd3a1 to 15528f5 Compare December 15, 2023 19:44
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

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

This looks really handy.

Of all my comments, Pick<Console, ...> is the one I suggest is worth making a change for.

re Upgrade Considerations: this becomes practically available for MN2 devs only once it's published to npm as part of our release process, right?

// endowments
var VatData: VatData;
var assert: Assert;
var console: Console;
Copy link
Member

Choose a reason for hiding this comment

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

these things do run on XSnap, so it seems like these should be included:

    Base64: globalThis.Base64, // Present only on XSnap
    URL: globalThis.URL, // Absent only on XSnap

Copy link
Member

Choose a reason for hiding this comment

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

ah. not URL

and leaving Base64 undocumented seems OK, I guess.

// endowments
var VatData: VatData;
var assert: Assert;
var console: Console;
Copy link
Member

@dckc dckc Dec 15, 2023

Choose a reason for hiding this comment

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

The implementation provides a ses VirtualConsole. Is this Console type identical?

Boy is that hard to tell.

To be conservative, maybe Pick<Console, 'debug' | 'log' | 'info' | 'warn' | 'error'> is best?
The rest are noops or reduce to these.


// endowments
var VatData: VatData;
var assert: Assert;
Copy link
Member

Choose a reason for hiding this comment

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

What does this Assert refer to? github finds such a type in @agoric/assert... which seems to be a copy of a type in endo. OK, whatever.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's getting the global one. I'll specify it's from ses

var VatData: VatData;
var assert: Assert;
var console: Console;
}
Copy link
Member

Choose a reason for hiding this comment

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

we're leaving allPowers.modules undocumented on purpose?

const modules = {
behaviors: { ...behaviors },
utils: { ...utils },
};

this comment got lost somehow

@dckc
Copy link
Member

dckc commented Dec 15, 2023

Documentation Considerations

Something to put into docs.agoric.com?

yes... near https://docs.agoric.com/guides/coreeval/proposal.html
perhaps by way of a typedoc link

tsc is complaining about redefinition. maybe a bug but this workaround is clean.
@turadg turadg force-pushed the 8643-core-eval-types branch from 15528f5 to 6bb6744 Compare December 15, 2023 21:33
@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Dec 15, 2023
@turadg
Copy link
Member Author

turadg commented Dec 15, 2023

this becomes practically available for MN2 devs only once it's published to npm as part of our release process, right?

Yep, it should be available as a dev once this merges to master

@turadg turadg force-pushed the 8643-core-eval-types branch from 6bb6744 to d17ce00 Compare December 16, 2023 15:30
@turadg turadg force-pushed the 8643-core-eval-types branch from d17ce00 to 3764eee Compare December 16, 2023 19:36
@turadg
Copy link
Member Author

turadg commented Dec 16, 2023

@dckc I had to amend the PR because in CI the file reference was looking for coreevalenv not coreEvalEnv. Maybe tsc forces lowercse. On my Mac it worked because the FS is set to case insensitive but it failed in CI. I looked into tsc options and this one seems like it would fix it, but its enabled by default: https://www.typescriptlang.org/tsconfig/#forceConsistentCasingInFileNames

What I did instead was change the filename to kebab case. Probably better anyway.

I tried moving it to the package root so it's not a deep import, but that messed ran into the difference between the eslint and tsconfigs so I backed off. I figure we revisit when we eliminate deep imports from packages.

@mergify mergify bot merged commit 1b6f03b into master Dec 16, 2023
67 checks passed
@mergify mergify bot deleted the 8643-core-eval-types branch December 16, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

way to core-eval environment for type checking
2 participants