Skip to content

feat(schedule): preview shared-schedule publish side effects - #1464

Open
wcy12378 wants to merge 1 commit into
Tencent:mainfrom
wcy12378:codex/workbuddy-share-preview
Open

wcy12378 wants to merge 1 commit into
Tencent:mainfrom
wcy12378:codex/workbuddy-share-preview

Conversation

@wcy12378

Copy link
Copy Markdown

feat(schedule): preview shared-schedule publish side effects

This is the backend slice of #1215: let a user see what publishing a shared AI schedule would make public, before committing to it.

Problem

PublishSharedSchedule automatically makes a job's project-private agent, skill, SOP and their dependencies visible to all projects. The publish dialog never said which assets were affected, so users clicked "publish" without knowing the side effects (#1215).

Change

  • New read-only endpoint GET /api/schedule-jobs/:id/publish-preview returning {willShare: [...], blocked: [...]} — the assets that would be newly shared (including the rules/skills a newly shared agent carries) and references that cannot be shared.
  • internal/repo/shared_schedule_assets.go — PreviewSharedSchedulePublish reuses the publish path's directScheduleReferences/sharedScheduleReference resolution, mirrors ShareAgentAssets cascade rules, and simulates Shared=true to run ValidateWorkflowAgentScopes/ValidateWorkflowSharing for SOPs — all without writing anything.
  • internal/domain/shared_schedule.go — preview result types.
  • internal/httpapi/shared_schedules.go / server.go — handler with the same authorization/admission as the publish endpoint, plus route.
  • Test asserts the preview is read-only (no asset shared, no version created), viewer gets 403, and a post-publish preview returns empty lists.

Publishing behavior itself is unchanged; the dialog that consumes this endpoint is a follow-up slice.

Verification (Linux/amd64, Docker python:3.12)

  • Target test PASS (RED at compile/route level → GREEN).
  • go vet on domain/repo/httpapi: clean.
  • Full repo/httpapi regressions: failure sets identical to baseline (no new failures); two engine timing flakes reproduced on baseline with -count=3. gofmt and check-public.py pass.

Scope / notes

Related

Part of #1215; does not close the issue.

Publishing a shared AI schedule silently makes its project-private agent,
skill, SOP and their dependencies visible to all projects (Tencent#1215). Add a
read-only dry-run endpoint GET /api/schedule-jobs/:id/publish-preview that
reports which assets would be newly shared (including the rules/skills a
newly shared agent carries) and which references cannot be shared.

The preview reuses the publish path's reference resolution, sharing checks
and agent cascade rules, so the two cannot drift. It never writes: a test
asserts no asset becomes shared and no version is created after previewing.
Publishing behavior itself is unchanged; the dialog is a follow-up slice.

Part of Tencent#1215; does not close the issue.

@Robert0622 Robert0622 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review & Deploy Test: PASS ✅

Reviewed changes: New read-only GET /api/schedule-jobs/:id/publish-preview returns willShare and blocked without writing. Authorization matches the publish endpoint. Test confirms no writes occur.

Deploy test: Schedule endpoint responds with 200.

Minor notes (non-blocking):

  • P3: Duplicate entries possible in willShare when agent carries a skill also listed directly.
  • P3: WillShare/Blocked tagged omitempty, so empty preview returns {} with both keys missing.
  • P3: If anything in blocked, nothing in willShare will actually be shared — worth documenting in the response.

loopforge-pr-review:d47f8bdbc7390fc55ede4d37f0cf668aa437eb7d

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.

Bug: shared SOP can retain private direct role dependencies

2 participants