Skip to content

refactor(store): streamline store initialization and manifest handling#76

Merged
luxass merged 8 commits intomainfrom
improve-store
Jun 25, 2025
Merged

refactor(store): streamline store initialization and manifest handling#76
luxass merged 8 commits intomainfrom
improve-store

Conversation

@luxass
Copy link
Copy Markdown
Member

@luxass luxass commented Jun 25, 2025

Summary by CodeRabbit

  • Chores

    • Updated deployment workflows to use a new working directory for preview and API deployments.
    • Added a changeset for minor version updates to packages.
    • Improved TypeScript configuration and path aliases for easier imports.
  • Refactor

    • Enhanced store initialization and manifest handling for improved clarity and default management.
    • Updated internal logic to use new constants and default values.
  • Style

    • Minor code style adjustments for clarity in HTTP file system bridge.
  • Tests

    • Updated tests to use new constants for improved consistency.

luxass added 2 commits June 24, 2025 20:38
* Consolidate local and remote store initialization logic.
* Introduce `getManifestPath` method to determine the appropriate manifest path based on store mode.
* Update `createRemoteUCDStore` to use the correct file system bridge for HTTP.
* Changed the default base URL in `HTTPFileSystemBridge` to align with the UCD Store's proxy URL.
* Removed unnecessary debug log for remote store initialization.
* Updated the manifest path for remote stores to use `.ucd-store.json`.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 25, 2025

🦋 Changeset detected

Latest commit: 3640c64

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@ucdjs/ucd-store Minor
@ucdjs/utils Minor
@ucdjs/cli Patch

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 25, 2025

Warning

Rate limit exceeded

@luxass has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b9c3b2b and 3640c64.

📒 Files selected for processing (8)
  • .changeset/slow-tips-drop.md (1 hunks)
  • .github/workflows/deploy-preview.yaml (1 hunks)
  • .github/workflows/deploy.yaml (1 hunks)
  • packages/ucd-store/package.json (1 hunks)
  • packages/ucd-store/src/store.ts (5 hunks)
  • packages/ucd-store/test/store.test.ts (2 hunks)
  • packages/utils/src/fs-bridge/http.ts (3 hunks)
  • tooling/tsconfig/base.json (1 hunks)

Walkthrough

This set of changes refactors the UCD Store package and its related infrastructure. It updates workflow deployment directories, improves TypeScript configuration handling, enhances store initialization and manifest logic, introduces new constants, and adjusts imports to use these constants. The HTTP file system bridge now uses a default base URL.

Changes

File(s) Change Summary
.changeset/slow-tips-drop.md Added a changeset for minor updates to @ucdjs/ucd-store and @ucdjs/utils ("improve store").
.github/workflows/deploy-preview.yaml, .github/workflows/deploy.yaml Changed Cloudflare Wrangler action working directory from root to ./apps/api.
packages/ucd-store/package.json Updated playground scripts to explicitly specify tsconfig.json.
packages/ucd-store/src/store.ts Refactored store initialization, manifest logic, and constants usage; improved remote store bridge.
packages/ucd-store/test/store.test.ts Updated tests to use new constants from @ucdjs/utils/constants.
packages/utils/src/fs-bridge/http.ts Introduced DEFAULT_BASE_URL and refactored to use it for HTTP file system bridge.
tooling/tsconfig/base.json Added path alias for @ucdjs/utils/constants.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UCDStore
    participant FSBridge
    participant Constants

    User->>UCDStore: new UCDStore(options)
    UCDStore->>Constants: Import UNICODE_API_BASE_URL, UNICODE_PROXY_URL
    UCDStore->>FSBridge: Initialize with baseUrl/proxyUrl
    UCDStore->>UCDStore: initialize()
    UCDStore->>UCDStore: getManifestPath()
    UCDStore->>FSBridge: exists(manifestPath)
    alt Store exists
        UCDStore->>UCDStore: loadVersionsFromStore()
    else Store does not exist (local)
        UCDStore->>UCDStore: createStoreManifest()
    else Store does not exist (remote)
        UCDStore->>UCDStore: load versions from metadata
    end
Loading

Possibly related PRs

  • ucdjs/ucd#75: Introduced and exported the constants now used for store initialization and configuration.
  • ucdjs/ucd#20: Added the initial ucd-store package, which is directly refactored and enhanced in this PR.
  • ucdjs/ucd#35: Refactored the CLI to use the ucd-store package, which relies on the now-refactored store implementation.

Poem

A hop, a skip, a store refined,
With constants new and paths aligned.
Manifest magic, configs in tow,
Remote or local, the changes flow.
TypeScript’s map, deployments neat—
This bunny’s code is hard to beat! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

luxass added 3 commits June 25, 2025 19:05
* Refactored `UCDStore` to utilize `UNICODE_API_BASE_URL` and `UNICODE_PROXY_URL` from constants.
* Updated tests to reflect changes in default URL expectations.
* Added path mapping for constants in TypeScript configuration.
@luxass luxass marked this pull request as ready for review June 25, 2025 19:49
@luxass luxass requested a review from Copilot June 25, 2025 19:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the store initialization and manifest handling to streamline configuration and error management. Key changes include adding a new constants mapping in the tsconfig file, updating file system bridge URL handling and default constants usage, and refactoring store initialization logic for local and remote modes.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tooling/tsconfig/base.json Adds a new mapping for the constants module to support updated default values.
packages/utils/src/fs-bridge/http.ts Introduces a DEFAULT_BASE_URL constant and aligns URL creation with the new constant usage.
packages/ucd-store/test/store.test.ts Updates tests to verify store URLs using the new UNICODE_API_BASE_URL and UNICODE_PROXY_URLs.
packages/ucd-store/src/store.ts Refactors store initialization, manifest handling, and remote store FSBridge import logic.
packages/ucd-store/package.json Updates playground commands with tsconfig reference for better configuration consistency.
Comments suppressed due to low confidence (1)

packages/utils/src/fs-bridge/http.ts:4

  • [nitpick] If alignment with the UCD Store's default base URL constants is intended, update this comment to clarify the plan and consider using the same constant for consistency across modules.
// MAYBE align this with the UCD Store's default base URL constants?

Comment on lines +353 to +356
? fs({
baseUrl: options.baseUrl || UNICODE_PROXY_URL,
})
: fs,
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider defining an explicit type for the FileSystemBridge factory function to improve clarity and maintainability of the conditional initialization.

Suggested change
? fs({
baseUrl: options.baseUrl || UNICODE_PROXY_URL,
})
: fs,
? (fs as FileSystemBridgeFactory)({
baseUrl: options.baseUrl || UNICODE_PROXY_URL,
})
: (fs as FileSystemBridge),

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 65.78947% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/ucd-store/src/store.ts 56.66% 12 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

* Changed `workingDirectory` from `.` to `./apps/api` for both preview and production workflows.
* Ensures the correct directory is used for deployment.
@luxass luxass merged commit fdc54c1 into main Jun 25, 2025
5 checks passed
@luxass luxass deleted the improve-store branch June 25, 2025 19:53
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.

2 participants