feat: use deprecated tag for measurements#847
Conversation
WalkthroughThis PR extends the adopted-probes system to support a Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/lib/override/adopted-probes.tsOops! Something went wrong! :( ESLint: 10.4.1 SyntaxError: Unexpected token ':' test/tests/unit/override/adopted-probes.test.tsOops! Something went wrong! :( ESLint: 10.4.1 SyntaxError: Unexpected token ':' Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/tests/unit/override/adopted-probes.test.ts (1)
1391-1405: ⚡ Quick winAdd coverage for equal-prefix deduping.
Please add a test where
defaultPrefixanddeprecatedPrefixare identical and assert only oneu-*system tag is returned.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/tests/unit/override/adopted-probes.test.ts` around lines 1391 - 1405, Add a unit test to cover equal-prefix deduping: create an AdoptedProbes instance (AdoptedProbes) and stub sql.select to return an adoption record where deprecatedPrefix equals the defaultPrefix (set deprecatedPrefix to the same value as defaultAdoption.defaultPrefix or defaultPrefix value used in other tests), call syncDashboardData(), then call getUpdatedTags(defaultConnectedProbe) and assert that only a single "u-<prefix>" system tag is present (i.e., no duplicate u-* tag); reference getUpdatedTags and the deprecatedPrefix/defaultPrefix fields to locate where to change the test input and the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/override/adopted-probes.ts`:
- Around line 295-298: The spread that conditionally adds a system tag uses
adoption.deprecatedPrefix without checking whether it matches the default
prefix, causing duplicate u-* tags when deprecatedPrefix === defaultPrefix;
update the conditional around the spread (the expression building the array with
AdoptedProbes.getGlobalUserTag(adoption.deprecatedPrefix)) to require
adoption.publicProbes && adoption.deprecatedPrefix && adoption.deprecatedPrefix
!== defaultPrefix so the tag is only appended when the deprecated prefix is
present and different from defaultPrefix.
---
Nitpick comments:
In `@test/tests/unit/override/adopted-probes.test.ts`:
- Around line 1391-1405: Add a unit test to cover equal-prefix deduping: create
an AdoptedProbes instance (AdoptedProbes) and stub sql.select to return an
adoption record where deprecatedPrefix equals the defaultPrefix (set
deprecatedPrefix to the same value as defaultAdoption.defaultPrefix or
defaultPrefix value used in other tests), call syncDashboardData(), then call
getUpdatedTags(defaultConnectedProbe) and assert that only a single "u-<prefix>"
system tag is present (i.e., no duplicate u-* tag); reference getUpdatedTags and
the deprecatedPrefix/defaultPrefix fields to locate where to change the test
input and the assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8e6987d7-0988-4fb4-aa8b-f8bb538faed0
📒 Files selected for processing (3)
migrations/dashboard/create-tables.js.sqlsrc/lib/override/adopted-probes.tstest/tests/unit/override/adopted-probes.test.ts
Part of jsdelivr/globalping-dash-directus#162