Skip to content

A source loader's config cannot be changed after it is registered #159

Description

@mroops0111

What happens

PATCH /workspaces/:workspaceId/sources/:sourceId accepts only description and sync. A loader's own config, such as a Google Drive source's include / exclude filter, cannot be changed through the API at all.

The route says so deliberately:

Structural fields (id, kind, path, role) are immutable, to keep cross-references and on-disk layout stable. A rename or loader-change flow would need its own migration story.

id, kind, path, and role being immutable is right. loader.config is a different thing: it decides which documents the mirror holds, and changing it is an ordinary act rather than a migration.

Why it matters

Narrowing a source is a normal thing to want. A source registered to trial one PRD had no include, so its whole Drive folder mirrored down and every document in it became a card on the board. Adding a filter is the obvious fix and there is no supported way to do it.

The two workarounds both cost something:

  • Edit PRODUCT.md by hand. The WorkspaceService cache is not invalidated, so the next sync reports unchanged and appears to do nothing until the server restarts. It also writes no config commit, so a later restore silently drops the change.
  • Delete the source and register it again. DELETE removes the mirror directory with rm -rf, so every document is re-fetched and every SourceUnitObservation for that source is lost.

What it should do

Let PATCH take loader.config, validated against the loader plugin's own config schema, then do what the existing route already does for the fields it accepts: write the manifest, commit it as a config change, and reload the workspace so the cache is not stale.

Removing documents from the mirror is already handled. A sync after the filter narrowed correctly reported removed: 2.

Steps

  1. Register a gdrive source whose folder holds several documents, with no include.
  2. Try to add include through PATCH /workspaces/:id/sources/:id. The body is rejected.
  3. Edit PRODUCT.md by hand instead and sync. It reports unchanged.
  4. Restart the server and sync again. Only now does it report removed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions