Repository navigation
Send file contents directly when counting lines of code - #13106
Merged
Merged
Conversation
Iteration::CountLinesOfCode no longer copies the submission's files to EFS. It posts each valid file's content to the counter as JSON instead. Files that aren't valid UTF-8 are left out of the request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The counter sits behind an ALB that rejects bodies over 1 MB with a 413, so the command now returns without calling it if the body is too big. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Currently, counting an iteration's lines of code copies its files to EFS, posts their paths to the lines-of-code counter, and then deletes them from EFS. This PR makes
Iteration::CountLinesOfCodepost the file contents instead:{"track_slug": "ruby", "files": {"lib/bob.rb": "<file content as a UTF-8 string>"}}The response format is the same, and the retry on 502, 503 and 504 is unchanged. The EFS upload, the EFS delete and the
job_dirandefs_dirhelpers are removed from this command. Other tooling jobs still use EFS.If a file's content isn't valid UTF-8, it can't be sent as a JSON string, and
Submission::File#contentwould return the placeholder "[Invalid Unicode]", which the counter would count as a line of code. This command leaves such files out of the request. If no valid UTF-8 files remain, it doesn't call the counter, which matches how it already behaves for a submission with no valid files.The counter runs as a Lambda behind an ALB, which rejects request bodies over 1 MB with a 413. If the JSON body is over
MAX_BODY_BYTES(1,000,000 bytes), the command returns without calling the counter or settingnum_loc, as it does when there are no valid files. Other errors, such as a 400, still raise.Do not merge until the counter change is deployed. The counter (
exercism/lines-of-code-counter) is getting a PR that accepts both the old and the new format. This PR must only be merged after that has been deployed, or the counter will reject the new requests.Tests:
bin/rails test test/commands/iteration/count_lines_of_code_test.rb(13 runs, 0 failures).🤖 Generated with Claude Code