Skip to content

feat: support loading config from explicit path#78

Open
chenjiahan wants to merge 3 commits into
mainfrom
chenjiahan/feat-load-explicit-config-path
Open

feat: support loading config from explicit path#78
chenjiahan wants to merge 3 commits into
mainfrom
chenjiahan/feat-load-explicit-config-path

Conversation

@chenjiahan

@chenjiahan chenjiahan commented Jul 26, 2026

Copy link
Copy Markdown
Member

Summary

Rstack config consumers need to load a known rstack.config.* file without relying on CLI-global state. This PR adds a configFilePath option to loadRstackConfig, resolves explicit relative paths from the current working directory, and preserves the existing CLI-state and default-discovery fallbacks. It also covers explicit-path precedence, dependency reporting, missing files, and state cleanup.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 26, 2026

Copy link
Copy Markdown

Deploying rstack-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 61f31bd
Status: ✅  Deploy successful!
Preview URL: https://32a9c880.rstack-cli.pages.dev
Branch Preview URL: https://chenjiahan-feat-load-explici.rstack-cli.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@chenjiahan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e663c1d0-907c-4764-b37f-d0765442a8fc

📥 Commits

Reviewing files that changed from the base of the PR and between f83b47e and 61f31bd.

📒 Files selected for processing (5)
  • packages/rstack/src/config.ts
  • packages/rstack/tests/config/load-config/explicit-dependency.ts
  • packages/rstack/tests/config/load-config/explicit.config.ts
  • packages/rstack/tests/config/load-config/index.test.ts
  • packages/rstack/tests/config/load-config/rstack.config.ts
📝 Walkthrough

Walkthrough

loadRstackConfig now accepts an optional config file path and fresh flag, resolves explicit paths, and forwards freshness behavior to loadConfig. New test configurations and cases verify explicit loading, dependency collection, absolute-path errors, state isolation, and differing cached versus fresh loads. Shared cleanup resets config state and the fresh-load counter after each test.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main change: loading config from an explicit path.
Description check ✅ Passed The description matches the changeset and summarizes the new config loading behavior and tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chenjiahan/feat-load-explicit-config-path

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/rstack/src/config.ts`:
- Around line 29-32: The documentation comment for configFilePath should
describe the actual fallback precedence: when the option is omitted, use the
CLI-provided state.configPath first, and perform default config-file discovery
only when that state path is unset. Update the wording near configFilePath
without changing implementation behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ddd99ad-9c1d-46fb-be19-d0f8a14022ba

📥 Commits

Reviewing files that changed from the base of the PR and between bf15b96 and f83b47e.

📒 Files selected for processing (5)
  • packages/rstack/src/config.ts
  • packages/rstack/tests/config/load-state/explicit-dependency.ts
  • packages/rstack/tests/config/load-state/explicit.config.ts
  • packages/rstack/tests/config/load-state/fresh.config.ts
  • packages/rstack/tests/config/load-state/index.test.ts

Comment thread packages/rstack/src/config.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f83b47e3da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/rstack/src/config.ts Outdated
fresh: true,
...(state.configPath !== undefined
? { path: state.configPath }
fresh,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve configs when cache reuse is requested

When the same file is loaded more than once with fresh: false, the native loader reuses the already evaluated module, so its define.* calls do not run again. Because loadRstackConfig clears state.configs before every load and again in finally, the second call returns an empty configs object rather than the cached configuration. This makes repeated calls—the primary scenario for disabling cache bypass—incorrect; either cache the collected configs alongside the module or avoid exposing fresh: false for this side-effect-based loader.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dad79428e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +121 to +123
export const loadRstackConfig = async ({
configFilePath,
}: LoadRstackConfigOptions = {}): Promise<LoadedRstackConfig> => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expose the explicit-path loader

Published consumers cannot use this option: packages/rstack/src/index.ts exports only define and runCLI, the package export map has no ./config entry, and no production caller invokes loadRstackConfig with configFilePath. Consequently, the new explicit-path behavior is reachable only from source-level tests and adds no usable package capability; export a supported loader API or wire the option into an existing public consumer.

Useful? React with 👍 / 👎.

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