Skip to content

Refactor use store in server scheduler#6754

Draft
6543 wants to merge 14 commits into
woodpecker-ci:mainfrom
6543-forks:refactor_server-scheduler-more
Draft

Refactor use store in server scheduler#6754
6543 wants to merge 14 commits into
woodpecker-ci:mainfrom
6543-forks:refactor_server-scheduler-more

Conversation

@6543

@6543 6543 commented Jun 20, 2026

Copy link
Copy Markdown
Member

before queue had store inserted, now scheduler has it, so we can make more persistent things with it.

this does:

  • mark skipped workfows as such without rpc layer
  • make code more readable
  • make code arch more stright forward
  • clear way for scheduler to back propagate results ... e.g. to forge via states
    • look into if we can use pub/sub there too 🤔 ... (mulit instance race risistant?)
  • scheduler should not import rpc
  • ...

followup of #6753
step of #6317

@6543 6543 added server refactor delete or replace old code wip labels Jun 20, 2026
@woodpecker-bot

This comment was marked as off-topic.

@6543

6543 commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

I want the scheduler to be a pure state maschine that gets signals from extern e.g. api / agent-rpc and forwards them to forge / agent-rpc ... this is by no means the full refactor, it's a way in the right direction but i need more time to refine it.

as for server-instance-cluster-wide locking stuff, a good candidate is atomic DB swaps etc.. and for signal distribution the pubsub/queue stuff ... it needs more thinkig ...

@6543 6543 changed the title Refactor inject store into server scheduler and use it Refactor use store in server scheduler Jun 21, 2026
claude added 3 commits June 22, 2026 00:57
The merge of the agent-rpc hardening (woodpecker-ci#6759) into the server-scheduler
refactor dropped the lockAgentToWorkflow call site. The scheduler now
hands out a workflow but never records the owning agent, so workflow.AgentID
stays 0 and the ownership guard in sanitize.go rejects every follow-up agent
RPC ("agent is not allowed to interact with workflow ... not already locked").

This left lockAgentToWorkflow unused (lint failure) and broke the e2e
suite (pipelines stuck pending -> timeout). Re-lock the polled workflow to
the agent after Poll returns, restoring the hardening under the new
scheduler architecture.

Refs woodpecker-ci#6759
server/status was extracted as its own package and badge.go imports it as
pipelineStatus. importas runs with no-extra-aliases, so the alias must be
declared in config or lint fails. Register it to match the existing usage.
Every importas alias in the project is snake_case; pipelineStatus was the
sole camelCase outlier. Rename the alias to pipeline_status in the lint
config and its only consumer (server/api/badge.go) to match convention.
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.82474% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.94%. Comparing base (98ecce4) to head (56ba7a7).

Files with missing lines Patch % Lines
server/scheduler/impl.go 53.16% 55 Missing and 19 partials ⚠️
server/api/badge.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6754      +/-   ##
==========================================
- Coverage   46.95%   46.94%   -0.02%     
==========================================
  Files         438      438              
  Lines       29431    29476      +45     
==========================================
+ Hits        13820    13838      +18     
- Misses      14448    14471      +23     
- Partials     1163     1167       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

refactor delete or replace old code server wip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants