-
Notifications
You must be signed in to change notification settings - Fork 208
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 type exports for agoric/notifier #9305
Conversation
Deploying agoric-sdk with Cloudflare Pages
|
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 don't see any critical problems, but I'm not confident about approving yet; I'd like to hear more about these comments...
import { | ||
EachTopic as _EachTopic, |
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.
somewhere I saw a good explanation of why these gymnastics are used, including a stackoverflow reference; is it convenient to add a pointer from 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.
I resisted coping it an Nth time. I'll write up some docs in Markdown and have the modules reference it
"prepack": "echo \"export {}; \" | cat - src/types-ambient.js > src/types.js && tsc --build tsconfig.build.json", | ||
"prepack": "tsc --build tsconfig.build.json", |
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 riddance
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 is the PR's raison d'être
@@ -1,5 +1,7 @@ | |||
// @jessie-check | |||
|
|||
import '@agoric/internal/exported.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.
is it worth an XXX or something on these? or UNTIL #6512 ?
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.
there are tons of these but I tried to comment a bunch of them
@@ -26,3 +28,6 @@ export { | |||
} from './asyncIterableAdaptor.js'; | |||
export * from './storesub.js'; | |||
export * from './stored-notifier.js'; | |||
|
|||
// eslint-disable-next-line import/export -- doesn't know types | |||
export * from './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.
so this is a solution to the question of re-exporting?
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 is the right way to export at the top level. unfortunately it doesn't work for @agoric/ertp
because it has AssetKind
as both a type and kind
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.
interesting.
considers an issue to change the name of the type to AssetKindT
/** | ||
* @import {ERef} from '@endo/far'; | ||
* @import {BaseNotifier, Notifier, StoredFacet} from './types.js'; | ||
* @import {Marshaller, StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.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.
having StorageNode
in @agoric/internal
looks more and more awkward.
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.
yeah. and @agoric/notifier depending on ChainStorage.
"description": "Notifier allows services to update clients about state changes using a stream of promises",
@@ -97,7 +103,7 @@ export const makeStoredSubscription = ( | |||
serializeBodyFormat: 'smallcaps', | |||
}), | |||
) => { | |||
/** @type {Unserializer} */ | |||
/** @type {import('@agoric/internal/src/lib-chainStorage.js').Unserializer} */ |
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 @import
on line 13 didn't work?
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 extra chars. fixed
|
||
/** | ||
* @import {ERef} from '@endo/far'; | ||
* @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/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.
These long lists make me wonder about qualified imports.
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.
yeah. .ts
and its tooling makes the long list easy to work with but for JSDoc we might be better off with a name per module
import '../src/types-ambient.js'; | ||
import '../src/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.
I'm surprised that this works. types.js
is now a module, so types defined there are not ambient, right?
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's a noop but I'll remove it
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.
ok, none of my questions turned up answers that I'm not comfortable with.
53f5b00
to
20b9c5e
Compare
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.
looks good.
Review by commit gives me reasonable confidence that conflicts with release branches should be manageable.
* WaitUntilQuiescent, | ||
* XSnap, | ||
* } from './types-external.js') | ||
* @import { Bundle, BundleCap, BundleFormat, BundleID, BundleRef, BundleSpec, DeviceInvocation, DeviceInvocationResult, DeviceInvocationResultError, DeviceInvocationResultOk, EndoZipBase64Bundle, GetExportBundle, KernelDeliveryBringOutYourDead, KernelDeliveryChangeVatOptions, KernelDeliveryDropExports, KernelDeliveryMessage, KernelDeliveryNotify, KernelDeliveryObject, KernelDeliveryOneNotify, KernelDeliveryRetireExports, KernelDeliveryRetireImports, KernelDeliveryStartVat, KernelKeeper, KernelOneResolution, KernelOptions, KernelSlog, KernelSyscallDropImports, KernelSyscallExit, KernelSyscallInvoke, KernelSyscallObject, KernelSyscallResolve, KernelSyscallResult, KernelSyscallResultError, KernelSyscallResultOk, KernelSyscallRetireExports, KernelSyscallRetireImports, KernelSyscallSend, KernelSyscallSubscribe, KernelSyscallVatstoreDelete, KernelSyscallVatstoreGet, KernelSyscallVatstoreGetNextKey, KernelSyscallVatstoreSet, ManagerType, Message, MeteringVatPowers, NestedEvaluateBundle, PolicyInput, PolicyInputCrankComplete, PolicyInputCrankFailed, PolicyInputCreateVat, PolicyInputNone, PolicyOutput, ResolutionPolicy, RunPolicy, SlogFinishDelivery, SlogFinishSyscall, SnapshotResult, SnapStore, SourceOfBundle, SourceSpec, StaticVatPowers, SwingSetCapData, SwingSetConfig, SwingSetConfigDescriptor, SwingSetConfigProperties, SwingSetKernelConfig, TerminationVatPowers, VatAdminSvc, VatKeeper, VatPowers, VatSlog, VatStats, WaitUntilQuiescent, XSnap, } from './types-external.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.
does this work?
IME, @import
makes this act like a module and hence not produce ambient types.
But I guess it was that way before this PR.
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 don't know all the cases yet but in this one the ambient work, maybe because swingset-vats
never builds .d.ts
.
When I get it to build types-ambient.d.ts
it's empty:
//# sourceMappingURL=types-ambient.d.ts.map
* @param {Remote<ProtocolImpl>} opts.protocolImpl | ||
* @param {import('@agoric/vow').Remote<ProtocolImpl>} opts.protocolImpl |
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.
importing Remote
once didn't work?
cac8216
to
ff95b42
Compare
ff95b42
to
001d8e4
Compare
refs: #9305 ## Description While working on #9305 I was slowed down by the `types.js` files that were really ambients. This makes all `types.js` that aren't modules into `types-ambient.js`. The ambients for `zoe/tools` I ditched by making them explicit exports, to continue supporting that part of the package API that the `prepack` rename was doing. ### Security Considerations <!-- Does this change introduce new assumptions or dependencies that, if violated, could introduce security vulnerabilities? How does this PR change the boundaries between mutually-suspicious components? What new authorities are introduced by this change, perhaps by new API calls? --> ### Scaling Considerations <!-- Does this change require or encourage significant increase in consumption of CPU cycles, RAM, on-chain storage, message exchanges, or other scarce resources? If so, can that be prevented or mitigated? --> ### Documentation Considerations <!-- Give our docs folks some hints about what needs to be described to downstream users. Backwards compatibility: what happens to existing data or deployments when this code is shipped? Do we need to instruct users to do something to upgrade their saved data? If there is no upgrade path possible, how bad will that be for users? --> ### Testing Considerations <!-- Every PR should of course come with tests of its own functionality. What additional tests are still needed beyond those unit tests? How does this affect CI, other test automation, or the testnet? --> ### Upgrade Considerations <!-- What aspects of this PR are relevant to upgrading live production systems, and how should they be addressed? -->
refs: #6512
Description
Progress on #6512, spawned from #9300.
This gives the @agoric/notifier package explicit exports.
Many downstream packages were relying on @agoric/notifier ambients for types from @agoric/internal or Endo, so this also adds an
exported.js
to @agoric/internal to provide those. (E.g.ERef
).Security Considerations
none, types
Scaling Considerations
none, types
Documentation Considerations
might improve API docs of Notifier package
Testing Considerations
CI
Upgrade Considerations
none, types