Skip to content

fix(shared): tag unkey deployment context - #584

Merged
izadoesdev merged 3 commits into
stagingfrom
codex/tag-unkey-deployment-context
Aug 2, 2026
Merged

fix(shared): tag unkey deployment context#584
izadoesdev merged 3 commits into
stagingfrom
codex/tag-unkey-deployment-context

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Aug 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Unkey runtime fallbacks for environment, commit SHA, and region in shared evlog context.
  • Keep existing Railway, Vercel, and AWS metadata precedence unchanged.
  • Add coverage for the Unkey-specific environment variables.

Why

Links deployments run on Unkey, whose runtime metadata variable names differ from the existing service platforms. Without these fallbacks, Axiom cannot reliably distinguish preview versus production deployments or correlate logs to an Unkey commit and region.

This change only improves telemetry attribution; it does not alter request or deployment behavior.

Validation

  • Targeted shared logging tests passed.
  • Shared package typecheck and lint passed.
  • Full pre-push suite passed: 25/25 tasks, including 3,924 AI-package tests with 0 failures.

AI disclosure

OpenAI Codex assisted with incident investigation, implementation, tests, and PR preparation. The change was validated locally through the repository hooks and full test suite.


Summary by cubic

Tag Unkey deployments in packages/shared evlog by reading UNKEY_ENVIRONMENT_SLUG, UNKEY_GIT_COMMIT_SHA, and UNKEY_REGION, so logs show the correct environment, commit, and region. Keep platform precedence as Railway > Vercel > Unkey; this only changes telemetry tags.

  • Bug Fixes
    • Preserve link-visit-delivery exports in apps/links tests when mocking.

Written for commit a5702a5. Summary will update on new commits.

Review in cubic

@unkey-deploy

unkey-deploy Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
links (preview) Ready Visit Preview Inspect Aug 2, 2026 1:54pm

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
databuddy-status Ready Ready Preview Aug 2, 2026 1:54pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
dashboard Skipped Skipped Aug 2, 2026 1:54pm
documentation Skipped Skipped Aug 2, 2026 1:54pm

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8ab7e97c-7812-4a9b-a53e-2026c8642db2

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@dosubot

dosubot Bot commented Aug 1, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about Databuddy Add Dosu to your team

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds Unkey environment, commit, and region metadata to shared evlog context and adds focused coverage for an Unkey-only runtime. The environment fallback is currently ordered ahead of Railway and Vercel, contrary to the stated requirement to preserve their precedence.

  • Extends the shared runtime environment shape with Unkey metadata.
  • Adds Unkey fallbacks for environment, region, and commit attribution.
  • Adds a test for metadata supplied exclusively through Unkey variables.

Confidence Score: 4/5

The precedence regression should be fixed before merging because overlapping deployment metadata can attribute logs to the wrong environment.

UNKEY_ENVIRONMENT_SLUG is evaluated before the existing Railway and Vercel environment variables, so it overrides them whenever metadata sources overlap rather than acting as a fallback.

Files Needing Attention: packages/shared/src/evlog-redaction.ts, packages/shared/src/evlog-redaction.test.ts

Important Files Changed

Filename Overview
packages/shared/src/evlog-redaction.ts Adds Unkey telemetry fallbacks, but the environment resolver allows Unkey metadata to override existing Railway and Vercel metadata.
packages/shared/src/evlog-redaction.test.ts Covers the Unkey-only path but does not exercise overlapping platform metadata and therefore misses the precedence regression.

Reviews (1): Last reviewed commit: "fix(shared): tag unkey deployment contex..." | Re-trigger Greptile

Comment on lines 60 to 63
env.APP_ENV?.trim() ||
env.UNKEY_ENVIRONMENT_SLUG?.trim() ||
env.RAILWAY_ENVIRONMENT_NAME?.trim() ||
env.VERCEL_ENV?.trim() ||

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.

P1 Unkey overrides existing platform metadata

If a runtime contains both UNKEY_ENVIRONMENT_SLUG and Railway or Vercel metadata, the new ordering selects the Unkey slug first, causing logs to be attributed to the wrong deployment environment.

Suggested change
env.APP_ENV?.trim() ||
env.UNKEY_ENVIRONMENT_SLUG?.trim() ||
env.RAILWAY_ENVIRONMENT_NAME?.trim() ||
env.VERCEL_ENV?.trim() ||
env.APP_ENV?.trim() ||
env.RAILWAY_ENVIRONMENT_NAME?.trim() ||
env.VERCEL_ENV?.trim() ||
env.UNKEY_ENVIRONMENT_SLUG?.trim() ||

@vercel
vercel Bot temporarily deployed to Preview – documentation August 2, 2026 13:53 Inactive
@vercel
vercel Bot temporarily deployed to Preview – dashboard August 2, 2026 13:53 Inactive
@izadoesdev
izadoesdev merged commit ffc5963 into staging Aug 2, 2026
20 checks passed
@izadoesdev
izadoesdev deleted the codex/tag-unkey-deployment-context branch August 2, 2026 14:38
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.

1 participant