fix(classroom): mine=1 の shared list が空 ExpressionAttributeNames で 500#1090
Merged
smalruby3-editor-bot[bot] merged 1 commit intoJul 18, 2026
Conversation
…list DynamoDB rejects an empty ExpressionAttributeNames map, so GET /shared-assignments?mine=1 (自分の投稿タグ) always returned 500 when no attribute filters were set — the query needs no #status alias in mine mode. Build the map first and spread the key in only when non-empty (same pattern as the group update at handler.ts:2591). Found during PR #1080 review on prod (2026-07-18). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
smalruby3-editor-bot
Bot
merged commit Jul 18, 2026
70b77b4
into
feature/assignment-sharing
13 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #1080 のレビュー中に発見された prod の 500 を修正します。
症状: クラス一覧 > 課題一覧 > みんなの課題からさがす > 「自分の投稿」タグ →
GET /shared-assignments?mine=1が 500 (Internal Server Error)。投稿の有無に関係なくmine=1は常に失敗していました。原因: CloudWatch (prod
ClassroomHandler) にValidationException: ExpressionAttributeNames must not be empty。mine=1では KeyCondition がauthorSub = :pkで#statusエイリアスが不要なため、属性フィルタ未指定だとExpressionAttributeNamesが空オブジェクト{}になり、DynamoDB が Query を拒否していました。修正: マップを先に組み立て、非空のときだけキーを spread する(
handler.tsの group update と同じパターン)。Changes Made
infra/smalruby-classroom/lambda/handler.ts—handleListSharedAssignmentsで空のExpressionAttributeNamesを省略infra/smalruby-classroom/lambda/tests/handler-shared-assignments.test.ts— mine=1 のテストに「names が undefined であること」のアサーションを追加(モックは実 DynamoDB の空マップ拒否を再現しないため、明示的にピン留め)Pattern audit
ExpressionAttributeNamesを動的に組み立てる他の箇所(classroom update / submission update / group update / shared update)はすべて最低 1 要素を必ず持つ("No fields to update" ガードあり)か、既に条件付き spread 済み(handler.ts:2591)で、同バグはこの 1 箇所のみ。Test Coverage
npx jest lambda/tests/handler-shared-assignments.test.ts— 25 passed(修正前は追加アサーションが RED)npx tsc --noEmit— cleanRelated Issues
EPIC #1066 / PR #1080(レビュー中の topic ブランチへの fixup)
🤖 Generated with Claude Code