Repository navigation
A deployment can turn off self-service document sources - #1685
VanshajPoonia wants to merge 7 commits into
Conversation
LOOM_KNOWLEDGE_SOURCE_SELF_SERVICE_ENABLED (default true) is the switch the code and tracker self-service paths already have. When it is off, knowledge.source.add (shared and connected) and knowledge.source.rotate answer SELF_SERVICE_OFF before any probe or write, so no member's credential reaches the pods. List, inspect, parse_links, check, update, sync and remove keep answering. knowledge.source.list reports the switch as self_service. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
With self_service false the Sources list hides Add a source and the Rotate credential item and says adding is turned off. Check, Sync now, push notifications and Retire stay. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
The server rejects add and rotate before probing or storing credentials, and the list preserves the other source actions. Please cover the new contract in the existing HTTP integration suite, including the SELF_SERVICE_OFF response and the list’s self_service field.
Both handlers read knowledge_source_self_service_enabled at call time, so it is a live setting: an admin turns it off with admin/settings.set and no restart. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
knowledge.source.list reports self_service true by default. With the switch off through a runtime override, add and rotate answer 422 SELF_SERVICE_OFF, the list reports false and still lists the source, and inspect still answers. The override is cleared after the case. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The dashboard's lead-in for the code said repositories, so a refused document source add or rotation read as "Adding repositories is turned off". The lead-in is now neutral and the server's message names the action. The add and rotate dialogs each cover a refusal. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The add and rotate dialogs now use the shared refusal label and keep the server’s explanation. The new HTTP cases cover both refusals, the false capability in the list, and a source that stays readable with the setting off. The platform-admin override uses the existing live-settings path.
Please update the rollback note before merging. A value set through admin/settings.set persists in the runtime override store and applies if the setting is introduced again.
|
@VanshajPoonia please sign CLA |
|
The rename integration test fails at the same assertion on clean |
zlareb1
left a comment
There was a problem hiding this comment.
GitHub reports a merge conflict with main. Please resolve it so CI can run against the merged tree.
…e-source-self-service Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com> # Conflicts: # sdk/rust/src/wire_models.rs
zlareb1
left a comment
There was a problem hiding this comment.
The upstream merge preserves the request guards, source list behavior, and HTTP coverage. The regenerated Rust model also keeps the default on for older server responses.
zlareb1
left a comment
There was a problem hiding this comment.
The format job reports the same adoption page assignment as clean main. The pinned formatter passes with the tracked repair. PR job · Repair #1706
|
Thank you for the review. df7dc02 makes the switch a live setting, since both handlers read it at call time. 496593c adds two cases to |
zlareb1
left a comment
There was a problem hiding this comment.
GitHub reports a merge conflict with main in sdk/rust/src/wire_models.rs. Please resolve the conflict and regenerate the Rust wire models so CI can validate the combined tree.
Closes: #869
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
LOOM_KNOWLEDGE_SOURCE_SELF_SERVICE_ENABLED=falserefusesknowledge.source.addandknowledge.source.rotatewithSELF_SERVICE_OFFbefore any probe or write, so an operator can keep members' credentials off a shared deployment. The other document source operations keep working, and the dashboard offers neither add nor rotate.Why
Repositories and tracker sources each have a self-service switch (
LOOM_CODE_SELF_SERVICE_ENABLED,LOOM_TRACKER_SELF_SERVICE_ENABLED). Document sources had none. A shared deployment could keep the sync worker off, butaddandrotatestill took, probed and stored the credential.Scope and risk
knowledge_source_self_service_enabledin the settings catalog, defaulttrue, so no deployment changes. It is a live setting because both handlers read it at call time, soadmin/settings.setturns it off without a restart._require_self_service()runs first inhandle_knowledge_source_addandhandle_knowledge_source_rotate, before name checks, probes and writes. It also covers a connected add, because that registers a member's credential on the pods too. It raisesSELF_SERVICE_OFF, the code the repository and tracker switches use.knowledge.source.updatehas no credential input (it probes with the stored one), so it stays open. So do list, inspect, parse_links, check, sync_now, remove and the push ops.SELF_SERVICE_OFFsaid repositories, though tracker and document sources share the code. It is now "The operator turned this off:" and the server's message names the refused action.knowledge.source.listreports the switch asself_service. The Sources list hides "Add a source" and "Rotate credential" when it is false and says "Adding document sources is turned off on this deployment." Check, Sync now, Push notifications and Retire stay. An empty Library section hides, as it does for a place that takes no source.Compatibility, rollout and rollback
knowledge.source.listgainsself_service(bool, default true).knowledge.source.addandknowledge.source.rotatecan answerSELF_SERVICE_OFF. No default changes.LOOM_KNOWLEDGE_SOURCE_SELF_SERVICE_ENABLED=false, or setknowledge_source_self_service_enabledto false withadmin/settings.set.self_service, and the dashboard reads a missing field as on.Tests
pytest tests/unit/test_knowledge_sources.py: 4 new cases. Add is refused in shared and connected mode with no probe and no row. Rotate is refused and the stored credential stays the same. With the switch off, list (sources still listed,self_servicefalse,accepts_sourcestrue), inspect and parse_links still answer. All 4 fail with the handler change reverted.vitest run src/views/Documents.sources.test.tsx: 26 pass. The new case checks the note, that there is no Add button and that the menu is Check, Sync now, Push notifications, Retire. It fails with theSourcesListchange reverted.-n 2): 1847 passed. 6 failed locally and none touch these files: 4 worker registry cases neednumpy, which this environment lacks, and 2 intest_code_workspace_registry.py.RepositoryCard.test.tsxhas one failing branch-table case here with or without this change.tests/integration/test_knowledge_sources.py: 2 new cases. The list reportsself_service: trueby default. With the switch off throughadmin/settings.set, add and rotate answer 422SELF_SERVICE_OFF, the list reportsself_service: falseand still lists the source, and inspect answers. The override is cleared after the case. These need a running server and ClickHouse, so CI is their first run.vitest run src/flows/KnowledgeSourceDialog.test.tsx: 2 new cases, a refused add and a refused rotation. Each checks the alert reads "The operator turned this off" with the server's words and never mentions repositories. Both fail with the old lead-in.test_settings_defaults.pyandtest_live_settings.pysnapshots updated withLOOM_UPDATE_SNAPSHOT=1.--checkinmake lint, ruff, the function-length gate, Biome on the changed files,npm --prefix frontend run build,npm --prefix frontend run budgetand Prettier 3.9.9 on the Markdown and YAML pass.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code wrote the diff and ran the checks above.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s), as CONTRIBUTING.md asks.Note
Low Risk
Behavior is opt-in via a new setting defaulting to on; changes are gated refusals and dashboard visibility, not auth or stored credential handling.
Overview
Adds
LOOM_KNOWLEDGE_SOURCE_SELF_SERVICE_ENABLED(default on, live) so operators can block members from submitting credentials viaknowledge.source.addandknowledge.source.rotate, which now fail early withSELF_SERVICE_OFF—aligned with existing repository/tracker self-service switches. Other source ops (list, inspect, check, sync, retire, etc.) stay available.knowledge.source.listexposesself_service; the dashboard hides Add a source and Rotate credential, shows a deployment notice, and leaves check/sync/push/retire.SELF_SERVICE_OFFcopy is generic (“The operator turned this off:”) while the server message names document-source add/rotate. SDK types, docs, schema, and unit/integration tests cover the flag and UI.Reviewed by Cursor Bugbot for commit d26d79e. Bugbot is set up for automated code reviews on this repo. Configure here.