Skip to content

Feat: add server and clean some things#156

Merged
Zatiji merged 22 commits into
mainfrom
feat/add_server
Jul 2, 2026
Merged

Feat: add server and clean some things#156
Zatiji merged 22 commits into
mainfrom
feat/add_server

Conversation

@Zatiji

@Zatiji Zatiji commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Changes :

  • Add server module in tracel-app
  • Delete tracel-macro crate
  • Rename all GitHub URLs leading to Tracel products
  • Add tests to JobRegister and fragment its logic
  • Refactor tracel-app errors to be more organized
  • Add examples for a dry-run and a server use-case

How the Server module works

The Server exposes registered jobs as POST endpoints at /{job_name}. When a request arrives, it follows a two-phase flow:

  1. Validate synchronously: the JSON body is deserialized and validated via the JobRegister. If the job name is unknown → 404; if the body is invalid → 400.
  2. Run asynchronously: once validated, the job is spawned on a blocking thread (spawn_blocking), and the server immediately returns 200 with the message "Job '{name}' has started running", making it a fire-and-forget dispatch. Execution errors are logged to stderr but not returned to the caller.

Jobs are registered via a builder API (Server::new().register(job)) and the server binds with Axum/Tokio.

@Zatiji Zatiji requested review from Marc-AnthonyG and jwric June 29, 2026 19:58
Comment thread crates/tracel-app/src/cli/mod.rs
Comment thread crates/tracel-app/src/cli/mod.rs Outdated

@Marc-AnthonyG Marc-AnthonyG left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. We need to trace with info the server url when it start.
  2. Would be nice if the default behavior was the same as the json mapper with all field optional with default? Is this possible to do? (we need to offer both)

Comment thread crates/tracel-app/src/server/mod.rs Outdated

@Marc-AnthonyG Marc-AnthonyG left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wait there is some deps that might not be cross compile compatible

Co-authored-by: Marc-Anthony <78452236+Marc-AnthonyG@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 2, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the Tracel SDK by introducing an optional HTTP server for dispatching registered jobs, refactors job registration/execution to support a validate-then-run flow, and removes the tracel-macros proc-macro crate while updating some repository/product links and examples.

Changes:

  • Added an (feature-gated) Axum/Tokio-based server module to tracel-app, enabling fire-and-forget job execution via POST /{job_name}.
  • Refactored JobRegister to split validation from execution and added unit tests for the new behavior.
  • Removed tracel-macros and updated workspace/deps and release workflow accordingly; added new MNIST examples for dry-run and server usage.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
README.md Updates some URLs, adds new CLI link, but still contains macro-based Quick Start content that no longer matches the code.
examples/mnist/examples/mnist-server.rs New example demonstrating Server usage with multiple jobs/defaults.
examples/mnist/examples/mnist-dry-run.rs New example demonstrating a “dry-run” execution path.
examples/mnist/Cargo.toml Adds server feature (and enables it by default) to compile the server example.
crates/tracel/src/lib.rs Removes macros re-export but crate-level docs still reference macros/register.
crates/tracel/Cargo.toml Adds a server feature that forwards to tracel-app/server.
crates/tracel-macros/src/lib.rs Deleted proc-macro implementation for #[register].
crates/tracel-macros/Cargo.toml Deleted crate manifest for tracel-macros.
crates/tracel-app/src/server/mod.rs Implements the HTTP server and request handler wiring.
crates/tracel-app/src/server/error.rs Adds ServerError and maps JobRegisterError into server-facing errors.
crates/tracel-app/src/lib.rs Feature-gates the new server module.
crates/tracel-app/src/job.rs Introduces erased validate/run function types used by JobRegister.
crates/tracel-app/src/job_register.rs Splits dispatch into validate + run, adds error enum + unit tests.
crates/tracel-app/src/cli/mod.rs Adapts CLI dispatch to the new JobRegisterError flow and renames default job field.
crates/tracel-app/src/cli/error.rs Refactors CLI error types and adds From<JobRegisterError> mapping.
crates/tracel-app/Cargo.toml Adds feature flags and optional deps for the server implementation.
Cargo.toml Updates repository metadata, adds server deps, and switches tracel-client to a git dependency.
Cargo.lock Updates lockfile for dependency/source changes (including new server-related deps).
.gitignore Ignores .claude/ directory.
.github/workflows/publish.yml Removes publishing steps for the deleted tracel-macros crate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread Cargo.toml Outdated
Comment thread crates/tracel-app/src/server/mod.rs
Comment thread crates/tracel/src/lib.rs
Comment thread README.md Outdated
Zatiji and others added 2 commits July 2, 2026 12:28
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Zatiji Zatiji merged commit 12f0e20 into main Jul 2, 2026
1 check 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.

3 participants