fix(test): stop pinning the tracer scope name to a development build - #4109
Merged
Merged
Conversation
Test_TracerContract_InstrumentationScopeName asserted the instrumentation
scope name equals the literal "gofr-dev". The middleware builds that name as
"gofr-" + version.Framework, and version.Framework is "dev" only on a
development build — a release branch sets it to the version being cut.
So the test passes on development and fails on every release branch:
tracer_test.go:436
expected: "gofr-dev"
actual : "gofr-v1.60.0"
Found on release/v1.60.0, where it failed all three PKG Unit Testing shards.
It would have failed the same way on v1.61.0 and every release after.
The literal was doing no work the surrounding assertions did not already do.
Line 438 compared the span's scope name to tracerCharScopeName(), which is
itself "gofr-" + version.Framework, so the contract was already pinned; the
literal only added an assertion that this build happens to be a dev build.
The expected value is now derived the same way the production code derives it,
and a second assertion pins that the version is actually appended rather than
resolving to an empty string — the failure mode a derived expectation could
otherwise hide. tracerCharScopeName is gone, since it had no other caller.
Mutation-verified against the production expression in tracer.go:
"gofrx-" + version.Framework -> FAIL
"gofr-" + "" -> FAIL
unmodified -> PASS
Verified under both builds: green with Framework = "dev" and with
Framework = "v1.60.0".
Umang01-hash
approved these changes
Aug 31, 2026
aryanmehrotra
added a commit
that referenced
this pull request
Aug 31, 2026
* Merge pull request #3815 from akshat-kumar-singhal/fix/flaky-cron-nil-logger-sql-mock-3813 fix(cron): join in-flight jobs on Stop and skip jobs with no logger * chore(ci): pin ls-lint/action to node24 commit to clear Node 20 warning (#3864) v2.3.1 declares `using: node20`, so every Linting Party run emits the Node.js 20 deprecation warning. Upstream fixed it in 0c7f19c ("chore: run on the node24 runtime"), but no release carries it yet, so pin the SHA. Revert to a tag once ls-lint cuts a release with the node24 runtime. Co-authored-by: Aryan Mehrotra <aryanmehrotra2000@gmail.com> * fix(grpc): guard the server handle so Run and Shutdown stop racing (#3929) (#3931) * chore(ci): build the website workflows on Node 24 instead of EOL Node 18 (#3870) (#3871) Node 18 "Hydrogen" reached end-of-life on 2025-04-30 and receives no security patches, including for the bundled OpenSSL and undici. The prod and stage website workflows build and deploy gofr.dev — they run `yarn install --frozen-lockfile` and `yarn refresh-data` against the network while holding the GAR deployment key and `packages: write`. Targets 24.x rather than the 22.x the issue suggested: v22 has been in maintenance since 2025-10-21 while v24 is the Active LTS through 2028-04-30. Verified `yarn install --frozen-lockfile` is green on node:24-alpine against the website's current lockfile. Both files changed together so prod and stage don't drift. Co-authored-by: Aryan Mehrotra <aryanmehrotra2000@gmail.com> * fix(examples): wait on a readiness signal instead of sleeping, and make using-migrations self-contained (#3818, #3816) (#3821) * feat(ai): add Embed capability to the LLM (#3757) * perf(http): opt-in O(1) trie router behind GOFR_ROUTER (#3759) * chore(deps): consolidate minor/patch dependency updates (2026-08-18) (#3969) * fix(ci): wait for Example-Unit-Testing services to be ready, and pin Zipkin (#3868) (#3939) * chore(ci): add concurrency groups and job timeouts, pin actions by SHA (#3865, #3867) (#3936) * fix(ci): stop mutating go.mod mid-run; check submodule tidiness without writing (#3869) (#3938) * chore(deps): close the dependabot coverage gaps and retire EOL base images (#3873) (#3937) * chore(deps): bump tj-actions/changed-files 47.0.0 -> 47.0.6 (#4049) * chore(deps): bump redis/go-redis/v9 9.21.0 -> 9.22.0 + regenerate mock (#4051) * chore(deps): bump golang 1.26-alpine -> 1.27-alpine in examples/http-server (#4098) Docker base image bump from Dependabot #4064 (docker group). Closes: #4064 Co-authored-by: claude-flow <ruv@ruv.net> * fix(http): characterize the request path and fix eleven defects it exposed (#3770) * perf(logging,http): skip request logs the level discards, and co-allocate the request objects (#3974) * update release version to v1.60.0 * fix(ai): make Embed a method on ai.LLM instead of a type assertion (#4108) * fix(test): stop pinning the tracer scope name to a development build (#4109) --------- Co-authored-by: Akshat Singhal <65562230+akshat-kumar-singhal@users.noreply.github.com> Co-authored-by: Umang Mundhra <mundhraumang.02@gmail.com>
This was referenced Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Test_TracerContract_InstrumentationScopeNameasserts the instrumentation scope name equals the literal"gofr-dev". The middleware builds that name as"gofr-" + version.Framework(tracer.go:64), andversion.Frameworkis"dev"only on a development build — a release branch sets it to the version being cut.So the test passes on
developmentand fails on every release branch:Found while cutting v1.60.0 (#4107), where it failed all three
PKG Unit Testingshards — v1.24, v1.25 and v1.26. It is the only failure in./pkg/....This is a same-cycle regression, not inherited debt. The assertion arrived with #3770 (
7cbb41a3), which is itself part of the v1.60.0 release:"gofr-dev"literal intracer_test.goversion.Frameworkreferenced by that testtracer_test.gopredates this cycle, but nothing in it depended on the version until #3770, so v1.59.0's release branch could not have hit this. v1.60.0 is the first release that would fail — and so would every release after it, if this shipped as is. Fixing it at the source rather than patching the release branch keeps the next cut clean.Why the literal was never load-bearing
The two assertions were:
with
tracerCharScopeName()defined as"gofr-" + version.Framework. The second line already pinned the contract — the span's scope name is the gofr prefix plus the framework version. The first only asserted that this particular build happens to be a development build, which is a property of the branch, not of the middleware.Its comment shows the intent was a tripwire for the name moving. But the name is designed to move with every release, so the tripwire fires on exactly the occasions when nothing is wrong.
The change
The expected value is derived the way production derives it, and a second assertion pins that the version is actually appended rather than resolving to an empty string — the one failure mode a derived expectation could otherwise hide:
tracerCharScopeNameis removed; it had no other caller.Breaking Changes (if applicable):
None. Test-only change; no production file is touched.
Additional Information:
The assertion was checked in both directions rather than assumed to work.
Mutation-verified against the production expression in
tracer.go:"gofrx-" + version.Framework"gofr-" + ""(A third mutation — deleting
version.Frameworkoutright — was discarded because it leaves the import unused and fails to build, so it tests nothing.)Verified under both builds, which is the point of the change:
Framework = "dev"→go test ./pkg/gofr/http/middleware/ -run Test_TracerContractgreen.Framework = "v1.60.0"→ green (fails ondevelopmenttoday).go vet ./pkg/gofr/http/middleware/is clean.golangci-lint run ./pkg/gofr/http/middleware/...reports 5 findings, none in the changed file — 2goconstinlogger.goand 3noctxinapikey_auth_test.go/auth_test.go, all pre-existing in files this PR does not touch (the diff istracer_test.goalone, +8/-7). CI runs withonly-new-issues, andCode Qualitypasses.On the full local
go test ./pkg/...: one package fails on my machine,pkg/gofr/datasource/pubsub/mqtt, which hangs to atest timed outpanic at both the default and a 5m timeout. It talks to a public MQTT broker, this PR does not touch it (the diff istracer_test.goalone), and it passes in CI. I am citing CI as the authority rather than my own run: all threePKG Unit Testingshards pass on this branch, which is precisely the check that was red on the release branch.Checklist:
goimportandgolangci-lint.