-
Notifications
You must be signed in to change notification settings - Fork 3
feat(ponder-metadata): make package generic again #551
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 8277b77 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
8ddee99
to
033b2a1
Compare
deps: PonderMetadata.MetadataMiddlewareResponse["deps"] & { | ||
ensRainbow: EnsRainbow.VersionInfo; | ||
}; |
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.
We declare application-level type to specify a generic type coming from the ponder-metadata
package.
if (typeof response.deps.ensRainbow === "undefined") { | ||
throw new Error(`ENSRainbow version not found in the response.`); | ||
} |
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.
Including response validation to detect if ENSRainbow version info is available. If it's not, ENSAdmin would refuse to connect.
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.
@tk-o This isn't a full validation of the data model. I expected we would completely verify each field and value.
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.
Logged with #571
033b2a1
to
b4b426d
Compare
Abstract ENSRainbow version away from the package into the app layer.
b4b426d
to
8277b77
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.
@tk-o Thanks for updates. Reviewed and shared feedback 👍
"ensadmin": minor | ||
--- | ||
|
||
Generalize `ponder-metadata` package and let ENSAdmin to ensure ENSRainbow version info is available. |
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.
Generalize `ponder-metadata` package and let ENSAdmin to ensure ENSRainbow version info is available. | |
Generalize `ponder-metadata` package. Add rules to ENSAdmin to ensure ENSRainbow version info is available. |
if (typeof response.deps.ensRainbow === "undefined") { | ||
throw new Error(`ENSRainbow version not found in the response.`); | ||
} |
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.
@tk-o This isn't a full validation of the data model. I expected we would completely verify each field and value.
try { | ||
const versionResponse = await client.version(); | ||
|
||
return { |
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.
Flagging how several lines below this we can potentially return junk values if an error is thrown. This doesn't seem right. If we can't query the ENSRainbow version for some reason then it seems we should handle that in a smarter way that helps to build up our state invariants.
State invariants are CRITICAL for us. We need to focus on them much more.
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've started working on list of invariants. More details here:
@@ -23,6 +22,9 @@ interface PonderMetadataModule { | |||
version: string; | |||
}; | |||
|
|||
/** Application dependencies info */ | |||
DepsInfo: Record<string, unknown>; |
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.
Really don't like type definitions like this that use unknown
.
I assume a type definition like this is very temporary until we split our /metadata
endpoint into separate APIs for /indexing-status
and /config
?
/config
should not be generalized for any Ponder app. It should be 100% specific to ENSIndexer.
Likewise, the ponder-metadata
package maybe should be renamed such that it is only for supporting the /indexing-status
API.
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 we assume ponder-metadata
only deals with indexing status, then we can delegate the config type definition to ENSIndexer app, so ponder-metadata
knows nothing about it and only passes-through the data (& its application-defined type).
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.
Thanks for feedback, @lightwalker-eth 🤝 I'll park this PR until #571 is done.
if (typeof response.deps.ensRainbow === "undefined") { | ||
throw new Error(`ENSRainbow version not found in the response.`); | ||
} |
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.
Logged with #571
try { | ||
const versionResponse = await client.version(); | ||
|
||
return { |
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've started working on list of invariants. More details here:
@@ -23,6 +22,9 @@ interface PonderMetadataModule { | |||
version: string; | |||
}; | |||
|
|||
/** Application dependencies info */ | |||
DepsInfo: Record<string, unknown>; |
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 we assume ponder-metadata
only deals with indexing status, then we can delegate the config type definition to ENSIndexer app, so ponder-metadata
knows nothing about it and only passes-through the data (& its application-defined type).
This PR abstracts fetching ENSRainbow version away from the
ponder-metadata
package and moves it into the ENSIndexer application layer.Preview
Resolves:
ponder-metadata
package #521