بنقرة واحدة
tracing-spans
Add structured tracing spans + fields to handlers, jobs, services. Redact tokens / initData / PII. Use
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Add structured tracing spans + fields to handlers, jobs, services. Redact tokens / initData / PII. Use
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Bump the patch version in server/Cargo.toml or website/package.json after completing a major change. Use when the user asks to bump/release a version, or when CLAUDE.md's rule about version bumps after major changes applies.
Before a non-trivial change, list affected systems — DB schema, API contract, Telegram handlers, jobs, TS types, docs. Catch ripple effects upfront, not after CI fails. Use when planning a feature, migration, refactor, or any cross-module touch.
Self-review before push — read the diff as a reader, scan for vixen footguns (token leaks, PII, idempotency, captcha asset overwrites), run validation pipeline, no surprise files. Use before "git push", before opening a PR, or when the user says "ready to commit".
Write a git commit message for vixen-rs following the project's Conventional Commits convention. Use when the user asks to commit, create a commit, or write a commit message.
Reproduce → bisect → root cause → fix → verify. Don't speculate, don't "add more error handling" as a guess. Use when something is broken, when a test fails intermittently, when the user says "this isn't working" or "investigate why".
Write small, fast, reproducible Dockerfiles for the vixen-rs server (Rust) and website (bun) using multi-stage builds, cache mounts, distroless/alpine runtime images, and non-root users. Use when editing server/Dockerfile, website/Dockerfile, docker-compose.yml, or when the user asks to shrink an image or speed up a Docker build.
| name | tracing-spans |
| description | Add structured tracing spans + fields to handlers, jobs, services. Redact tokens / initData / PII. Use |
Source: Tokio tracing docs + vixen RedactedToken newtype in server/src/utils/redact.rs.
Read first:
request_id, route, user_id (if authenticated).update_id, chat_id, user_id.job (name), iteration (counter).#[tracing::instrument] to auto-create the span around a function. Spans nest automatically across .await.#[tracing::instrument(skip(state, body), fields(chat_id, user_id))]
async fn handle_message(state: AppState, body: Message) -> Result<()> {
tracing::Span::current().record("chat_id", body.chat.id.0);
tracing::Span::current().record("user_id", body.from.as_ref().map(|u| u.id.0));
// ...
}
fields(...) up front; fill them with Span::current().record(...) once values are known.skip(state, body) keeps the AppState and untrusted payloads out of the span attributes.// GOOD
tracing::info!(chat_id, user_id, action = "verify", "captcha_solved");
// BAD
tracing::info!("captcha solved for user {} in chat {}", user_id, chat_id);
RedactedToken; its Display impl prints bot:...***. Never {bot_token} raw.initData → debug! only; never info! or higher. CLAUDE.md mandate.pii = true flag.jti) is OK as a correlation key.error! — irrecoverable; alert.warn! — recoverable; investigate (CAS timeout, captcha asset missing).info! — user-visible action (verify, ban, report sent).debug! — developer-only; raw initData, request body shapes.trace! — heavy; off in prod.#[tracing::instrument(skip(state, body))] — state is huge, body may carry PII.skip_all for handlers that take many sensitive args; record fields explicitly via Span::current().record(...).tracing::Span::current() outside an instrumented function returns a no-op span — recording fields silently does nothing.#[instrument] is async-aware; the span enters and exits across each .await.tracing::info!("token: {}", bot_token) — even debug-level is risky for tokens; always go through RedactedToken.bin/server.rs. Don't add a second subscriber.cargo build — instrument macro errors are compile-time.logs/vixen-server.log for required fields.bot_token, init_data, phone in any tracing:: macro at info! level or above.rust-error-handling, add-api-route, add-telegram-handler, background-job.