Skip to content

fix(workflows): support editing global workflows#1557

Merged
Wirasm merged 2 commits into
coleam00:devfrom
guanghuang:fix/global-workflow-builder-edit
May 15, 2026
Merged

fix(workflows): support editing global workflows#1557
Wirasm merged 2 commits into
coleam00:devfrom
guanghuang:fix/global-workflow-builder-edit

Conversation

@guanghuang

@guanghuang guanghuang commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: Global workflows from ~/.archon/workflows are listed in the Web UI but cannot reliably be opened in the workflow builder because the detail endpoint does not resolve global workflow files.
  • Why it matters: Users who keep reusable workflows globally can see them in the list but cannot view or edit the DAG from the Web UI.
  • What changed: The workflow detail endpoint now resolves global workflows, save/delete can target global workflow scope with source=global, the builder preserves loaded workflow source on save, and global commands appear in the builder command library.
  • What did not change (scope boundary): Project workflow editing remains unchanged. Bundled/default workflows are still not edited in place.

UX Journey

Before

User                         Web UI                       Server
────                         ──────                       ──────
opens workflow list ──────▶  GET /api/workflows ───────▶ discover project/global/bundled
sees global workflow ◀─────  source: global returned ◀── global workflow included
clicks edit ──────────────▶  GET /api/workflows/:name ─▶ checks project + bundled only
sees load error ◀──────────  Workflow not found ◀─────── global workflow not resolved

After

User                         Web UI                          Server
────                         ──────                          ──────
opens workflow list ──────▶  GET /api/workflows ──────────▶ discover project/global/bundled
sees global workflow ◀─────  source: global returned ◀───── global workflow included
clicks edit ──────────────▶  GET /api/workflows/:name ────▶ [checks ~/.archon/workflows]
views DAG ◀────────────────  workflow + source: global ◀── global workflow parsed
saves edits ──────────────▶  PUT ?source=global ─────────▶ [writes ~/.archon/workflows]

Architecture Diagram

Before

packages/workflows/src/workflow-discovery.ts
  └─ GET /api/workflows
      └─ includes project + global + bundled workflows

packages/server/src/routes/api.ts
  └─ GET /api/workflows/:name
      ├─ project lookup
      └─ bundled/default lookup
          --x-- no global lookup

packages/web/src/components/workflows/WorkflowBuilder.tsx
  └─ load by name only, save without preserving source

packages/web/src/lib/command-categories.ts
  └─ project + bundled command groups only
      --x-- global commands dropped from grouped library view

After

packages/workflows/src/workflow-discovery.ts
  └─ GET /api/workflows
      └─ includes project + global + bundled workflows

[~] packages/server/src/routes/api.ts
  ├─ GET /api/workflows/:name
  │   ├─ project lookup
  │   ├─ [global lookup: ~/.archon/workflows/<name>.yaml]
  │   └─ bundled/default lookup
  ├─ PUT /api/workflows/:name?source=global
  │   └─ [writes ~/.archon/workflows/<name>.yaml]
  └─ DELETE /api/workflows/:name?source=global
      └─ [deletes ~/.archon/workflows/<name>.yaml]

[~] packages/web/src/components/workflows/WorkflowBuilder.tsx
  └─ preserves loaded workflow source and passes it on save

[~] packages/web/src/lib/command-categories.ts
  └─ includes Global command group

Connection inventory:

From To Status Notes
GET /api/workflows workflow discovery unchanged List already included global workflows.
GET /api/workflows/:name ~/.archon/workflows new Detail/edit loading now resolves global workflows.
Web workflow builder workflow detail response modified Builder now stores returned workflow source.
Web workflow builder PUT /api/workflows/:name modified Save includes source=global when editing a global workflow.
Command library grouping global command list entries modified Global commands are now shown in the grouped builder library.

Label Snapshot

  • Risk: risk: low
  • Size: size: S
  • Scope: server|web|tests
  • Module: workflows:builder

Change Metadata

  • Change type: bug
  • Primary scope: multi

Linked Issue

Validation Evidence (required)

Commands and result summary:

bun test packages/server/src/routes/api.workflows.test.ts
# Result: 29 pass, 0 fail

bun run type-check
# Result: @archon/paths, @archon/git, @archon/providers, @archon/isolation,
# @archon/web, @archon/workflows, @archon/core, @archon/adapters,
# @archon/server, and @archon/cli type-check exited with code 0
  • Evidence provided (test/log/trace/screenshot): Server route tests for global workflow load/save plus full monorepo type-check output.
  • If any command is intentionally skipped, explain why: Full test suite was not run because this is a scoped API/Web UI workflow-builder fix; targeted route coverage and full type-check were run.

Security Impact (required)

  • New permissions/capabilities? (No)
  • New external network calls? (No)
  • Secrets/tokens handling changed? (No)
  • File system access scope changed? (Yes)
  • If any Yes, describe risk and mitigation: The existing workflow edit API can now explicitly target Archon's home-scoped workflow directory when source=global is supplied. The workflow name still passes existing command-name validation, and writes are constrained to getHomeWorkflowsPath() with a fixed .yaml filename.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Database migration needed? (No)
  • If yes, exact upgrade steps: Not applicable.

Human Verification (required)

What was personally validated beyond CI:

  • Verified scenarios: Clean branch created from origin/dev; only this feature fix is included; route tests cover loading from ARCHON_HOME/workflows and saving with source=global.
  • Edge cases checked: Invalid workflow names remain rejected; invalid source query values are rejected; project save path remains the default when no global source is supplied.
  • What was not verified: Manual browser screenshot of the workflow builder loading a real global workflow was not captured.

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows: Web UI workflow builder, workflow REST API, command library grouping.
  • Potential unintended effects: A caller that sends source=global can update a same-named global workflow instead of creating a project workflow.
  • Guardrails/monitoring for early detection: Existing workflow route tests plus new global workflow load/save tests; OpenAPI query validation for allowed source values.

Rollback Plan (required)

  • Fast rollback command/path: Revert this PR commit.
  • Feature flags or config toggles (if any): None.
  • Observable failure symptoms: Global workflows again appear in the list but fail to open in the builder, or saving a global workflow writes to the wrong scope.

Risks and Mitigations

  • Risk: Source-aware save behavior could be confusing if users expect global workflows to become project-local copies.
    • Mitigation: The builder preserves the source returned by the API, matching the loaded workflow's listed scope.
  • Risk: Global workflow writes broaden the existing edit API's file target scope.
    • Mitigation: The write path is constrained to Archon's configured home workflows directory and validated workflow names.

Summary by CodeRabbit

  • New Features

    • Workflows can be saved or deleted as project-scoped or global/home-scoped via a new source option; fetching now resolves project → global → bundled defaults.
    • The web UI preserves and submits workflow source; client calls include the source so save/delete target the chosen scope.
    • Command lists are grouped into Project, Global, then bundled categories with stable ordering.
  • Tests

    • Added tests covering global/home workflow save, fetch, delete, and invalid-source validation.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Server and web changes add explicit workflow scoping: a source query parameter (project | global) is introduced for save/delete, GET now resolves project → global (home) → bundled workflows, the web client preserves and sends workflow source, and tests cover global workflow load/save behavior.

Changes

Workflow source support (project vs global/home)

Layer / File(s) Summary
API schema and route registration
packages/server/src/routes/api.ts
Adds workflowTargetQuerySchema extending cwdQuerySchema with optional `source: 'project'
Save workflow handler
packages/server/src/routes/api.ts
PUT /api/workflows/:name validates source; source=global writes to home workflows path, otherwise to project workflow folder; response includes source.
Delete workflow handler
packages/server/src/routes/api.ts
DELETE /api/workflows/:name validates source; deletes from home or project workflows path accordingly; bundled-default deletion refusal is conditioned on source.
Server tests (global coverage)
packages/server/src/routes/api.workflows.test.ts
Adds PUT/DELETE tests for source=global and tests that invalid source values return HTTP 400; verifies files are written/removed under ${ARCHON_HOME}/workflows.
Web API client signatures
packages/web/src/lib/api.ts
saveWorkflow and deleteWorkflow accept optional source?: WorkflowSource, build query using URLSearchParams, and include source=global when appropriate.
WorkflowBuilder state and wiring
packages/web/src/components/workflows/WorkflowBuilder.tsx
Adds workflowSource state; loadWorkflow sets it from server response; handleSave passes workflowSource to saveWorkflow.
Command categorization (UI grouping)
packages/web/src/lib/command-categories.ts
categorizeCommands partitions commands by source, inserts a Global category when present, and orders Project → Global → bundled categories → Utilities.
API reference docs
packages/docs-web/src/content/docs/reference/api.md
Documents source: "global" in Get response and adds source query parameter docs for Save/Delete including 400 "Invalid workflow source".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Browser
  participant WebClient
  participant Server
  participant FS as Filesystem

  Browser->>WebClient: Open workflow in builder (name)
  WebClient->>Server: GET /api/workflows/:name?cwd=...
  alt project file exists
    Server->>FS: read <cwd>/.archon/workflows/name.yaml
    FS-->>Server: project workflow
    Server-->>WebClient: 200 { workflow, source: "project" }
  else project missing but home exists
    Server->>FS: read $ARCHON_HOME/workflows/name.yaml
    FS-->>Server: global workflow
    Server-->>WebClient: 200 { workflow, source: "global" }
  else bundled exists
    Server-->>WebClient: 200 { workflow, source: "bundled" }
  end

  Browser->>WebClient: Save workflow (edited)
  WebClient->>Server: PUT /api/workflows/:name?cwd=...&source=global (if global)
  alt source=global
    Server->>FS: write $ARCHON_HOME/workflows/name.yaml
    FS-->>Server: ok
    Server-->>WebClient: 200 { name, source: "global" }
  else project
    Server->>FS: write <cwd>/.archon/workflows/name.yaml
    FS-->>Server: ok
    Server-->>WebClient: 200 { name, source: "project" }
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

  • coleam00/Archon#1315 — Also introduces a global workflow source concept across backend discovery/types and client handling.
  • coleam00/Archon#1405 — Modifies GET /api/workflows/:name resolution to include home/global scope; related server-side lookup work.

Poem

"I hopped to ~/.archon with care,
Found global workflows waiting there.
I fetched and saved with gentle paw,
Project, Global — now both in law.
A little hop, a file well-placed — huzzah! 🐇"

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR does not fully satisfy all coding-related requirements from issue #1556: the workflowTargetQuerySchema is not wired to PUT/DELETE routes (blocking reviewer issue from Wirasm), query validation tests for invalid source values are missing, DELETE global workflow test is missing, and bundled-default guard test for DELETE is missing. Wire workflowTargetQuerySchema to PUT and DELETE route definitions to enable OpenAPI-typed clients to recognize the source parameter; add tests for PUT/DELETE with invalid source values (expecting 400) and DELETE with source=global; add test for DELETE attempting bundled workflow returns 404.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive While the code changes directly target the stated objectives (global workflow loading/saving), reviewer Wirasm noted that PR #1525 already addresses overlapping server-side gaps, creating potential for duplicate changes and merge conflicts; the relationship between the two PRs is unclear. Clarify the relationship with PR #1525: determine if this PR should be rebased on top of #1525, closed in favor of it, or if the server changes should be coordinated to avoid duplication and merge conflicts.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(workflows): support editing global workflows' clearly and concisely describes the main change—enabling editing of global workflows—which aligns with the primary objective in the PR.
Description check ✅ Passed The PR description comprehensively covers all required template sections: Summary with Problem/Why/What changed/Scope boundary, detailed UX Journey Before/After, Architecture Diagram with module changes, Label Snapshot, Change Metadata, Linked Issues, extensive Validation Evidence, Security Impact analysis, Compatibility assessment, Human Verification details, Side Effects/Blast Radius, and Rollback Plan with identified risks and mitigations.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/server/src/routes/api.ts`:
- Line 1: The file was accidentally replaced by a single marker and no longer
exports registerApiRoutes; restore the module to export a registerApiRoutes
function that registers the workflow endpoints using
registerOpenApiRoute(createRoute({...}), handler). Specifically, implement and
export registerApiRoutes that calls registerOpenApiRoute with a GET route (e.g.,
WorkflowGetHandler) to fetch workflows, a PUT route (e.g., WorkflowPutHandler)
to create/update workflows, and a DELETE route (e.g., WorkflowDeleteHandler) to
remove workflows, ensuring each route is created via createRoute({...}) and
wired to its handler; follow the existing route shape and OpenAPI metadata
conventions used elsewhere in packages/server/src/routes and re-export the same
named symbols so imports elsewhere resolve.

In `@packages/server/src/routes/api.workflows.test.ts`:
- Line 1: The file currently contains only a placeholder string and must be
replaced with a real test module: restore
packages/server/src/routes/api.workflows.test.ts to export/define Jest tests
that exercise the global workflow load/save endpoints (e.g., tests named "loads
global workflows" and "saves global workflows"); import the app/server instance
and any test helpers (supertest/request, fixtures or mocked DB), set up/tear
down test data, call the relevant routes (GET/POST or PUT for global workflows),
assert responses and persisted state, and re-enable any mocked auth or DB
helpers previously used by other route tests so coverage for global workflow
load/save is restored. Ensure the module uses proper TypeScript imports/exports
and Jest describe/it blocks rather than the marker string.

In `@packages/web/src/components/workflows/WorkflowBuilder.tsx`:
- Line 1: The file currently contains only a string and must be replaced with
the real React component implementation: restore a functional exported component
named WorkflowBuilder (used by WorkflowBuilderPage.tsx) that implements
source-aware save/load for global workflows; specifically, reintroduce the
component (function WorkflowBuilder or const WorkflowBuilder: React.FC) with its
state/hooks to load workflow data based on source metadata, provide UI handlers
for saving which include source attribution and branch/commit info, and export
default WorkflowBuilder so WorkflowBuilderPage.tsx can import it — locate
references to WorkflowBuilder, its props (if any), and any load/save helpers
used elsewhere in the repo and wire them back into this component to match the
previous behavior.

In `@packages/web/src/lib/api.ts`:
- Line 1: The file currently contains an invalid marker and must be replaced
with the full TypeScript API surface required by the web package: restore
exports for functions like listWorkflows and listProviders and constants like
SSE_BASE_URL, and the types DagNode, CommandEntry, CodebaseResponse,
ConversationResponse, MessageResponse (and any other types used across
ChatPage.tsx, SettingsPage.tsx, DashboardPage.tsx, useProviders.ts, useSSE.ts).
Fix by replacing the marker string with the original module implementation or by
re-exporting the real implementations/types from their canonical module (e.g.,
export { listWorkflows, listProviders, SSE_BASE_URL } from '...'; export type {
DagNode, CommandEntry, CodebaseResponse, ConversationResponse, MessageResponse }
from '...'), making sure all named exports referenced across the web package are
present and properly typed so TypeScript type-checking and imports succeed.

In `@packages/web/src/lib/command-categories.ts`:
- Line 1: This module is empty but other modules import categorizeCommands; add
and export a named function categorizeCommands that matches the signature
expected by NodeLibrary.tsx and CommandPicker.tsx (e.g.,
categorizeCommands(commands: Command[]): Record<string, Command[]> or the exact
type those components expect), implement the logic to group commands into
categories (e.g., by command.category or similar property), and export any
related types used by callers; ensure the exported function name is exactly
"categorizeCommands" and the TypeScript types align with the Command type
imported/used by the callers so compilation succeeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5df9e04e-a957-4ea5-b6a3-b4211ac76ba1

📥 Commits

Reviewing files that changed from the base of the PR and between 69b2c89 and 3fa7435.

📒 Files selected for processing (5)
  • packages/server/src/routes/api.ts
  • packages/server/src/routes/api.workflows.test.ts
  • packages/web/src/components/workflows/WorkflowBuilder.tsx
  • packages/web/src/lib/api.ts
  • packages/web/src/lib/command-categories.ts

Comment thread packages/server/src/routes/api.ts Outdated
Comment thread packages/server/src/routes/api.workflows.test.ts Outdated
Comment thread packages/web/src/components/workflows/WorkflowBuilder.tsx Outdated
Comment thread packages/web/src/lib/api.ts Outdated
Comment thread packages/web/src/lib/command-categories.ts Outdated
@guanghuang guanghuang force-pushed the fix/global-workflow-builder-edit branch from 3fa7435 to e6da4e6 Compare May 3, 2026 18:39
@Wirasm

Wirasm commented May 4, 2026

Copy link
Copy Markdown
Collaborator

@guanghuang related to #1556 — global workflow editing support.

@blankse

blankse commented May 4, 2026

Copy link
Copy Markdown
Contributor

There's significant overlap with #1525 (opened 2026-05-01, also still open), which addresses the same underlying gap - the single-workflow REST endpoints don't resolve ~/.archon/workflows/, so home-scoped workflows show up in the list but break on the detail page.

Both PRs touch packages/server/src/routes/api.ts and api.workflows.test.ts and add the same project → global → bundled tier in GET /api/workflows/:name. The interesting differences are:

Closing one in favor of the other, or rebasing #1557 on top of #1525's server fix and keeping only the Web UI/builder changes here, would avoid non-trivial merge conflicts in api.ts and the test file.

@Wirasm

Wirasm commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Review Summary

Verdict: minor-fixes-needed

This PR adds a source query parameter to the workflow API (GET/PUT/DELETE /api/workflows/:name) so the Web UI workflow builder can edit workflows from ~/.archon/workflows/. The engineering is solid — scoped change, good error handling, comprehensive GET coverage. A few additions to tests and docs will round it out.

Blocking issues

None.

Suggested fixes

  • Missing test — PUT ?source=invalid-value → 400 (packages/server/src/routes/api.ts:2332-2334): Add a test for PUT /api/workflows/my-workflow?source=foo expecting 400 "Invalid workflow source". The enum is ['project', 'global']; any other value must be rejected.

  • Missing test — DELETE ?source=invalid-value → 400 (packages/server/src/routes/api.ts:2398-2400): Add a test for DELETE /api/workflows/my-workflow?source=foo expecting 400 "Invalid workflow source".

Minor / nice-to-have

  • Unnecessary comment (packages/server/src/routes/api.ts:2267-2269): The comment describing the global workflow fetch restates what the code does and references other endpoints ("List discovery"). Remove it — the code is self-explanatory.

  • Missing API docs — source query param (packages/docs-web/src/content/docs/reference/api.md): Document source on GET, PUT, and DELETE workflow endpoints. For PUT: source=global saves to ~/.archon/workflows/. For DELETE: source=global targets the home-scoped path.

  • Missing API docs — source return value (packages/docs-web/src/content/docs/reference/api.md): Update GET /api/workflows/{name} return value from source: "project" | "bundled" to source: "project" | "global" | "bundled".

Compliments

Your error-handling is thorough and consistent — workflow.fetch_global_failed follows the event naming convention, ENOENT fallthrough is intentional and documented, and non-Error throws are converted before logging. The GET endpoint tests cover happy path, malformed YAML, and shadowing priority — exactly the right cases.


Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: error-handling, test-coverage, comment-quality, docs-impact.

@Wirasm

Wirasm commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Review Summary

Verdict: blocking-issues

The PR adds global workflow support via a source query parameter on the workflow CRUD endpoints, with Web UI wiring. The error handling is solid and the feature design is clean — but one bug makes the feature non-functional via the OpenAPI spec, and the API docs need source coverage before this merges.

Blocking issues

  • packages/server/src/routes/api.ts:224, 244: workflowTargetQuerySchema is defined (lines 156–160) but never wired to the PUT and DELETE route handlers. Both still use query: cwdQuerySchema, which has no source field. Clients calling ?source=global via the OpenAPI-typed client will have the parameter silently ignored.
    • Fix: Change both route definitions from query: cwdQuerySchema, to query: workflowTargetQuerySchema,

Suggested fixes

  • packages/docs-web/src/content/docs/reference/api.md: Update GET, PUT, and DELETE endpoint docs to document the source query parameter (enum: project | global) and the new source: "global" response value for global-scope workflows.

  • packages/server/src/routes/api.workflows.test.ts: Add a test for DELETE /api/workflows/:name?source=global (PUT and GET have it; DELETE is missing). Also add tests for the 400 "Invalid workflow source" validation on both PUT and DELETE.

  • packages/server/src/routes/api.ts:2267–2270: Remove the literal source:global string reference from the comment (e.g., "List discovery includes these as source:global" → "List discovery includes these as a global source"). Prevents comment rot if the enum value ever changes.

Minor / nice-to-have

  • packages/server/src/routes/api.ts:2356, 2399: Both PUT and DELETE have identical targetSource validation. DRY opportunity — extract to a shared helper. Not blocking.
  • packages/server/src/routes/api.workflows.test.ts: The bundled-default guard test doesn't pass source=global to verify the targetSource !== 'global' branch. Consider adding a test confirming DELETE /api/workflows/archon-assist?source=global returns 404.

Compliments

  • Error handling is thorough throughout: all async paths have try/catch, logs use consistent {domain}.{action}_{state} events, and failures surface correctly to callers. No silent swallows.
  • The comment explaining why home-scoped resolution must exist in the detail endpoint captures a real cross-endpoint invariant — good architectural reasoning preserved.
  • guides/global-workflows.md is well-structured and in sync with the implementation.

Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects: code-review, error-handling, test-coverage, comment-quality, docs-impact.

guanghuang and others added 2 commits May 15, 2026 15:20
- Document the `source` query parameter on PUT and DELETE in the API
  reference, including the 400 error for invalid values.
- Document the new `source: "global"` response value for GET, with the
  three-tier auto-discovery order spelled out.
- Add a DELETE test for `?source=global` to confirm the home-scoped file
  is removed (PUT already had coverage; DELETE was missing).
- Add 400 "Invalid workflow source" validation tests for both PUT and
  DELETE so the enum rejection path is locked down.

The blocking issue from the prior review — PUT/DELETE routes using
cwdQuerySchema instead of workflowTargetQuerySchema — was already
resolved on the branch via the rebase against current dev; both routes
now correctly use workflowTargetQuerySchema. The comment-rot reference
(`source:global` string in a comment) was dropped as part of the rebase
conflict resolution where dev's home-scoped resolver block was kept.
@Wirasm Wirasm force-pushed the fix/global-workflow-builder-edit branch from e6da4e6 to fa0b9ad Compare May 15, 2026 12:23
@Wirasm Wirasm merged commit 65fc0bf into coleam00:dev May 15, 2026
1 check was pending
cropse pushed a commit to cropse/Archon that referenced this pull request May 19, 2026
* fix(workflows): support editing global workflows

* fix: address review feedback on global workflow editing

- Document the `source` query parameter on PUT and DELETE in the API
  reference, including the 400 error for invalid values.
- Document the new `source: "global"` response value for GET, with the
  three-tier auto-discovery order spelled out.
- Add a DELETE test for `?source=global` to confirm the home-scoped file
  is removed (PUT already had coverage; DELETE was missing).
- Add 400 "Invalid workflow source" validation tests for both PUT and
  DELETE so the enum rejection path is locked down.

The blocking issue from the prior review — PUT/DELETE routes using
cwdQuerySchema instead of workflowTargetQuerySchema — was already
resolved on the branch via the rebase against current dev; both routes
now correctly use workflowTargetQuerySchema. The comment-rot reference
(`source:global` string in a comment) was dropped as part of the rebase
conflict resolution where dev's home-scoped resolver block was kept.

---------

Co-authored-by: Rasmus Widing <rasmus.widing@gmail.com>
@Wirasm Wirasm mentioned this pull request May 28, 2026
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.

Workflow builder cannot view or edit global workflows from ~/.archon/workflows

3 participants