Skip to content

feat(settings): share one operator settings file between the CLI and server - #158

Merged
sweepies merged 3 commits into
mainfrom
feat/operator-settings
Nov 2, 2026
Merged

sweepies merged 3 commits into
mainfrom
feat/operator-settings

Conversation

@sweepies

@sweepies sweepies commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

First step toward #157 (private registries). Registry credentials will be operator settings, so the CLI and patchula serve now read one settings file. This PR adds no credentials yet.

What changes

  • PatchulaServer.pkl becomes PatchulaSettings.pkl:
    • Shared settings sit at the top level: concurrency, recheck, and an http section with defaultHostConcurrency, hostConcurrency, registryFreshnessSecs and goFreshnessSecs.
    • Server-only fields move under server { … }. The CLI ignores that section.
  • run, lookup, apply and tui read --settings, then PATCHULA_SETTINGS, then patchula/settings.pkl in the user config directory if it exists, and the defaults otherwise. --concurrency overrides the file. --remote ignores the local file.
  • The server now applies the http section (before, it always used the defaults). When http changes on reload, the server rebuilds an installation's engine before its next batch. The installation GitHub client keeps its limit of 4 unless api.github.com is set.
  • The Action gets a settings input.
  • The docs page reference/server-settings becomes reference/settings. The server guide, environment, sources, cache and GitHub Actions pages are updated. The CLI reference and the help snapshot are regenerated.

Breaking (hard cutover)

  • --host-concurrency, --registry-freshness-secs and --go-freshness-secs are removed; use the http section instead.
  • PATCHULA_SERVER_SETTINGS is renamed to PATCHULA_SETTINGS.
  • config server-schema and config check-server are renamed to config settings-schema and config check-settings.
  • The server:schema mise task is renamed to settings:schema.
  • Existing server settings files must move their fields under server { }.

The Docker Hub variables stay for now. They fold into the registry credentials in the next PR.

Testing

mise run test:unit, mise run lint and mise run docs:build pass on the dev VM. A new CLI integration test covers reading settings from the flag, the environment and the config directory.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…server

PatchulaServer.pkl becomes PatchulaSettings.pkl. Shared settings
(concurrency, recheck and an http section for host limits and freshness
floors) sit at the top level; the server-only fields move under `server`.

The CLI reads --settings, then PATCHULA_SETTINGS, then
patchula/settings.pkl in the user config directory. The server now
applies the http section too, rebuilding an installation's engine when
it changes.

BREAKING CHANGE: --host-concurrency, --registry-freshness-secs and
--go-freshness-secs are removed in favour of the http section;
PATCHULA_SERVER_SETTINGS is now PATCHULA_SETTINGS; config server-schema
and config check-server are now config settings-schema and
config check-settings; server fields move under `server { }`.

Refs #157

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@deepsource-io

deepsource-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 21873b4...622f560 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Nov 2, 2026 10:04p.m. Review ↗
JavaScript Nov 2, 2026 10:04p.m. Review ↗
Shell Nov 2, 2026 10:04p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/src/content/docs/reference/settings.mdx">

<violation number="1" location="docs/src/content/docs/reference/settings.mdx:10">
P2: The CLI still validates the `server` section: `Settings::load` rejects invalid values such as `server.batchSize = 0`, so a server-only typo can block local CLI commands. Clarify that the CLI does not use these values but still validates the whole file.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread crates/server/src/runtime.rs Resolved
Comment thread crates/cli/src/main.rs Resolved

Operator settings, in a Pkl file that amends the bundled `PatchulaSettings.pkl`.
The CLI (`run`, `lookup`, `apply`, `tui`) and [`patchula serve`](/guide/server/)
read the same file; only the server reads the `server` section, and the CLI

@cubic-dev-ai cubic-dev-ai Bot Nov 2, 2026 •

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: The CLI still validates the server section: Settings::load rejects invalid values such as server.batchSize = 0, so a server-only typo can block local CLI commands. Clarify that the CLI does not use these values but still validates the whole file.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At docs/src/content/docs/reference/settings.mdx, line 10:

<comment>The CLI still validates the `server` section: `Settings::load` rejects invalid values such as `server.batchSize = 0`, so a server-only typo can block local CLI commands. Clarify that the CLI does not use these values but still validates the whole file.</comment>

<file context>
@@ -0,0 +1,72 @@
+
+Operator settings, in a Pkl file that amends the bundled `PatchulaSettings.pkl`.
+The CLI (`run`, `lookup`, `apply`, `tui`) and [`patchula serve`](/guide/server/)
+read the same file; only the server reads the `server` section, and the CLI
+ignores it. Print the schema with `patchula config settings-schema` and check a
+file with `patchula config check-settings <path>`. Secrets are never settings.
</file context>
Fix with cubic

Comment thread crates/cli/src/cli.rs Resolved
Comment thread docs/src/content/docs/reference/cli.md Resolved
Comment thread crates/server/src/settings.rs Resolved

@cubic-dev-ai cubic-dev-ai 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.

1 existing issue remains and no new issues found across 31 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread action.yml Resolved
@context7

context7 Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Docs7 for sweepies/count-patchula

Result Status Action
Deployment ➖ Not used —
Content review ✅ Passed. No problems found. —

Commit 622f560

- Every installation GitHub client, not only the engine's, takes the
  api.github.com limit from the settings.
- --settings keeps a run on this machine, like --config, and is refused
  with --remote instead of being silently ignored.
- A relative XDG_CONFIG_HOME is ignored, as for the cache directory.
- defaultHostConcurrency errors point at their own field.
- Docs: the CLI still checks the server section; the Action input needs
  a checkout and falls back to PATCHULA_SETTINGS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 622f560 Commit Preview URL

Branch Preview URL
Nov 02 2026, 10:03 PM

@sweepies
sweepies merged commit 8b00f4b into main Nov 2, 2026
23 checks passed
@sweepies
sweepies deleted the feat/operator-settings branch November 2, 2026 23:12
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