Inline test runner#1
Conversation
| RUN apt-get update && apt-get install -y curl wget jq tar git docker.io | ||
|
|
||
| # Install Go | ||
| RUN wget https://go.dev/dl/go1.25.0.linux-amd64.tar.gz -O /tmp/go.tar.gz && \ |
There was a problem hiding this comment.
Bug: Go Version Format Breaks Docker Builds
The Dockerfile attempts to download go1.25.0.linux-amd64.tar.gz, but Go releases don't use .0 for the initial minor version release. The correct URL should be go1.25.linux-amd64.tar.gz (without the .0). This will cause the download to fail with a 404 error during the Docker build.
|
|
||
| # A depot project & token | ||
| DEPOT_PROJECT="jlmt2zdb5m" # test-runner-ci | ||
| DEPOT_TOKEN="depot_project_e252ea64749beae1c983d2f95c952c892cb211c3a0e4aff1fe9ceb5bd14fc0a5" |
There was a problem hiding this comment.
Bug: Sensitive Data in Example Environment
The .env.example file contains what appear to be real credentials including FLY_ACCESS_TOKEN and DEPOT_TOKEN with actual token values. Example environment files should contain placeholder values, not real secrets. These credentials should be removed and replaced with dummy placeholders like "your-token-here".
| prefixedWriter.Write([]byte("\033[31mBuild failed. Check the logs above for the reason.\033[0m\n")) | ||
| prefixedWriter.Write([]byte("\033[31mIf you think this is a CodeCrafters error, please contact us at hello@codecrafters.io.\033[0m\n")) | ||
| userLogsSink.Write([]byte("\n")) | ||
| return exitError.ExitCode() == 0, nil |
There was a problem hiding this comment.
Bug: Always False Exit Code Condition
The condition exitError.ExitCode() == 0 will always be false because ExitError is only returned when a command exits with a non-zero status. The check is redundant and confusing - the code should just return false, nil directly instead of checking an exit code that will never be zero in this context.
| - name: Install logstream | ||
| run: | | ||
| curl -L https://github.com/codecrafters-io/logstream/releases/download/v0.2.2/v0.2.2_linux_amd64 -o /usr/local/bin/logstream | ||
| chmod +x /usr/local/bin/logstream |
There was a problem hiding this comment.
| } | ||
|
|
||
| func (b *TestRunnerBuild) ReadLogsFromFile() ([]byte, error) { | ||
| b.logsFile.Seek(0, 0) |
There was a problem hiding this comment.
Bug: Data Integrity Compromised by Ignored Errors
The Seek method returns an error that's being ignored. If seeking to the beginning of the logs file fails, ReadLogsFromFile will read from the current file position instead of the start, potentially returning incomplete or incorrect logs that get sent to the backend.
| // Create a context with timeout | ||
| ctx, cancel := context.WithTimeout(context.Background(), command.timeout) | ||
| defer cancel() | ||
|
|
There was a problem hiding this comment.
Bug: Context Leaks from Deferred Loop Cancellations
The defer cancel() is called inside a loop, causing all cancel functions to accumulate and only execute when the function returns rather than after each iteration. This creates context leaks where contexts remain active longer than necessary, potentially holding resources until all commands complete instead of releasing them after each command finishes.
Note
Introduces a Go-based test-runner builder, updates Dockerfile to build/use it and download test-runner v0.3.71, and adds a CI workflow plus a Ruby-based local test harness.
builder/module with commandBuildImageCommandto build/push images via Depot, stream logs, finalize builds, and handle errors./services/test_runner/*), build log processor, repo commit switching, buildpack detection, globals, and Sentry init.TestRunnerBuildlogging (Logstream + file) and main entrypoint./var/opt/test-runner-builderfrombuilder/and verifies--version.v0.3.71and verifies binary..github/workflows/test.ymlto run fixtures setup and tests on PRs andmain.Written by Cursor Bugbot for commit d015d37. This will update automatically on new commits. Configure here.