STDLIB.md: handle_key documented as returning 1/0; it returns true/false, so a test written from the doc raises on == 1

Đã đóng Phù hợp với người mới
#2,289 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 1 ngày

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

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
85/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, python
Lĩnh vực
documentation

Hướng nghiên cứu

Đoạn văn lỗi thời nằm trong docs/STDLIB.md quanh dòng 880, ở đoạn về handle_key, ghi rằng hàm trả về 1 hoặc 0. Hãy đọc lib/ui.eigs (dòng 606-627) để xác nhận hàm trả về true/false, sau đó kiểm tra dòng bảng gần dòng 2246, dòng này đã đúng. Công việc hoàn tất khi đoạn văn ghi true/false, bash tools/docs_claims_check.sh chạy thành công và python3 tests/test_doc_examples.py docs/STDLIB.md chạy thành công.

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

Mô tả

area:docs area:stdlib found-by:duet-audit kind:docs-drift status:claimed

Found by audit area 11 (do doc examples run), read-only, against main b367cd7.

docs/STDLIB.md:877-881 says handle_key of [root, ev] "returns 1 when the toolkit consumed the key, 0 when it is free for the app". The function returns booleans: lib/ui.eigs:606-627 has return true / return false on every path, and its tail call _handle_focus_key (lib/ui_focus.eigs:58) also returns true/false.

Why it matters: the paragraph is written for headless tests ("a headless test drives keys exactly like mouse"), and the natural test assertion follows the doc:

consumed is true
print of (consumed == 1)
$ ./src/eigenscript repro.eigs
Error repro.eigs:2: cannot compare bool and num with '=='

So a test written from the doc dies instead of asserting. The table row at docs/STDLIB.md:2246 ("report whether a key was consumed") is correct; only the prose is stale. A search of docs/STDLIB.md, docs/BUILTINS.md, docs/llms.txt, docs/SYNTAX.md, README.md and AGENTS.md for other predicates documented as 1/0 found only this one and docs/SYNTAX.md:407 (filed with the SYNTAX.md issue). task_detach's documented 1/0 (docs/BUILTINS.md:920) matches what it returns.

Blind spot: I did not drive handle_key itself with a real root and event; the return values come from reading lib/ui.eigs, and the error comes from running the comparison.

Done when

  • docs/STDLIB.md:880 says handle_key returns true when the toolkit consumed the key and false when it is free for the app.
  • bash tools/docs_claims_check.sh and python3 tests/test_doc_examples.py docs/STDLIB.md pass.

— Duet (orchestrator)


Generated by Claude Code

Ngôn ngữ chính
C
Star
3
Fork
7
Merge trung bình
6 giờ 26 phút
Pull request đã merge (30 ngày)
318

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.

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 InauguralSystems/EigenScript

Tất cả issue của InauguralSystems/EigenScript

Issue tương tự

Thêm issue về C

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.