Skip to content

fix(forgejo): support new fj macos key path - #11545

Merged
jdx merged 1 commit into
mainfrom
agent/fix-forgejo-macos-key-path
Jul 31, 2026
Merged

jdx merged 1 commit into
mainfrom
agent/fix-forgejo-macos-key-path

Conversation

@jdx

@jdx jdx commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • recognize the new fj macOS key location
  • retain the legacy Cyborus.forgejo-cli path as a fallback
  • document the path order and cover it with a focused unit test

Root cause

forgejo-cli changed its macOS project directory from Cyborus.forgejo-cli to forgejo-cli.forgejo-cli. mise only checked the old location, so current fj credentials were not discovered.

This addresses discussion #11540.

Validation

  • cargo test forgejo::tests::test_fj_macos_keys_paths_prefers_current_path
  • mise run test:e2e e2e/cli/test_token_forgejo
  • mise run lint-fix

AI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable.


Note

Low Risk
Narrow change to optional fj CLI token fallback on macOS; Linux behavior unchanged and the old path remains as fallback.

Overview
Forgejo fj CLI token discovery on macOS now looks for keys.json at the current forgejo-cli location (~/Library/Application Support/forgejo-cli.forgejo-cli/keys.json) before the legacy Cyborus.forgejo-cli path, so mise picks up tokens from recent fj installs again.

Path resolution is refactored to walk XDG plus macOS candidates through tokens::first_existing_file, matching the pattern used for other forge CLIs. Docs (forgejo.md, forgejo.fj_cli_tokens in settings.toml) describe the ordered lookup. A unit test locks in macOS path priority.

Reviewed by Cursor Bugbot for commit dcf2bd7. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes

    • Improved Forgejo CLI token discovery across XDG, native, and legacy macOS configuration paths.
    • The application now prioritizes the correct available configuration path.
  • Documentation

    • Updated Forgejo CLI token setup guidance with the current macOS path and legacy fallback path.
  • Tests

    • Added coverage for macOS configuration path precedence.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 82445719-f5cf-4203-bd82-ec6bea7356e4

📥 Commits

Reviewing files that changed from the base of the PR and between 19baee7 and dcf2bd7.

📒 Files selected for processing (3)
  • docs/dev-tools/backends/forgejo.md
  • settings.toml
  • src/forgejo.rs

📝 Walkthrough

Walkthrough

Forgejo token discovery now checks the current macOS configuration path before the legacy path. The implementation uses first-existing-file selection, adds an ordering test, and updates both documentation locations.

Changes

Forgejo token path handling

Layer / File(s) Summary
Path discovery and documentation
src/forgejo.rs, docs/dev-tools/backends/forgejo.md, settings.toml
fj_keys_path checks XDG and platform-specific paths. macOS prioritizes forgejo-cli.forgejo-cli before Cyborus.forgejo-cli. Tests verify the order, and documentation records both paths.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • jdx/mise#11508: Updates platform-specific and XDG CLI token path discovery.

Suggested reviewers: risu729, jambalaya56562

Poem

A rabbit found a newer key,
And placed the old one safely near.
macOS paths now hop in line,
Tests confirm the order is fine.
Documentation follows too.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: support for the new macOS fj key path.
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.

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.

@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds support for the current fj macOS credential path while preserving legacy fallback behavior.

  • Checks the XDG path first, followed by the current and legacy macOS paths.
  • Documents the updated lookup order in the Forgejo backend documentation and setting description.
  • Adds a focused unit test for macOS path construction and precedence.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The path-selection helper preserves the prior XDG-first and nonexistent-XDG fallback behavior, adds the current macOS location ahead of the retained legacy location, and uses compatible platform guards.

Important Files Changed

Filename Overview
src/forgejo.rs Adds ordered current and legacy macOS credential paths while preserving existing XDG precedence and fallback semantics.
settings.toml Updates the Forgejo token setting description to reflect the current and legacy macOS credential locations.
docs/dev-tools/backends/forgejo.md Documents the credential-file lookup order consistently with the implementation.

Reviews (1): Last reviewed commit: "fix(forgejo): support new fj macos key p..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env █▁▁▂▃▁▂▂█▆▄▅▅ 84,790,156 → 84,782,548 -0.01% 22.24 → 19.84ms -10.79%
hook-env █▁▁▁▁▁▁▁▃▂▂▂▂ 87,122,679 → 87,148,547 +0.03% 23.66 → 20.62ms -12.85%
ls ▃▄▂▃▂▂▄▃█▃▃▁▅ 76,654,250 → 76,741,716 +0.11% 17.59 → 16.17ms -8.07%
registry ▄▁▂▂▁▁▂▁█▆▅▅█ 50,253,207 → 50,354,855 +0.20% 13.77 → 11.33ms -17.70%
startup ▅▁▂▁▁▁▁▁█▇▇▇▇ 16,075,742 → 16,078,461 +0.02% 8.69 → 8.10ms -6.79%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

dcf2bd77240b vs 19baee7c4805 · measured on the runner, not pushed to the history.

@jdx
jdx merged commit 154d8ce into main Jul 31, 2026
31 checks passed
@jdx
jdx deleted the agent/fix-forgejo-macos-key-path branch July 31, 2026 16:52
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