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

Ensrainbow init #101

Merged
merged 15 commits into from
Jan 30, 2025
Merged

Ensrainbow init #101

merged 15 commits into from
Jan 30, 2025

Conversation

djstrong
Copy link
Contributor

@djstrong djstrong commented Jan 29, 2025

#84

@djstrong djstrong requested a review from a team as a code owner January 29, 2025 22:15
Copy link
Contributor

@shrugs shrugs left a comment

Choose a reason for hiding this comment

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

looks awesome

apps/ensrainbow/Dockerfile Outdated Show resolved Hide resolved
apps/ensrainbow/package.json Outdated Show resolved Hide resolved
apps/ensrainbow/package.json Outdated Show resolved Hide resolved
apps/ensrainbow/tsconfig.json Outdated Show resolved Hide resolved
.vscode/settings.json Show resolved Hide resolved
Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@djstrong Really amazing work here 🚀 😄 🙌 !! I've added some suggestions here, but all are pretty low priority and can be done in separate future PRs. Please feel welcome to merge this anytime!

apps/ensrainbow/README.md Outdated Show resolved Hide resolved
apps/ensrainbow/src/ingest.ts Outdated Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
apps/ensrainbow/README.md Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
@lightwalker-eth
Copy link
Member

@djstrong Ah I see the CI is complaining about ERR_PNPM_OUTDATED_LOCKFILE.

In this commit: 314f320 I see we made a change to apps/ensrainbow/package.json but there was no accompanying change to apps/ensrainbow/package-lock.json.

Easiest fix is to delete package-lock.json and then rebuild it automatically from package.json by running pnpm install from the overall monorepo root.

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

Sharing a few more suggestions. These are more lower priority ideas and suggest merging this PR in first before actioning these ideas. They can be done in one or more separate future PRs.

apps/ensrainbow/README.md Show resolved Hide resolved
apps/ensrainbow/README.md Outdated Show resolved Hide resolved
apps/ensrainbow/README.md Outdated Show resolved Hide resolved
apps/ensrainbow/README.md Outdated Show resolved Hide resolved
apps/ensrainbow/README.md Outdated Show resolved Hide resolved
apps/ensrainbow/README.md Show resolved Hide resolved
apps/ensrainbow/README.md Show resolved Hide resolved

- `PORT`: Server port (default: 3001)
- `DATA_DIR`: Directory for LevelDB data (default: './data')
- `NODE_ENV`: Node environment (default: 'production' in Docker)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `NODE_ENV`: Node environment (default: 'production' in Docker)
- `NODE_ENV`: Node.js environment (default: 'production' in Docker)

Since we're in "ENS Land" there's multiple interpretations for "Node", therefore suggesting the modification above.

Also, could you please include more info on what the purpose of this environment variable is? I understand it's something for Node.js, but is there a special reason we're mentioning it in our readme file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, it does nothing now, but we can use it e.g. to show more debug logs. I am removing it from the readme.

apps/ensrainbow/README.md Show resolved Hide resolved
apps/ensrainbow/README.md Show resolved Hide resolved
apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@djstrong Hey super updates! Nice work 🙌 Reviewed and shared feedback. Overall I suggest merging this PR and then following up on the comments in separate future PRs.

Thanks!

@@ -0,0 +1,12 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
Copy link
Member

Choose a reason for hiding this comment

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

@tk-o @shrugs Hey guys, I'm not an expert here. Just wanted to note that we have a vitest.config.ts in the ensrainbow app, but not in the ensnode app. However both are using vitest. Is there any action for us to take here?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is configuration required for generating test coverage reports. We don't have that on the ensnode app, but we have the test:coverage task defined in package.json for the ensrainbow app.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
apps/ensrainbow/README.md Outdated Show resolved Hide resolved
app.get('/health', (c: Context) => c.json({ status: 'ok' }));

// Get count of healable labels
app.get('/v1/labels/count', async (c: Context) => {
Copy link
Member

Choose a reason for hiding this comment

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

Created a separate low priority for us to enhance this in a separate future PR: #121

apps/ensrainbow/src/index.ts Outdated Show resolved Hide resolved
apps/ensrainbow/src/index.test.ts Outdated Show resolved Hide resolved
const response = await fetch('http://localhost:3002/v1/heal/');
expect(response.status).toBe(404); // Hono returns 404 for missing parameters
const text = await response.text();
expect(text).toBe('404 Not Found'); // Hono's default 404 response
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. Perhaps we should add some comment about thisinside the implementation of this API?

For example, I see this code in the implementation:

    if (!labelhash) {
        return c.json({ error: 'Missing labelhash parameter' }, 400);
    }

That suggested to me that Hono would return exactly that, but according to this test, it doesn't. Not sure if we can configure Hono to handle that differently or if we should just leave Hono the way it is but add some comments in the implementation identifying that the handler won't even be called by Hono if the param is missing.

Advice appreciated.

import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest';
import { app, db } from './index';
import { serve } from '@hono/node-server';

Copy link
Member

Choose a reason for hiding this comment

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

I created a low priority story with general ideas on the testing strategy here that we can follow up on later: #123

@tk-o
Copy link
Contributor

tk-o commented Jan 30, 2025

Please let's merge #116 before going live with this PR.

This PR fixes docker build by using optimised layers and building apps from directly monorepo root directory.
Also, automated code style fixes were applied on the existing codebase.

Co-authored-by: kwrobel.eth <[email protected]>
@tk-o tk-o merged commit 7d55966 into main Jan 30, 2025
4 checks passed
@tk-o tk-o deleted the ensrainbow-init branch January 30, 2025 21:28
@shrugs shrugs mentioned this pull request Jan 30, 2025
9 tasks
@djstrong djstrong mentioned this pull request Jan 30, 2025
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.

4 participants