Skip to content

fix: resolve multiple registry issues#2

Merged
muhammetselimfe merged 1 commit into
masterfrom
devin/1774656177-fix-registry-issues
Mar 28, 2026
Merged

fix: resolve multiple registry issues#2
muhammetselimfe merged 1 commit into
masterfrom
devin/1774656177-fix-registry-issues

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Mar 28, 2026

Description

Fixes multiple issues found during a code review of the registry:

Critical

  • Fix broken NPM package API: index.js was reading metadata.json but all chain data uses chain.jsonloadChain() and getAllChains() were always returning null/[]

Bug Fixes

  • Fix npm run validate: was pointing to ../L1Beat-backend/... (broken cross-repo ref); now uses a self-contained scripts/validate-all.js
  • Fix template categories: _TEMPLATE/chain.json used mixed-case (DeFi, Gaming) but CI enforces uppercase → changed to DEFI, GAMING
  • Fix enrichment idempotency: enrich-registry.js would overwrite manually-set empty logoUri on re-runs; now distinguishes undefined (never checked) from '' (checked, nothing found)
  • Upgrade publish.yml actions from v3 → v4 to match validate-pr.yml
  • Add generated files to .gitignore: enrichment-report.json, enrichment-errors.log, validation-report.md

Improvements

  • Deduplicate CI validation logic: The "Generate validation report" step in validate-pr.yml was re-running all URL/RPC checks (~100 lines of duplicated code). Now earlier steps save warnings to JSON files, and the report step reads those.
  • Add TypeScript type definitions (types.d.ts) for NPM package consumers
  • Add JSON Schema (chain.schema.json) as a formal data contract reference

Type of Change

  • Adding a new L1 chain
  • Updating existing L1 information
  • Fixing data errors
  • Documentation improvements
  • Other (please describe): Bug fixes for NPM API, CI pipeline, and DX improvements (types, schema, self-contained validation)

Chain Information

N/A — this PR modifies tooling/infrastructure, not chain data.

Checklist

  • I have read the CONTRIBUTING.md guide
  • JSON is properly formatted and valid
  • Information is accurate and up-to-date

Human Review Checklist

Items worth extra attention during review:

  • index.js change: Verify chain.json is the correct filename across all data/*/ folders (it is — metadata.json doesn't exist anywhere)
  • chain.schema.json: Uses additionalProperties: false — if new fields are ever added to chain.json without updating the schema, schema-based validation would reject them. The schema is currently a reference only (not enforced in CI), but worth knowing.
  • validate-all.js line 209: ${'='.join ? '=' : '━'.repeat(40)} is a quirky expression ('='.join is always undefined in JS, so it always falls through to '━'.repeat(40)). Works, but reads oddly.
  • enrich-registry.js idempotency: The condition !chain.nativeToken.logoUri && chain.nativeToken.logoUri !== '' relies on JS falsy semantics — undefined/null pass through, '' does not. Confirm this matches intended behavior.
  • CI workflow changes: The warning-file passing approach (url-warnings.json, etc.) degrades gracefully if a step is skipped (load_warnings catches FileNotFoundError), but this can only be fully validated by running the actual workflow.

Additional Notes

  • The validate-all.js script treats empty nativeToken fields and null evmChainId as warnings (not errors), matching CI behavior for existing chain data. ~100 chains have these pre-existing data gaps.
  • The JSON schema is published in the NPM package but not yet enforced in CI — it serves as documentation and can be adopted by consumers for IDE autocompletion.

Link to Devin session: https://app.devin.ai/sessions/06e9152c9b9f48c29c93dfa6ceb9c5f9
Requested by: @muhammetselimfe


Open with Devin

- Fix index.js: read chain.json instead of metadata.json (critical bug)
- Fix _TEMPLATE categories to use uppercase (DEFI, GAMING) matching CI rules
- Fix validate script to be self-contained (was pointing to sibling repo)
- Add validate-all.js for standalone local validation
- Upgrade publish.yml actions to v4 for consistency
- Add enrichment output files to .gitignore
- Deduplicate validation logic in validate-pr.yml CI workflow
- Add TypeScript type definitions (types.d.ts)
- Add JSON Schema for chain.json (chain.schema.json)
- Fix enrichment script idempotency for logoUri

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@muhammetselimfe muhammetselimfe merged commit 612c2da into master Mar 28, 2026
1 check failed
Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 3 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread index.js
Comment thread .github/workflows/validate-pr.yml
Comment thread data/_TEMPLATE/chain.json
muhammetselimfe added a commit that referenced this pull request Mar 29, 2026
- Fix stale metadata.json reference in error message (index.js)
- Save url-warnings.json before exit(1) so report step always has data
- Update CONTRIBUTING.md category examples to uppercase matching validators
- Remove dead code expression in validate-all.js

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant