Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions app/diff_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# - Total diff: max 20,000 lines or 1 MB of raw data
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test comment from 422 reproduction script.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test comment from 422 reproduction script.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test comment from 422 reproduction script.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test comment from 422 reproduction script.

# - Per-file diff: max 20,000 lines or 500 KB of raw data
# - Files in diff: max 300 files
#
# ┌─────────────┬─────────────────────────┬────────────────────────┬────────────────────────────────────┐
# │ Method │ File limit │ Size limit │ On overflow │
# ├─────────────┼─────────────────────────┼────────────────────────┼────────────────────────────────────┤
# │ Raw diff │ 300 files │ 20k lines / 1 MB total │ HTTP 406 │
# ├─────────────┼─────────────────────────┼────────────────────────┼────────────────────────────────────┤
# │ get_files() │ 3,000 files (paginated) │ N/A (no total limit) │ patch field missing on large files │
# └─────────────┴─────────────────────────┴────────────────────────┴────────────────────────────────────┘
#
# In this case we want to test:
# - 1 file (very large file) that the patch will be missing from being too large
# - More lines than raw diff will allow
#
# Expected result: raw diff fails with 406 code but get_files() returns all patches except for 1

for i in range(300):
with open(f"z_changed_file_{i}.txt", "w") as fd:
for j in range(100):
fd.write(f"added line {j + 1}\n")

with open("very_large_file.txt", "w") as fd:
for i in range(2_001):
fd.write(f"added line {i + 1}\n")
Loading
Loading