tickets: on Windows, case-only twin ids can alias one plan file, and discard_unbuilt_plan can delete the twin's unbuilt plan
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Start with src/bmad_loop/tickettree.py around discard_unbuilt_plan and the case-twin guard in src/bmad_loop/stories.py; then trace how tickets.py find names plan files. Add regression coverage for the three-entry case-only ID layout on Windows, including the rollback path described in the issue. Done means the twins cannot alias a plan and discarding one ticket's unbuilt plan preserves the other's.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Status (needs confirmation)
- Observed: on NTFS, an epic with three entries titled
Cart modeland idsX1,A1anda1gets plan namesstory-cart-model-A1-plan.mdandstory-cart-model-a1-plan.mdfromtickets.py find, which are one file.TicketTree.discard_unbuilt_plan("1.A1", <that path>)then deletes the file even though it holdsticket: a1and was written for1.a1. A twin plan with a body is refused (the frontmatter-only check), so only an unbuilt twin plan is at risk. - Observed controls: twins with two entries (same title, case-different titles, or different titles) get distinct names (
story-cart-model-plan.md/story-cart-model-a1-plan.md, or…-rules-plan.md), and the discard leaves the twin's plan alone. A three-entry layout with a non-colliding third id (A2instead ofa1) also leaves the other plan alone. - Not driven: a tickets run in which this happens (a failed in-place attempt of one twin with
rollback_on_failure = truewhile the other twin's plan is frontmatter-only). Also not driven: the wider consequence that both twins read and mark one shared plan file at all. - A tester should try: the layout above with
[scm] isolation = "none",rollback_on_failure = true, andmax_dev_attempts = 1. Start1.a1first and stop it atin-progresswith a frontmatter-only plan, then run1.A1with a failing session, and check whether1.a1's plan is gone. Please report whether a real run reaches the deletion.
Related: #963 (the same case-only twin ids alias the unit worktree and branch on Windows).
Summary
tickets.py disambiguates colliding title slugs with the entry id. For case-only twin ids, that suffix differs only by case, so on a case-insensitive filesystem both tickets resolve to one plan file. bmad-loop accepts case-only twin ids in tickets mode (stories mode refuses them), and discard_unbuilt_plan deletes a frontmatter-only plan without checking that its ticket: names the ref being rolled back. The deletion was observed through a direct TicketTree.discard_unbuilt_plan call; the proposed failed-run rollback sequence remains untested.
Environment
bmad-loop a5a8f097, Windows 11 10.0.26200 (NTFS), PowerShell 7.6.6 (SHELL unset), Python 3.13.2; pure calls (the real tickets.py find from the test suite's v7 sandbox, TicketTree.discard_unbuilt_plan); Linux oracle: n/a (on a case-sensitive filesystem the two plan names are two files; expected, not run).
Steps to reproduce (symbol level)
From a bmad-loop checkout at a5a8f097 after uv sync --all-extras, in PowerShell 7 with SHELL removed. The steps are complete and runnable as shown: save the script below as repro_twin_plan.py in the checkout root, then run:
Remove-Item Env:SHELL -ErrorAction SilentlyContinue
$env:PYTHONUTF8 = '1'
uv run python repro_twin_plan.py
import os, sys, tempfile
from pathlib import Path
sys.path.insert(0, "tests")
import conftest as C
from bmad_loop import tickettree
from bmad_loop.journal import Journal
root = Path(tempfile.mkdtemp(prefix="twin-plan-"))
(root / ".gitignore").write_text(C.V7_GITIGNORE, encoding="utf-8")
lay = C.install_bmad_v7(root)
C.write_ticket_tree(lay, (C.EpicSpec(1, "epic-cart", "Cart", (C.EntrySpec(1, "x"),)),))
(lay.initiative_folder / "epic-cart" / "tickets.toml").write_text(
"".join(f'[[entry]]\nid = "{i}"\ntype = "story"\ntitle = "Cart model"\n\n' for i in ("X1", "A1", "a1")), encoding="utf-8")
C._commit_template(root)
plans = {r: Path(C.run_tickets(lay, "find", r)["plan"]) for r in ("1.A1", "1.a1")}
print({r: p.name for r, p in plans.items()}, "same file:", os.path.normcase(str(plans["1.A1"])) == os.path.normcase(str(plans["1.a1"])))
plans["1.a1"].write_bytes(b"---\nticket: a1\nstatus: in-progress\n---\n") # 1.a1's unbuilt plan
(root / "run").mkdir()
print(tickettree.TicketTree(root).discard_unbuilt_plan("1.A1", plans["1.A1"], Journal(root / "run")))
print("1.a1's plan exists after 1.A1's discard:", plans["1.a1"].exists())
Observed (Windows, 2 of 2 runs; paths elided):
{'1.A1': 'story-cart-model-A1-plan.md', '1.a1': 'story-cart-model-a1-plan.md'} same file: True
PlanMark(ref='1.A1', …, before='in-progress', after='', outcome='discarded', created=False)
1.a1's plan exists after 1.A1's discard: False
For a non-colliding three-entry control, change the third entry id from a1 to A2, replace both lookup/use keys 1.a1 with 1.A2 throughout the script, and change the written frontmatter from ticket: a1 to ticket: A2. Keep the discard target 1.A1. Expected and observed: the plan names end in -A1-plan.md and -A2-plan.md, the discard returns outcome='noop', and the other plan remains present.
Source
At a5a8f097, src/bmad_loop/tickettree.py:530-565 (discard_unbuilt_plan): _locate(ref, plan) (:534) ties the path to what tickets.py find names for ref (here the shared file), then it reads the plan's status, refuses a plan with a body (:551-554) and unlinks it (:562). The plan's own ticket: is never compared with ref. Stories mode's case-twin guard is src/bmad_loop/stories.py:162-176. Source-derived: the inspected tickets source and engine contain no case-folded ticket-ID collision check; the direct TicketTree reproduction accepts these two refs. The full preflight and engine rollback route was not exercised.
Suggested fix
Not validated: refuse case-only twin ids in the tickets preflight, validate and run --dry-run, as stories mode does. Independently, have discard_unbuilt_plan refuse a plan whose ticket: does not name the ref.
- Ngôn ngữ chính
- Python
- Star
- 196
- Fork
- 78
- Merge trung bình
- 9 giờ 24 phút
- Pull request đã merge (30 ngày)
- 44
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bmad-code-org/bmad-loop
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bmad-code-org/bmad-loop#1063 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
psmux: task window name starting with '-' creates no window; session reads as crashedCó thể đã có người làm @RECOHA đã nhận 8 ngày trước. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
bmad-code-org/bmad-loop#1061 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
bmad-code-org/bmad-loop#1057 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
bmad-code-org/bmad-loop#973 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bmad-code-org/bmad-loop#965 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bmad-code-org/bmad-loop
Issue tương tự
-
Ubuntu for Debian DevelopersĐang mởDMB documentation good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ubuntu/ubuntu-project-docs#921 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
⏳ Pending feedback 🐛 Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jumpserver/jumpserver#18282 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/loom#2014 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
future-agi/future-agi#5274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 2 ngày