Skip to content

Add Clojure code #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 9, 2025
Merged

Conversation

bolivier
Copy link
Contributor

@bolivier bolivier commented Jun 4, 2025

This is still a work-in-progress, but I wanted to see if I could get a couple clarifications on what's blocking me. The tests are failing, but I can't quite figure it out.

When I run course-sdk test clojure the code hangs. I figured out where the syntax error is coming from and added a quick fix for that here. I'm not sure why the code times out when I run the tests through here, but it behaves as I'd expect locally when I run it.

Summary by CodeRabbit

  • New Features

    • Introduced a Clojure starter template and solution for building an HTTP server, including sample server code and entry point.
    • Added build automation scripts and configuration for compiling and running Clojure projects.
    • Provided shell scripts for compiling and executing the server locally and in the CodeCrafters environment.
  • Documentation

    • Added comprehensive README and explanation files to guide users through the challenge and setup process.
  • Chores

    • Included configuration files for dependency management, build tools, and environment setup.
    • Added .gitignore and .gitattributes files to optimize version control practices.

Copy link

coderabbitai bot commented Jun 4, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change introduces a complete Clojure starter and solution template for the "Build Your Own HTTP Server" challenge. It adds build scripts, configuration files, Docker support, documentation, and a simple TCP server implementation. The structure is mirrored across starter, compiled, and solution directories, enabling both local and CodeCrafters platform execution.

Changes

File(s) Change Summary
compiled_starters/clojure/.codecrafters/compile.sh, .../run.sh, .../your_program.sh Added shell scripts for compilation, execution, and local running of the Clojure project.
compiled_starters/clojure/.gitattributes, .../.gitignore Added Git configuration files for line ending normalization and ignoring build artifacts.
compiled_starters/clojure/README.md Added challenge overview and usage instructions in README.
compiled_starters/clojure/build.clj Added Clojure build automation script with clean and uber functions.
compiled_starters/clojure/codecrafters.yml Added configuration for debug logging and language version.
compiled_starters/clojure/deps.edn Added project dependencies and build alias.
compiled_starters/clojure/src/http_server/core.clj Added initial TCP server implementation and entry point.
dockerfiles/clojure-1.12.0.Dockerfile Added Dockerfile for Clojure environment setup and dependency installation.
solutions/clojure/01-at4/code/.codecrafters/compile.sh, .../run.sh, .../your_program.sh Added solution-specific scripts for compilation, running, and local execution.
solutions/clojure/01-at4/code/.gitattributes, .../.gitignore Added Git configuration for the solution directory.
solutions/clojure/01-at4/code/README.md, .../explanation.md Added documentation and instructions for the solution.
solutions/clojure/01-at4/code/build.clj Added build automation script for the solution.
solutions/clojure/01-at4/code/codecrafters.yml Added solution-specific configuration.
solutions/clojure/01-at4/code/deps.edn Added solution dependencies and build alias.
solutions/clojure/01-at4/code/src/http_server/core.clj Added solution TCP server implementation and entry point.
solutions/clojure/01-at4/diff/src/http_server/core.clj.diff Added diff file showing initial implementation for explanation purposes.
starter_templates/clojure/code/.codecrafters/compile.sh, .../run.sh Added starter template scripts for compilation and running.
starter_templates/clojure/code/.gitignore Added .gitignore for starter template code.
starter_templates/clojure/code/build.clj Added build script for starter template.
starter_templates/clojure/code/deps.edn Added dependencies and build alias for starter template.
starter_templates/clojure/code/src/http_server/core.clj Added starter TCP server implementation and entry point.
starter_templates/clojure/config.yml Added config specifying required executable and main user-editable file.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CompileScript
    participant BuildScript
    participant JavaRuntime

    User->>CompileScript: Run compile.sh
    CompileScript->>BuildScript: clj -T:build
    BuildScript->>BuildScript: clean, compile, uberjar
    BuildScript-->>CompileScript: Build complete

    User->>RunScript: Run run.sh
    RunScript->>JavaRuntime: java -jar target.jar [args]
    JavaRuntime->>JavaRuntime: Start http-server.core/-main
Loading

Poem

In fields of code where Clojure grows,
A server sprouts where data flows.
With scripts to build and jars to run,
The challenge starts, the work begun!
Git ignores the mess we make,
While rabbits cheer for each new stake.
Hop on, let's serve and bake! 🐇


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (4)
compiled_starters/clojure/.codecrafters/run.sh (1)

1-11: Duplicate run script.

This file is identical to other .codecrafters/run.sh scripts.

solutions/clojure/01-at4/code/.codecrafters/run.sh (1)

1-11: Duplicate run script.

This file matches the run script in both starter templates and compiled starters.

compiled_starters/clojure/src/http_server/core.clj (1)

1-24: Same issues as starter template version

This file is identical to starter_templates/clojure/code/src/http_server/core.clj and has the same issues: unused import, resource leaks, and incomplete connection handling that could cause test hangs.

compiled_starters/clojure/build.clj (1)

1-23: 🛠️ Refactor suggestion

Address code duplication between build scripts.

This file is identical to starter_templates/clojure/code/build.clj. Having duplicate build scripts creates maintenance overhead and increases the risk of inconsistencies.

Consider one of these approaches:

  1. Use symbolic links if the files should always be identical
  2. Extract common build logic to a shared location
  3. Use a build script generator if they need slight variations

The same technical issues from the starter template version also apply here:

  • Hard-coded temporary paths may not be portable
  • Missing error handling for build operations
  • Missing newline at end of file
  • Need to verify the http-server.core namespace exists and compiles correctly
🧹 Nitpick comments (12)
compiled_starters/clojure/deps.edn (1)

2-3: Consider including test and resource paths.
Currently only "src" is in :paths. If you plan to add tests or include resource files, consider adding "test" and/or "resources" here so they’re on the classpath.

solutions/clojure/01-at4/code/codecrafters.yml (1)

5-5: Verbose debug logs caution.
Having debug: true by default may flood CI output and obscure test failures. Consider defaulting it to false or making it configurable via an environment variable.

compiled_starters/clojure/.gitattributes (1)

1-1: Restrict line ending normalization.
Using * text=auto applies to all files, including binaries. Consider targeting only source files (e.g., *.clj text=auto) to avoid unintended conversions.

compiled_starters/clojure/codecrafters.yml (1)

5-5: Default debug mode caution.
Debug logs are enabled, which may overwhelm the test harness. Consider disabling by default or gating it behind an environment flag.

solutions/clojure/01-at4/explanation.md (1)

12-16: Specify language for fenced code block
Add a language identifier to satisfy Markdown lint rules for the shell snippet.

- ```
+ ```bash
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

12-12: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

solutions/clojure/01-at4/code/your_program.sh (1)

1-24: Add missing newline at end of file.

The script logic is correct and well-documented, but it's missing a newline at the end of the file which could cause issues with some tools.

Apply this diff to fix the formatting:

 exec java -jar /tmp/codecrafters-build-http-server-clojure/target.jar "$@"
+
starter_templates/clojure/code/src/http_server/core.clj (1)

3-3: Remove unused import

The clojure.java.io namespace is imported but never used in the code.

-  (:require
-   [clojure.java.io :as io])
compiled_starters/clojure/README.md (1)

7-7: Fix grammar: use "an" before vowel sound

The static analysis tool correctly identified a grammar issue.

-that is capable of serving multiple clients.
+protocol that powers the web. In this challenge, you'll build an HTTP/1.1 server
🧰 Tools
🪛 LanguageTool

[misspelling] ~7-~7: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...he web. In this challenge, you'll build a HTTP/1.1 server that is capable of serv...

(EN_A_VS_AN)

solutions/clojure/01-at4/code/README.md (1)

7-7: Minor grammar fix: Use "an" before vowel sounds.

Replace "a HTTP" with "an HTTP" for correct grammar.

-protocol that powers the web. In this challenge, you'll build a HTTP/1.1 server
+protocol that powers the web. In this challenge, you'll build an HTTP/1.1 server
🧰 Tools
🪛 LanguageTool

[misspelling] ~7-~7: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...he web. In this challenge, you'll build a HTTP/1.1 server that is capable of serv...

(EN_A_VS_AN)

starter_templates/clojure/code/build.clj (3)

5-8: Consider making build paths configurable.

The hard-coded temporary paths may not be portable across different operating systems or environments. Consider using system properties or environment variables for better portability.

-(def class-dir "/tmp/codecrafters-build-http-server-clojure/classes")
-(def uber-file "/tmp/codecrafters-build-http-server-clojure/target.jar")
+(def build-dir (or (System/getProperty "codecrafters.build.dir") 
+                   (str (System/getProperty "java.io.tmpdir") "/codecrafters-build-http-server-clojure")))
+(def class-dir (str build-dir "/classes"))
+(def uber-file (str build-dir "/target.jar"))

10-11: Add error handling for clean operation.

The clean function should handle cases where the directory doesn't exist or deletion fails to provide clearer error messages during the build process.

 (defn clean [_]
-  (b/delete {:path "/tmp/codecrafters-build-http-server-clojure"}))
+  (try
+    (b/delete {:path "/tmp/codecrafters-build-http-server-clojure"})
+    (catch Exception e
+      (println "Warning: Could not clean build directory:" (.getMessage e)))))

23-23: Add missing newline at end of file.

The file is missing a newline character at the end, which can cause issues with some tools and is considered best practice.

            :main 'http-server.core}))
+
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93588f6 and 433be48.

📒 Files selected for processing (30)
  • compiled_starters/clojure/.codecrafters/compile.sh (1 hunks)
  • compiled_starters/clojure/.codecrafters/run.sh (1 hunks)
  • compiled_starters/clojure/.gitattributes (1 hunks)
  • compiled_starters/clojure/.gitignore (1 hunks)
  • compiled_starters/clojure/README.md (1 hunks)
  • compiled_starters/clojure/build.clj (1 hunks)
  • compiled_starters/clojure/codecrafters.yml (1 hunks)
  • compiled_starters/clojure/deps.edn (1 hunks)
  • compiled_starters/clojure/src/http_server/core.clj (1 hunks)
  • compiled_starters/clojure/your_program.sh (1 hunks)
  • dockerfiles/clojure-1.12.0.Dockerfile (1 hunks)
  • solutions/clojure/01-at4/code/.codecrafters/compile.sh (1 hunks)
  • solutions/clojure/01-at4/code/.codecrafters/run.sh (1 hunks)
  • solutions/clojure/01-at4/code/.gitattributes (1 hunks)
  • solutions/clojure/01-at4/code/.gitignore (1 hunks)
  • solutions/clojure/01-at4/code/README.md (1 hunks)
  • solutions/clojure/01-at4/code/build.clj (1 hunks)
  • solutions/clojure/01-at4/code/codecrafters.yml (1 hunks)
  • solutions/clojure/01-at4/code/deps.edn (1 hunks)
  • solutions/clojure/01-at4/code/src/http_server/core.clj (1 hunks)
  • solutions/clojure/01-at4/code/your_program.sh (1 hunks)
  • solutions/clojure/01-at4/diff/src/http_server/core.clj.diff (1 hunks)
  • solutions/clojure/01-at4/explanation.md (1 hunks)
  • starter_templates/clojure/code/.codecrafters/compile.sh (1 hunks)
  • starter_templates/clojure/code/.codecrafters/run.sh (1 hunks)
  • starter_templates/clojure/code/.gitignore (1 hunks)
  • starter_templates/clojure/code/build.clj (1 hunks)
  • starter_templates/clojure/code/deps.edn (1 hunks)
  • starter_templates/clojure/code/src/http_server/core.clj (1 hunks)
  • starter_templates/clojure/config.yml (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
solutions/clojure/01-at4/explanation.md

12-12: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🪛 LanguageTool
solutions/clojure/01-at4/code/README.md

[misspelling] ~7-~7: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...he web. In this challenge, you'll build a HTTP/1.1 server that is capable of serv...

(EN_A_VS_AN)

compiled_starters/clojure/README.md

[misspelling] ~7-~7: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...he web. In this challenge, you'll build a HTTP/1.1 server that is capable of serv...

(EN_A_VS_AN)

🪛 Hadolint (2.12.0)
dockerfiles/clojure-1.12.0.Dockerfile

[error] 10-10: invalid flag: --exclude

(DL1000)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test_course_definition / test (clojure)
🔇 Additional comments (22)
solutions/clojure/01-at4/code/.gitattributes (1)

1-1: Correct .gitattributes to normalize line endings.

Applying * text=auto ensures consistent EOL handling across platforms in this subtree.

compiled_starters/clojure/deps.edn (2)

5-7: Dependencies pinned correctly.
You’ve specified Clojure 1.12.0 and tools.cli 1.1.230. These look good. If you anticipate needing logging or other utility libs, now is a good time to add them.


10-13: Validate build alias configuration.
The :build alias points to build/uber. Please confirm that compiled_starters/clojure/build.clj defines a build namespace with an uber function matching this alias.

solutions/clojure/01-at4/code/codecrafters.yml (1)

11-11: Ensure Clojure version consistency.
The language_pack: clojure-1.12.0 aligns with your deps.edn version—nice consistency.

starter_templates/clojure/config.yml (1)

1-3: Template configuration looks correct.
required_executable: clj and user_editable_file: src/http_server/core.clj match the expected Clojure starter layout.

compiled_starters/clojure/codecrafters.yml (1)

11-11: Language pack alignment confirmed.
language_pack: clojure-1.12.0 is consistent with your build configuration.

starter_templates/clojure/code/.codecrafters/compile.sh (1)

1-12: Compilation script looks correct
The script properly exits on failure and invokes the :build alias as expected. Ensure build.clj defines build/uber to match this alias.

starter_templates/clojure/code/deps.edn (1)

1-16: Valid deps.edn configuration
The source paths, dependencies, and :build alias are correctly defined for building the uberjar.

solutions/clojure/01-at4/code/.codecrafters/compile.sh (1)

1-12: Compilation script looks correct
Matches the starter template’s compile step and correctly runs the build alias.

solutions/clojure/01-at4/code/deps.edn (1)

1-16: Valid deps.edn configuration
Dependencies and the :build alias are properly set up for the solution project.

compiled_starters/clojure/.codecrafters/compile.sh (1)

1-11: Compile script is solid.

It correctly invokes the Clojure build alias and exits on any failure.

starter_templates/clojure/code/.codecrafters/run.sh (1)

1-11: Run script invocation is correct.

The script uses exec to forward signals and passes through arguments properly.

dockerfiles/clojure-1.12.0.Dockerfile (1)

10-10: 🛠️ Refactor suggestion

⚠️ Potential issue

Invalid Dockerfile COPY flags.

Using COPY --exclude triggers syntax errors under standard Docker builds (Hadolint DL1000). Exclusions should be handled via a .dockerignore file instead of inline flags.

Proposed fix:

-COPY --exclude=.git --exclude=README.md . /app
+COPY . /app

And add a .dockerignore at the project root:

.git
README.md
⛔ Skipped due to learnings
Learnt from: SughiY
PR: codecrafters-io/build-your-own-http-server#112
File: dockerfiles/clojure-1.12.Dockerfile:10-10
Timestamp: 2025-02-17T19:29:27.993Z
Learning: The `--exclude` flag in COPY commands is supported in Dockerfile syntax 1.7-labs and should be retained for optimizing layer caching, despite static analysis tools like Hadolint flagging it as an error.
🧰 Tools
🪛 Hadolint (2.12.0)

[error] 10-10: invalid flag: --exclude

(DL1000)

solutions/clojure/01-at4/code/.gitignore (1)

1-15: LGTM! Comprehensive Clojure .gitignore patterns.

The .gitignore file correctly covers all standard Clojure build artifacts, Leiningen files, and deps.edn cache directories.

compiled_starters/clojure/.gitignore (1)

1-15: LGTM! Consistent .gitignore patterns.

The .gitignore file maintains consistency with the solutions directory and includes all necessary Clojure build artifacts.

starter_templates/clojure/code/.gitignore (1)

1-15: LGTM! Comprehensive Clojure .gitignore

The .gitignore entries appropriately cover all common Clojure build artifacts, tooling files, and dependency caches. This follows standard practices for Clojure projects.

starter_templates/clojure/code/src/http_server/core.clj (1)

18-19: LGTM! Correct binding syntax for debug output

The (binding [*out* *err*] ...) syntax is correct and properly handles redirecting stdout to stderr for debugging. This is not the source of your syntax error issue.

compiled_starters/clojure/README.md (1)

1-39: Well-structured documentation

The README provides clear instructions for the HTTP server challenge, including setup steps and submission process. The content is comprehensive and user-friendly.

🧰 Tools
🪛 LanguageTool

[misspelling] ~7-~7: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...he web. In this challenge, you'll build a HTTP/1.1 server that is capable of serv...

(EN_A_VS_AN)

compiled_starters/clojure/your_program.sh (1)

1-24: LGTM: Well-structured shell script.

The script follows best practices with proper error handling, directory context management, and clear separation between local and remote execution paths.

solutions/clojure/01-at4/code/build.clj (1)

1-22: LGTM: Well-structured build configuration.

The build script properly uses clojure.tools.build.api with appropriate clean and uber functions. The configuration correctly specifies the main namespace and output paths.

starter_templates/clojure/code/build.clj (2)

1-3: LGTM: Standard Clojure build namespace setup.

The namespace declaration and imports are correctly structured for a build script.


13-22:

✅ Verification successful

Verify namespace compilation target exists.

The build script compiles http-server.core namespace. Ensure this namespace exists and is properly structured, as compilation errors here could contribute to the hanging test issues mentioned in the PR.


🏁 Script executed:

#!/bin/bash
# Description: Verify the http-server.core namespace exists and check for syntax errors
# Expected: Find the core.clj file and check for basic syntax issues

# Search for the core namespace file
fd -t f "core.clj" --exec grep -l "ns.*http-server.core"

# Check for common Clojure syntax issues in core files
fd -t f "core.clj" --exec clj -M -e "(require 'clojure.spec.alpha) (clojure.spec.alpha/valid? ::clojure.core.specs.alpha/ns-form (read-string (slurp \"{}\")))"

Length of output: 587


🏁 Script executed:

#!/bin/bash
# Verify the namespace declaration in the starter template core.clj

# Check for the ns declaration of http-server.core
grep -R "ns\s\+http-server\.core" starter_templates/clojure/code/src/http_server/core.clj

# Show the first 10 lines of the file to confirm structure
sed -n '1,10p' starter_templates/clojure/code/src/http_server/core.clj

Length of output: 333


Namespace http-server.core Verified

The http-server.core namespace is defined in starter_templates/clojure/code/src/http_server/core.clj and follows the correct structure:

(ns http-server.core
  (:require
   [clojure.java.io :as io])
  (:import
   [java.net ServerSocket])
  (:gen-class))

No further changes are needed here.

@bolivier
Copy link
Contributor Author

bolivier commented Jun 6, 2025

I don't totally understand how course-sdk test clojure is supposed to work for the initial stage.

As is, the code works when run from solutions, and it works when I apply this patch, but it doesn't work with the call to serve commented out and I don't understand why.

diff --git a/starter_templates/clojure/code/src/http_server/core.clj b/starter_templates/clojure/code/src/http_server/core.clj
index 3129ce6..7de61aa 100644
--- a/starter_templates/clojure/code/src/http_server/core.clj
+++ b/starter_templates/clojure/code/src/http_server/core.clj
@@ -25,6 +25,7 @@
 
 
   ;; Uncomment this block to pass the first stage
-  ;;(serve)
+  ;; (println "uncommented")
+  (serve)
 
   )

@andy1li Am I missing context for how this needs to be run?

@andy1li
Copy link
Member

andy1li commented Jun 6, 2025

Does this not work? 🤔

image
  • course-sdk test clojure is supposed to be run at the root of the repo.

  • course-sdk

    1. will assert that the commented-out code does not work as is.
    2. will uncomment it, and assert that it will work.
  • You only need to modify starter_templates/clojure/, then course-sdk will put the uncommented version into solution automatically.

@bolivier
Copy link
Contributor Author

bolivier commented Jun 6, 2025

It consistently fails like this:
image

The code in solution has the line (serve) uncommented and looking correct.

The odd thing is if I uncomment it by hand in the starter template, the test passes.

@andy1li
Copy link
Member

andy1li commented Jun 6, 2025

Just ran course-sdk test clojure locally against your branch, and it passed all tests.

Perhaps you're running an older and customized version of course-sdk? We recently pushed a few changes to fully support Clojure.

Mind upgrading your course-sdk and trying gain?

@bolivier
Copy link
Contributor Author

bolivier commented Jun 6, 2025

That's possible. I'll double check.

I've had a few weird issues that I think might also be related to Bun and/or Docker versions. Can you check which versions you're using slash point me to where the correct versions might be listed?

@andy1li
Copy link
Member

andy1li commented Jun 6, 2025

Just checked, our recent changes to course-sdk were related to Odin, not Clojure. Sorry!


Oh, we did pin bun version a few months ago due to some weird issues:

https://github.com/codecrafters-io/course-sdk/blob/335ecca35e9f6adb50f1bca854b12ce331039c46/.github/workflows/test-course-definition.yml#L227


My local versions:

image

@bolivier
Copy link
Contributor Author

bolivier commented Jun 6, 2025

Hmm, I'm a major version ahead on Docker, that could be the issue. The others are fine.

@bolivier
Copy link
Contributor Author

bolivier commented Jun 6, 2025

@andy1li I grabbed that version of Docker and it's still failing for me. If it's working on the server/your machine, that's great news though 😅

@andy1li
Copy link
Member

andy1li commented Jun 7, 2025

Let me know when this PR is out of the WIP status.

@bolivier
Copy link
Contributor Author

bolivier commented Jun 7, 2025

@andy1li A decision needs to be made on how to handle stderr/stdout in the starter template here.

I think it's fine as is, but it could be confusing for people new to Clojure. I'm not sure there's an easy way around that for general case printing to stderr.

I tracked down what causes some of that awkwardness and have a couple suggestions in an course-sdk issue

@bolivier
Copy link
Contributor Author

bolivier commented Jun 7, 2025

I suspect it's failing for me because of timing issues. I suspect needing to download all the deps plus jvm startup time puts it past the timeout.

@bolivier
Copy link
Contributor Author

bolivier commented Jun 9, 2025

@andy1li this all looks good to me. If you're happy with it, we can merge away.

Copy link
Member

@andy1li andy1li left a comment

Choose a reason for hiding this comment

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

Left a note.

@andy1li andy1li merged commit cedf956 into codecrafters-io:main Jun 9, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants