-
Notifications
You must be signed in to change notification settings - Fork 229
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
explicit exports of Zoe service and contract facet types #11075
Conversation
My impression is that anything that another package can import is part of the package API. Help me find the definition of semver you're working with? |
This looks like progress on some other related issues:
Perhaps some of those should be closed as dups / not planned at some point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skimmed each of the commits; the changes all look straightforward / rote with no runtime impact (except 1 possible case).
I'm not quite clear on the DX impact on getPublicFacet
; I should look into that more.
"atLeast": 76.28 | ||
"atLeast": 76.25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should I look for when reviewing changes in typeCoverage floor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally it goes up. It should never go down too much, per reviewer's judgement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a dashboard?
// For ZCF which is only available ambiently | ||
/// <reference types="@agoric/zoe/src/contractFacet/types-ambient" /> | ||
import type { ZCF } from '@agoric/zoe'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
/** @type {any} */ | ||
const electorateInstance = await E(zoe).getInstance(invitation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did getInstance
get hit by the same thing that affected getPublicFacet
?
* @param {V} value | ||
* @returns {MathHelpers<V>} | ||
*/ | ||
export const assertValueGetHelpers = value => | ||
// @ts-expect-error cast | ||
helpers[assertValueGetAssetKind(value)]; | ||
|
||
/** @type {(allegedBrand: Brand, brand?: Brand) => void} */ | ||
/** | ||
* @type {(allegedBrand: Brand<any>, brand?: Brand<any>) => void} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brand's type parameter is no longer optional? If I'm reading that right, that's an awfully big DX regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it still is but the default is AssetKind
, not any
. This change was needed only here. I didn't look deeply into why
@@ -31,9 +31,10 @@ export const BridgeId = /** @type {const} */ ({ | |||
}); | |||
harden(BridgeId); | |||
|
|||
/** @satisfies {Record<string, BridgeId>} */ | |||
export const CosmosInitKeyToBridgeId = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
harden this while we're here?
slippery slope, I suppose. This PR is already pretty big. And I think so far I haven't see any changes that have runtime impact.
// XXX runtime import of types | ||
import './internal-types.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how could this have runtime impact? it's a .ts file; don't we provide a companion .js
file that's empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. I should say "side-effect" import is more accurate.
packages/zoe/src/zoeService/types.ts
Outdated
bundleID: BundleID, | ||
bundleID: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like an unfortunate regression... or ... was BundleID
previously any
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed because the type couldn't resolve. But I think it wasn't serving much value. The property is named bundleId. The type was always string
.
Is there anything more specific about a BundIeID than string? Maybe b1${string}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the type couldn't resolve.
That's the sort of thing I had in mind when asking whether it was previously any
.
https://github.com/Agoric/agoric-sdk/blob/master/packages/SwingSet/src/types-external.js#L169 doesn't have any non-trivial JSDoc, but https://github.com/Agoric/agoric-sdk/blob/master/packages/SwingSet/docs/bundles.md#bundleids has a couple paragraphs of documentation.
I'm pretty sure there's a b0-
thing too, though the swingset docs seem to exclude it.
I think some sort of // XXX reconnect to BundleID type docs
marker is worthwhile. Not critical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b1-${string}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment was written before I saw Dan's. I was merely pointing out the dash in the pattern, not responding to the possibility of b0-
. I think b0-
is used in different places, but I'd check with @kriskowal to be sure.
Can we say this closes #8645? |
Deploying agoric-sdk with
|
Latest commit: |
2198f64
|
Status: | ✅ Deploy successful! |
Preview URL: | https://8b8891e0.agoric-sdk.pages.dev |
Branch Preview URL: | https://6343-unambient-zoe.agoric-sdk.pages.dev |
I don't think this touches that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#10811 is sufficiently important that this is worth landing even if it results in a few bumps in the road.
801823c
to
6b67182
Compare
"atLeast": 76.28 | ||
"atLeast": 76.25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a dashboard?
@@ -688,7 +689,7 @@ export {}; | |||
* | |||
* @param {ERef<ZoeService>} zoe | |||
* @param {import('@agoric/zoe/src/zoeService/utils.js').Instance<(zcf: ZCF<GovernanceTerms<{}>>) => {}>} allegedGoverned | |||
* @param {Instance} allegedGovernor | |||
* @param {Instance<(zcf) => {publicFacet: GovernorPublic}>} allegedGovernor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure the allegedGovernor (here and in AssertContractElectorate
) is an instance
. Doesn't this say it's a function? The first use in both funct is
const allegedGovernorPF = E(zoe).getPublicFacet(allegedGovernor);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also says it's an Instance. What I added is a contract start fn type parameter so downstream uses know what is the result of starting the instance
@@ -27,6 +27,7 @@ const assertContractGovernance = async ( | |||
await Promise.all([allegedGovernedTermsP, realGovernedP]); | |||
|
|||
assert( | |||
// @ts-expect-error XXX types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a theory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tech debt
@@ -232,6 +232,7 @@ type WellKnownContracts = { | |||
provisionPool: typeof import('@agoric/inter-protocol/src/provisionPool.js').start; | |||
priceAggregator: typeof import('@agoric/inter-protocol/src/price/fluxAggregatorContract.js').start; | |||
reserve: typeof import('@agoric/inter-protocol/src/reserve/assetReserve.js').start; | |||
reserveGovernor: typeof import('@agoric/governance/src/contractGovernor.js').start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant with contractGovernor
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no because this is another entry in the space. it just happens to have the same type as contractGovernor
packages/zoe/src/zoeService/types.ts
Outdated
bundleID: BundleID, | ||
bundleID: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b1-${string}
.
@@ -112,7 +113,8 @@ export const start = async (zcf, privateArgs, baggage) => { | |||
trace('makeStakeBldInvitation', give); | |||
const { holder } = await makeLocalAccountKit(); | |||
/** @type {Record<string, Payment<'nat'>>} */ | |||
// @ts-expect-error XXX PaymentPKeywordRecord throught deeplyFulfilled will be a PaymnentKeywordRecord | |||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- fails only through some build paths | |||
// @ts-ignore XXX PaymentPKeywordRecord throught deeplyFulfilled will be a PaymnentKeywordRecord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix the typos. This is really hard to read as is.
// @ts-ignore XXX PaymentPKeywordRecord throught deeplyFulfilled will be a PaymnentKeywordRecord | |
// @ts-ignore XXX PaymentPKeywordRecord, though after deeplyFulfilled it will be a PaymentKeywordRecord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I have to do another push I'll include this
b1-${string}
Good suggestion. I did try that and a bunch of places have full wide string
or use a different literal like id
(in a test). So out of scope
Is there a dashboard?
nope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do these numbers come from? What do they get compared to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try git grep typeCoverage
6b67182
to
2198f64
Compare
This pull request has been removed from the queue for the following reason: The pull request #11075 has been manually updated You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
@mergify requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
refs: #6343
refs: #10811
Description
While working to move Fast USDC (#10811) I kept running into problems with types resolving. I started working on the tech debt of #6343 and slipped down that rabbit hole.
This makes the ambient type declarations of ZoeService and ZCF modules into explicit exports and updates a ton of code to cope. Review by commit!
Some collateral improvements along the way:
Security Considerations
none
Scaling Considerations
none
Documentation Considerations
I don't think we have docs on type imports
Testing Considerations
CI
Upgrade Considerations
This will break modules importing the
types-ambient.js
files that are gone. Those were deep imports so not part of the package semver.