Skip to content

feat: add local-db manifest URL command#2553

Merged
graphite-app[bot] merged 1 commit into
mainfrom
local-db-manifest-urls
May 26, 2026
Merged

feat: add local-db manifest URL command#2553
graphite-app[bot] merged 1 commit into
mainfrom
local-db-manifest-urls

Conversation

@findolor
Copy link
Copy Markdown
Collaborator

@findolor findolor commented Apr 20, 2026

Chained PRs

Motivation

rain.local-db.remote currently fetches a settings YAML file and parses local-db-remotes in shell to discover manifest URLs. That duplicates settings parsing logic outside Rust and can drift from the CLI/parser behavior.

Solution

Add a local-db manifest-urls CLI command that prints local DB remote manifest URLs from settings YAML:

raindex_cli local-db manifest-urls --settings-yaml "$settings_yaml"
  • Parse settings through RaindexYaml, so normal settings requirements such as version and local-db-remotes validation apply.
  • Print only manifest URLs to stdout, one URL per line, sorted by remote key for deterministic script output.
  • Keep diagnostics/errors on stderr through the existing CLI error path.
  • Reject duplicate local-db-remotes URL values in the core settings parser, so all settings consumers share the same uniqueness rule.
  • Add focused parser and CLI tests for single URL output, duplicate URL rejection, no-remotes output, missing version failure, and exact stdout formatting.

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Verified locally:

  • nix develop -c cargo fmt --all
  • nix develop -c cargo test -p raindex_app_settings local_db_remotes
  • nix develop -c cargo test -p raindex_cli manifest_urls
  • nix develop -c cargo test -p raindex_cli verify_cli
  • nix develop -c rainix-rs-static

Summary by CodeRabbit

  • New Features

    • Added a CLI subcommand to list resolved manifest URLs from local-DB remotes configuration.
  • Improvements

    • Enhanced validation to detect and report duplicate remote URLs with clearer error messages.
  • Tests

    • Added unit tests covering URL listing, duplicate-URL errors, missing version handling, and empty/multiple-remote behaviors.

Review Change Stack

@findolor findolor self-assigned this Apr 20, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d20c4d6c-7969-400d-96eb-00ebad0559c5

📥 Commits

Reviewing files that changed from the base of the PR and between 3f8691a and 7e32a38.

📒 Files selected for processing (3)
  • crates/cli/src/commands/local_db/manifest_urls.rs
  • crates/cli/src/commands/local_db/mod.rs
  • crates/settings/src/local_db_remotes.rs

📝 Walkthrough

Walkthrough

Adds a ManifestUrls CLI command that parses local-DB remotes settings and prints each resolved manifest URL line-by-line, enhances YAML parsing to error on duplicate remote URLs, and wires the command into the local-db CLI dispatcher.

Changes

ManifestUrls CLI Command with URL Validation

Layer / File(s) Summary
URL Deduplication Validation
crates/settings/src/local_db_remotes.rs
LocalDbRemoteCfg::parse_all_from_yaml adds remote_keys_by_url to track URLs and returns YamlError::Field (InvalidValue) when a URL is reused; includes a unit test asserting error shape and location.
ManifestUrls CLI Command and URL Extraction
crates/cli/src/commands/local_db/manifest_urls.rs
Adds ManifestUrls CLI command (settings_yaml: String), manifest_urls_from_settings() that parses settings with RaindexYaml (local_db_remotes enabled), deduplicates via BTreeMap, returns Vec<Url>, and writes each URL one-per-line. Unit tests cover single/multiple/empty remotes and parsing failures.
CLI Dispatcher Wiring
crates/cli/src/commands/local_db/mod.rs
Exports manifest_urls submodule, adds ManifestUrls variant to LocalDbCommands, and updates LocalDbCommands::execute to dispatch manifest-urls to ManifestUrls::execute() (non-async).

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 A manifest of URLs, so clean and bright,
No duplicates lurking, each one unique and right,
Line by line they print, a delight to behold,
The rabbit's small command makes settings unfold! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a new CLI command for local-db manifest URLs.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch local-db-manifest-urls

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 and usage tips.

@findolor findolor force-pushed the local-db-manifest-urls branch from 9b33a3c to 6ffe9ad Compare May 23, 2026 13:13
Copy link
Copy Markdown
Collaborator Author

findolor commented May 23, 2026


How to use the Graphite Merge Queue

Add the label Raindex-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented May 26, 2026

Merge activity

  • May 26, 6:13 AM UTC: findolor added this pull request to the Graphite merge queue.
  • May 26, 6:40 AM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'standard-tests (ubuntu-latest, rainix-sol-test)').
  • May 26, 7:40 AM UTC: findolor added this pull request to the Graphite merge queue.
  • May 26, 7:41 AM UTC: Merged by the Graphite merge queue.

## Chained PRs

- #2526

## Motivation

`rain.local-db.remote` currently fetches a settings YAML file and parses `local-db-remotes` in shell to discover manifest URLs. That duplicates settings parsing logic outside Rust and can drift from the CLI/parser behavior.

## Solution

Add a `local-db manifest-urls` CLI command that prints local DB remote manifest URLs from settings YAML:

```sh
raindex_cli local-db manifest-urls --settings-yaml "$settings_yaml"
```

- Parse settings through `RaindexYaml`, so normal settings requirements such as `version` and `local-db-remotes` validation apply.
- Print only manifest URLs to stdout, one URL per line, sorted by remote key for deterministic script output.
- Keep diagnostics/errors on stderr through the existing CLI error path.
- Reject duplicate `local-db-remotes` URL values in the core settings parser, so all settings consumers share the same uniqueness rule.
- Add focused parser and CLI tests for single URL output, duplicate URL rejection, no-remotes output, missing version failure, and exact stdout formatting.

## Checks

By submitting this for review, I'm confirming I've done the following:

- [x] made this PR as small as possible
- [x] unit-tested any new functionality
- [ ] linked any relevant issues or PRs
- [ ] included screenshots (if this involves a front-end change)

Verified locally:

- `nix develop -c cargo fmt --all`
- `nix develop -c cargo test -p raindex_app_settings local_db_remotes`
- `nix develop -c cargo test -p raindex_cli manifest_urls`
- `nix develop -c cargo test -p raindex_cli verify_cli`
- `nix develop -c rainix-rs-static`

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

## Release Notes

* **New Features**
  * Added `manifest-urls` CLI subcommand to list manifest URLs from local-DB remotes configuration.
  * Improved validation to detect duplicate URLs in remotes settings with detailed error reporting.

<!-- review_stack_entry_start -->

[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/rainlanguage/raindex/pull/2553?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app Bot force-pushed the local-db-manifest-urls branch from 3f8691a to 7e32a38 Compare May 26, 2026 06:13
@graphite-app graphite-app Bot merged commit 7e32a38 into main May 26, 2026
29 of 30 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Tip

For best results, initiate chat on the files or code changes.

SIZE=M

findolor added a commit to rainlanguage/rain.local-db.remote that referenced this pull request May 26, 2026
…esting (#5)

## Depends on

- rainlanguage/raindex#2553 must be merged first. This PR pins `lib/raindex` to commit `9b33a3c4eca44726b4602f1a2d4046982584ef93` from that PR and uses its `local-db manifest-urls` command.

## Motivation

The local DB remote deployment should no longer depend on legacy SSH recipients that are not intended to have access in this repo.

This PR updates the provisioning/deployment access model to use the new `github_do` key, keeps `arda` as the only additional recipient, and makes the manual GitHub workflows testable from a non-`main` branch so provisioning and deploy can be exercised before merge.

## Solution

- change the Terraform SSH key lookup to use `github_do`
- update the encrypted-recipient config in `keys.nix` so only `github_do` and `arda` retain access
- remove the old `st0x-op`, `sid`, and `ci` recipients from the repo config
- update `Provision Host` to accept `target_ref` and `allow_non_main`, check out the selected ref, and persist Terraform state back to that same ref
- update `Deploy` to accept `target_ref` and `allow_non_main` so the branch version of the workflow can be exercised against the real host before merge
- keep the default production path unchanged by defaulting both workflows to `target_ref=main` and `allow_non_main=false`

## Checks

By submitting this for review, I am confirming I have done the following:
- [x] made this PR as small as possible
- [ ] unit-tested any new functionality
- [x] linked any relevant issues or PRs
- [ ] included screenshots (if this involves a front-end change)

Validated locally with:
- not run yet; workflow changes have been reviewed but not exercised through GitHub Actions from this branch


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **Chores**
  * Deployment and provisioning workflows now let you choose a target Git ref, include a validation toggle for non-main refs, and show the selected target in summaries. Workflows decrypt and load runtime config at runtime for deployment and storage operations; state persistence follows the chosen target.
  * Infrastructure defaults updated: new default SSH key, larger VM size, and simplified role assignments for SSH/infra credentials.
* **Documentation**
  * Added example runtime env and terraform vars entries documenting optional overrides.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

3 participants