Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix(worker): #269 守卫只 strip 比较、实际仍用原值——group/DLQ 尾随空白进不同键,--queue-name 未校验导致空转/双投

Open
#275 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, redis

Research direction

Read plaita/server/flow_worker.py around _cli_startup_problems (7568–7605) and main() (7745–7770), then inspect the existing tests for worker CLI startup validation. Reproduce the trailing-space group and DLQ cases and a mismatched --queue-name; done means the actual values are normalized or rejected and a different queue fails fast with the expected CLI and environment stream names.

Written by the indexing model from the issue text.

Description

优先级 P1 · 依赖:无

基线 HEAD = 0c5dea5

Summary

_cli_startup_problems 用 str(...).strip() 只做比较,但 main() 把 args.consumer_group / args.dlq_key / args.queue_name 原值传给 worker(plaita/server/flow_worker.py:7568-7605、:7745-7770 邻域)。因此:

  • --consumer-group "plaita-workers "(尾随空格)与 env 同值 → guard 返回空(strip 后相等),worker 实际加入 consumer group "plaita-workers ";
  • --dlq-key "...:dlq " 同理:实际 DLQ 键带空格,运维/其他进程按无空格键读不到;
  • --queue-name 完全未参与 guard(源码注释明确留给 #269 边界);CLI 指定另一个 Stream 时 worker 正常启动,但 console/schedule/event_filter 仍写 env Stream。

探针 /tmp/r99-probe-cli-bypass2.py(clean 0c5dea5):

group trailing space problems= []
dlq trailing space problems= []
queue name different problems= []
queue name trailing space problems= []
group-space: actual group='plaita-workers ' family=cf1-fe07... (与 producer 同哈希)
same message delivered to both groups? True q1=1792584997313-0 q2=1792584997313-0
queue-diff: worker queue='plaita:flow:other'; env stream len=1; worker stream read=None

影响

  • consumer group 尾随空格:worker 与默认组是 Redis 两个独立 consumer group,同一条 Stream 消息会被两组各投递一次 → 同一 start/resume 双跑;而 canonical_json 对字符串做 strip,config_family 哈希相同,family gate 不拦(更隐蔽)。租约只能串行化同一 execution,但 duplicate 处理/副作用重放窗口仍打开。
  • DLQ 尾随空格:死信写到带空格键;/api/queues、告警、租户清理按无空格 dlq_key 读/删,证据与清理都错位。
  • --queue-name 不同/尾随空格:worker 消费的 Stream 与 producer 写入的 Stream 不同(或键名不同),任务无限留在 env Stream/PEL 无人消费;worker 看起来健康。
  • 大写/尾斜杠 group 已被 guard 拒绝(正确);本单是 strip 只用于比较、未用于实际值,以及 queue-name 未校验。多个生产者各自 env 不一致无法由 worker 单方发现(归部署一致性,另记 b/P3)。

建议

  • 在 main() parse_args 后规范化并写回 CLI 值:args.consumer_group = str(...).strip()、args.dlq_key = str(...).strip()、args.queue_name = str(...).strip();空值走既有 ConfigError。
  • _cli_startup_problems 增加 queue-name 校验:CLI queue 与 resolve_queue_name("worker") 不一致时 fail-fast(与 group/dlq 同文案),或要求三者都只从 env 取、CLI 只允许匹配值。
  • 不在 canonical_json 层掩盖差异:family 的输入应是规范化后的实际值;不能再出现“哈希相同但 Redis 键/组不同”。
  • 验收:
    1. --consumer-group "plaita-workers ":启动拒绝,或 args 被 strip 后实际 group 与 producer 相同;不得出现两个 group 同时收到同一消息。
    2. --dlq-key "...:dlq ":同上,实际 DLQ 键无空格。
    3. --queue-name other:启动 fail-fast(给出 CLI 与 env 两个 Stream);不能正常启动后静默空转。
    4. 大写/尾斜杠等真实不同值仍拒绝;合法匹配值照常启动。

边界

  • 本单不处理多个独立部署的 env 互不一致(worker 无法单方观测,需部署配置一致性)。
  • #269 已覆盖 group/dlq 的正常差异拒绝;本单是其 strip/queue-name 旁路,不重复其正常路径。
Dominant language
Python
Stars
0
Forks
1
Avg merge
2h 22m
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jeffkit/plaita

All issues in jeffkit/plaita

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.