Repository navigation
Name the data update logging test's key so it is not an old variable name - #111
Merged
Merged
Conversation
…name The environment variable names check fails on rc at line 76 of DataUpdateServiceLoggingTests.java, where the constant LICENSE_KEY starts a wrapped line and so matches the check's start of line form for an old name. The constant holds a made up licence key for the test rather than naming an environment variable, so it becomes FULL_KEY, beside MASKED_KEY, and the test reads the same.
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.
The problem
The Environment variable names check has failed on
rcsince#105 merged at 19:36
UTC on 11 November 2026. On this draft's own base,
rc4bec158, it fails inrun 43115452328
with one finding, in
DataUpdateServiceLoggingTests.javaline 76.That test came in with
#79, merged at 19:35
as
9c17f01,
and the check with #105 a minute later as
53ccddd.
Neither draft held the other's change, so each passed alone and they clash
only together. The check runs on a draft merged with
rc, so every draftinto
rcnow fails the same way, for example #109 inrun 43111207600.
Line 76 is the second line of a wrapped expression.
LICENSE_KEYhere is a Java constant holding a made up licence key, whichthe test gives the data update and then makes sure never appears in full in
the log. The test reads no environment variable at all.
What the rule says
No 51Degrees specification names environment variables. A search of
specifications at
d729b7d
for "environment variable" finds two passing mentions, in
device-detection-specification/required-examples.mdline 136 andpipeline-specification/automated-testing.mdline 119. The rule is JamesRosewell's decision of 10 November 2026, quoted in
51degrees-php#67, "Just
use the version that works everywhere all the time with no fallback", and the
check from #105 enforces it.
ci/check-environment-variable-names.ps1lines 33 to 38say what the second half of the check matches.
The last of those forms,
^[\t\- ]*inline 52,
matches any line that starts with one of the three old names, which is why
line 76 fails. Line 73 has the constant after the word
String, and lines433 and 452 after an opening bracket, which no form matches.
The table in #105 removes
LICENSE_KEYin favour of_51DEGREES_LICENSE_KEY. That is the name of the variable, and thisconstant is not one, so naming the constant
_51DEGREES_LICENSE_KEYwouldtell a reader the test reads that variable when it does not.
What changed
570f626
renames the constant to
FULL_KEYon the four lines that use it, being 73,76, 433 and 452.
FULL_KEYsits besideMASKED_KEY, and the test alreadyspeaks of the key "in full" in
assertKeyOnlyMasked. The value and everyuse stay the same, so nothing the test checks changes.
The check stays as it is. Its start of line form is what catches a workflow
env:key and a readme list entry, which #105 added on review inc885993,
and a Java constant named after an old variable reads like one. In this
repository one does, because both
ExamplesWithoutSettingsTestfiles holdthe name
LicenseKeyin a constant calledLICENSE_KEYand pass it toSystem.getenv, atline 62 of the Device Detection one.
Leaving the check alone has a cost, which is that line 52 goes on matching any
later Java constant called
RESOURCE_KEY,LICENSE_KEYorFOD_CLOUD_API_URLthat starts its own line, whichever value the constantholds. Renaming the constant is the right answer each time, because a Java
constant taking one of the three banned names either reads that variable or
reads as though it does, and both of those are what the check is for.
Narrowing the check instead would have to tell a Java continuation line from a
workflow
env:key and a readme list entry, which are the two forms the startof line match was added for, and getting that wrong would let a real variable
through.
How CI gives this test a key
CI gives it none. The test builds its own data file configuration and passes
the constant in with
setDataUpdateLicenseKeysatline 432,
and its HTTP client is a mock, so no secret reaches it. CI sets licence keys
for other tests, as
_51DEGREES_LICENSE_KEYfor the 51Did tests incloud-51did.ymllines 78 to 85,and as the
LicenseKeysystem property for the examples inci/run-unit-tests.ps1line 21and
ci/run-integration-tests.ps1line 67.Neither changes.
Other places #79 and #105 clash
None found.
rc4bec158 finds only line 76, inrun 43115452328.
whatever comes before them, finds this test's constant and the two
ExamplesWithoutSettingsTestconstants above, which neither drafttouched.
the system properties
java.io.tmpdir,os.nameandos.arch.full build below compiles and runs Make the data update follow the specification #79's tests over Give every environment variable one _51DEGREES_ name #105's renames.
How it was tested
rc.Run 43088786083,
the push of 53ccddd, passes the check's 35 tests, reads 1,023 paths and
fails with "1 old names are read, set or kept", naming line 76.
Run 43115452328,
the push of this draft's base,
rc4bec158, fails the same way over 1,024paths.
Run 43116088612,
on 570f626 merged with
rc4bec158, passes the 35 tests, reads 1,024 pathsand prints "No tracked file names a variable starting with a digit or an
old name."
Run 43116142534,
on a temporary branch taken from
rc4bec158, succeeded at 00:08 UTC on12 November. Eleven jobs passed and two were skipped, those two being the
performance comparison pair, which the temporary build turns off with
skip-compare-performance: true. All nine Build and Test jobs, which areWindows and Ubuntu on Java 8,
11, 17 and 21 and Ubuntu ARM on Java 17, printed one
Setting 'PullRequestSha' to '570f62670259201748a7a3a16286d9944a52048d'line each, matching this draft's head, and Configure printed "Left out 6
macOS entries".
DataUpdateServiceLoggingTestsran in all nine, 25 testswith no failures and none skipped, so Make the data update follow the specification #79's tests ran over Give every environment variable one _51DEGREES_ name #105's renames.
rchas taken#102 as
6034fa4 and
#109 as
2f6ab51,
between them the Sequence Element session id, the JavaScript Builder, the
licence files and the configuration-validation submodule. Neither touches
DataUpdateServiceLoggingTests.java, this draft still merges cleanly intorc, and the head has not moved.What remains
LicenseKey, the name inUpdateDataFile.UPDATE_EXAMPLE_LICENSE_KEY_NAME,is outside the
_51DEGREES_names and is not in Give every environment variable one _51DEGREES_ name #105's list of whatremains. Both data file update examples read it through
KeyUtils.getNamedKey,which tries the variable
LicenseKey, thenLICENSEKEY, then the systemproperty, so on Linux the one setting has two names. It moves with the two
CI lines above that set it, so it is worth a change of its own, as
TestResourceKeyis.rcwith this change.macOS was left out of this draft's full build under the 9 November decision.
The rc head is built with macOS before it merges into main.