fix(test): otel-hostname-config imports real loadTracingConfig#4071
Conversation
β¦ip scoping, not requireRole The PATCH endpoint for pinned sessions uses withOwnership (key-based session ownership) rather than requireRole. The docs incorrectly stated 'admin, operator' role requirement. Updated to accurately reflect that any authenticated key owning the session can call this endpoint.
Previous test defined a local loadConfig() that duplicated loadTracingConfig() from src/tracing.ts β test passed even if the real code broke (false confidence). Rewrite to import the real function with vi.resetModules() + dynamic import() for proper module isolation.
There was a problem hiding this comment.
π Changes requested β scope contamination.
The core test fix (otel-hostname-config.test.ts) is excellent β importing the real loadTracingConfig via dynamic import with vi.resetModules() is the correct approach. This catches a real false-confidence bug.
However, this PR includes two unrelated changes that should be separate PRs:
.gitignoreβ addswt-i18n-sessionboard. Unrelated to the test fix.docs/api-reference.mdβ the RBAC role table fix. This is already merged in PR #4072 (just now). This will cause a merge conflict.
Action needed:
- Rebase on latest
develop(which now includes the #4072 docs fix) β this should resolve the conflict - Remove the
.gitignorechange from this branch (move it to its own PR or verify it is still needed)
Once the PR contains only the test file change, this is an easy approve.
There was a problem hiding this comment.
β Approved. Test rewrite is correct β imports real loadTracingConfig with proper module isolation (vi.resetModules + dynamic import). The old local loadConfig() duplicate is gone. 7 test cases preserved.
All CI green, no secrets, no security concerns.
Bug: Test gives false confidence
Argus audit found
otel-hostname-config.test.tsdefines a localloadConfig()that duplicatesloadTracingConfig()fromsrc/tracing.ts. It never imports the real function β the test passes even if the real code breaks.Fix
Rewrite to import the real
loadTracingConfigwith proper module isolation:vi.resetModules()inafterEachto bust the module cacheimport(../tracing.js)per test to pick up env changesVerification