Set unpublishable: true on PublishedChange by construction to simplify handleMaxRevs predicate
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu với các constructor PublishedChange và PublishedNextChange trong changes.js, sau đó kiểm tra predicate lastChannelEditIndex trong serverSync.js. Cập nhật các constructor và loại bỏ điều kiện kiểu dư thừa, rồi chạy các bài kiểm thử PublishedChange hiện có trong changes.spec.js và xác minh rằng unpublished_changes vẫn chính xác sau một sự kiện publish.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Current behavior
In serverSync.js, handleMaxRevs uses findLastIndex to compute two values for deciding whether to set unpublished_changes = true on a channel:
lastChannelEditIndex— the last publishable change, filtered (among other conditions) withc.type !== CHANGE_TYPES.PUBLISHEDlastPublishIndex— the last publish change, matched withc.type === CHANGE_TYPES.PUBLISHED
The predicate for lastChannelEditIndex already includes !c.unpublishable, making the explicit c.type !== CHANGE_TYPES.PUBLISHED check partially redundant: if PublishedChange always set unpublishable: true, the type check would be unnecessary.
Desired behavior
PublishedChange and PublishedNextChange set unpublishable: true by construction (in its constructor in changes.js), so the c.type !== CHANGE_TYPES.PUBLISHED guard in handleMaxRevs can be removed. The !c.unpublishable check alone is sufficient to exclude publish changes from lastChannelEditIndex.
This makes the semantics self-contained in the change object — callers don't need to know the type mapping — and reduces the risk of future change types being accidentally treated as publishable.
Acceptance Criteria
-
PublishedChangeconstructor inchanges.jssetsunpublishable: trueunconditionally - The
c.type !== CHANGE_TYPES.PUBLISHEDcondition is removed from thelastChannelEditIndexpredicate inhandleMaxRevs(serverSync.js) - Existing tests for
PublishedChangeinchanges.spec.jspass (updated if needed to assertunpublishable: true) -
unpublished_changescontinues to be set correctly after a publish event (no regression)
References
Follow-up to https://github.com/learningequality/studio/pull/5844#discussion_r3125011603
AI usage
This issue was drafted with Claude Code assistance from session context and code review.
- Ngôn ngữ chính
- Python
- Star
- 212
- Fork
- 314
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 57
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không 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 learningequality/studio
-
TAG: tech update / debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
learningequality/studio#2245 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Remove slideshow supportĐang mởDEV: backend
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
learningequality/studio#6353 · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
learningequality/studio#6352 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend DEV: frontend
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
learningequality/studio#6351 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
learningequality/studio#6350 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của learningequality/studio
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
521xueweihan/HelloGitHub#4150 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
aws-samples/sample-per-model-bedrock#595 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug connectors
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
pyinfra-dev/pyinfra#2036 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày