Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

BUG: within word punctuation insertion can never land at the last two positions of the prompt

Đang mở Phù hợp với người mới
#3,565 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu bằng cách đọc InsertPunctuationConverter._insert_within_words và docstring của nó, sau đó xem các bài kiểm thử của InsertPunctuationConverter. Tái hiện hành vi được báo cáo với prompt gồm ba ký tự abc và các seed từ 0 đến 299. Hoàn thành khi có thể đạt đến mọi vị trí chèn, bao gồm ngay trước ký tự cuối cùng và sau ký tự cuối cùng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

InsertPunctuationConverter._insert_within_words samples insertion indices from range(len(prompt_list) minus 1), so for a prompt of n characters only positions 0 through n minus 2 are ever chosen. Of the n plus 1 possible insertion points, a punctuation mark can never land immediately before the last character or after the final character, no matter the seed.

For the three character prompt abc, 300 different seeds produce only prefixes at offsets 0 and 1: outputs like ab!c or abc! are unreachable, while the method docstring says punctuation is inserted at any indices in the prompt.

Expected Behavior

Every insertion point of the prompt, before the first character through after the last, should be reachable.

Reproduction Steps

  1. Run InsertPunctuationConverter(between_words=False, word_swap_ratio=1.0, seed=s).convert_async(prompt="abc", ...) for seeds 0 through 299.
  2. Collect the offset of the inserted punctuation.
  3. Only offsets 0 and 1 ever appear on main.

Minimal Reproduction

offsets = set()
for seed in range(300):
    out = await InsertPunctuationConverter(between_words=False, word_swap_ratio=1.0, seed=seed).convert_async(prompt="abc", input_type="text")
    offsets |= {i for i, ch in enumerate(out.output_text) if not ch.isalnum()}
# {0, 1} on main

Environment

PyRIT main. Python 3.11.

Ngôn ngữ chính
Python
Star
4.7k
Fork
980
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
422

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/PyRIT

Tất cả issue của microsoft/PyRIT

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.