From 46e6d94edb3780be07d0a91ef24e10d504578f7a Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 18 Jul 2026 23:38:16 +0900 Subject: [PATCH] #399 --- AGENTS.md | 28 +++++++++++++++++-- frontend/src/lib/postNewQueryState.test.ts | 8 +++--- frontend/src/lib/postNewQueryState.ts | 2 +- .../pages/posts/PostImportSourcePage.test.tsx | 2 +- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 17e380a..1b27081 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -574,8 +574,32 @@ and layout reuse, follow `frontend/AGENTS.md`. wording and placement before implementing it. - Do not invent replacement copy when removing unrequested wording. - Do not create, modify, or run tests unless the user explicitly asks for - test work. When the user asks for tests, keep working and rerun them until - they pass or the remaining failure is clearly blocked. + test work. When the user asks for tests, keep working within the permitted + test-file scope and rerun them until they pass or the remaining failure is + clearly blocked. +- Test-only work includes adding, updating, deleting, reorganising, or fixing + SyntaxError in tests. During test-only work, do not modify production code. +- During test-only work, do not change production constants, behaviour, API + contracts, validation, routes, authentication, permissions, UI, copy, + dependencies, limits, thresholds, defaults, migrations, schema, or + environment settings to satisfy tests. +- Do not make production code match failing tests, mock assumptions, fixtures, + snapshots, old expectations, or stale setup. This includes changing + production constants merely because a test expects a different value. +- If test work reveals a production bug, spec mismatch, or missing behaviour, + stop without modifying production code and report: the failing test or + discovered issue, the related production file, the actual behaviour, the + expected behaviour, and why a production change appears necessary. +- Modify production code for test failures only when the user explicitly asks + for that production change. Do not expand a test task into a production task + on your own authority. +- If the user explicitly asks for both production implementation and test + updates, implement production code to the confirmed specification first, + then add or update tests to verify that specification. Never roll production + behaviour back to satisfy old tests. +- If it is unclear whether the test or the production implementation is stale, + or a test cannot be corrected without changing production code, ask the user + instead of guessing. ## Backend rules diff --git a/frontend/src/lib/postNewQueryState.test.ts b/frontend/src/lib/postNewQueryState.test.ts index 99dec3e..720dc73 100644 --- a/frontend/src/lib/postNewQueryState.test.ts +++ b/frontend/src/lib/postNewQueryState.test.ts @@ -29,15 +29,15 @@ describe ('post new review URL state', () => { .toEqual (['one', 'two']) }) - it ('allows at most a 4095-byte request target', () => { + it ('allows at most a 6 143 byte request target', () => { const baseUrl = 'https://example.com/' const baseLength = postNewReviewPathByteLength ([baseUrl]) - const allowed = `${ baseUrl }${ 'a'.repeat (4_095 - baseLength) }` + const allowed = `${ baseUrl }${ 'a'.repeat (6_143 - baseLength) }` const denied = `${ allowed }a` - expect (postNewReviewPathByteLength ([allowed])).toBe (4_095) + expect (postNewReviewPathByteLength ([allowed])).toBe (6_143) expect (isPostNewReviewPathWithinLimit ([allowed])).toBe (true) - expect (postNewReviewPathByteLength ([denied])).toBe (4_096) + expect (postNewReviewPathByteLength ([denied])).toBe (6_144) expect (isPostNewReviewPathWithinLimit ([denied])).toBe (false) }) }) diff --git a/frontend/src/lib/postNewQueryState.ts b/frontend/src/lib/postNewQueryState.ts index cf55fd3..86bcb4e 100644 --- a/frontend/src/lib/postNewQueryState.ts +++ b/frontend/src/lib/postNewQueryState.ts @@ -1,5 +1,5 @@ const POST_NEW_REVIEW_PATH_PREFIX = '/posts/new?urls=' -const MAX_POST_NEW_REVIEW_TARGET_BYTES = 4_096 +const MAX_POST_NEW_REVIEW_TARGET_BYTES = 6_144 const textEncoder = new TextEncoder () diff --git a/frontend/src/pages/posts/PostImportSourcePage.test.tsx b/frontend/src/pages/posts/PostImportSourcePage.test.tsx index c2d3687..6e28d94 100644 --- a/frontend/src/pages/posts/PostImportSourcePage.test.tsx +++ b/frontend/src/pages/posts/PostImportSourcePage.test.tsx @@ -60,7 +60,7 @@ describe ('PostImportSourcePage', () => { const input = screen.getByRole ('textbox', { name: '' }) fireEvent.change (input, { - target: { value: `https://example.com/${ 'a'.repeat (4_100) }` } }) + target: { value: `https://example.com/${ 'a'.repeat (6_200) }` } }) expect (screen.getByRole ('button', { name: '次へ' })).toBeDisabled () })