Skip to content

Fix false standard vars warning when variable is wired via init decorator#596

Merged
theoephraim merged 4 commits intomainfrom
copilot/fix-op-service-account-token-warning
Apr 13, 2026
Merged

Fix false standard vars warning when variable is wired via init decorator#596
theoephraim merged 4 commits intomainfrom
copilot/fix-op-service-account-token-warning

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

_checkStandardVars unconditionally warns when a plugin's standard env var (e.g. OP_SERVICE_ACCOUNT_TOKEN) exists in the environment, even when it's already wired via the init decorator (@initOp(token=$OP_SERVICE_ACCOUNT_TOKEN)).

Changes

  • packages/varlock/src/env-graph/lib/plugins.ts: _checkStandardVars now checks decValueResolver.deps on processed init decorator instances to identify already-wired variables. Detected standard vars that match a wired dependency are filtered out before the warning is emitted.

  • packages/varlock/src/env-graph/lib/env-graph.ts: Moved _checkStandardVars call to after root decorator processing so that decValueResolver.deps is populated and available for the check.

  • packages/varlock/src/env-graph/test/plugins.test.ts: Three new test cases covering: warning fires when var is present but not wired, warning suppressed when wired via init decorator, no warning when var absent from environment.

Example

# @plugin(@varlock/1password-plugin)
# @initOp(token=$OP_SERVICE_ACCOUNT_TOKEN)
# ---
# @type=opServiceAccountToken @sensitive
OP_SERVICE_ACCOUNT_TOKEN=

Previously warned despite token=$OP_SERVICE_ACCOUNT_TOKEN being explicitly wired. Now correctly suppressed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 12, 2026

🦋 Changeset detected

Latest commit: 5e8624e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
varlock Patch
@varlock/astro-integration Patch
@varlock/cloudflare-integration Patch
@varlock/expo-integration Patch
@varlock/nextjs-integration Patch
@varlock/vite-integration Patch
@varlock/1password-plugin Patch
@varlock/aws-secrets-plugin Patch
@varlock/azure-key-vault-plugin Patch
@varlock/bitwarden-plugin Patch
@varlock/dashlane-plugin Patch
@varlock/google-secret-manager-plugin Patch
@varlock/hashicorp-vault-plugin Patch
@varlock/infisical-plugin Patch
@varlock/keepass-plugin Patch
@varlock/pass-plugin Patch
@varlock/passbolt-plugin Patch
@varlock/proton-pass-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI and others added 2 commits April 12, 2026 20:29
…init decorator

When _checkStandardVars detects a standard env var in the environment,
it now checks whether that variable is already referenced in the
corresponding init decorator (e.g. @initOp(token=$OP_SERVICE_ACCOUNT_TOKEN)).
If so, the warning is suppressed since the variable IS connected to the plugin.

Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/96c43351-fdd6-4a8d-b946-cdf545a71da8

Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
…ParsedValue

Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/96c43351-fdd6-4a8d-b946-cdf545a71da8

Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix false warning for OP_SERVICE_ACCOUNT_TOKEN in plugin initialization Fix false standard vars warning when variable is wired via init decorator Apr 12, 2026
Copilot AI requested a review from theoephraim April 12, 2026 20:33
@theoephraim
Copy link
Copy Markdown
Member

@copilot - is there not simpler way to figure out which config items a decorator depends on? If not, maybe we should add that as a more general helper on the decorator instance itself?

…standard vars check

Move _checkStandardVars call to after root decorator processing so
decValueResolver.deps is populated. This replaces the custom
collectVarRefsFromParsedValue AST walker with a simple check against
the existing resolver dependency tracking infrastructure.

Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/f865c23c-ab01-4fbe-9f36-6ef2867aca6e

Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 13, 2026

@copilot - is there not simpler way to figure out which config items a decorator depends on? If not, maybe we should add that as a more general helper on the decorator instance itself?

Yes — the Resolver class already tracks config item dependencies via decValueResolver.deps. The issue was that _checkStandardVars was called before root decorator processing, so deps wasn't populated yet. In 5e8624e I moved the _checkStandardVars call to after root decorator processing and replaced the custom AST walker with a simple loop over decValueResolver.deps. No new helpers needed.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.iconify.design
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/varlock/varlock/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/varlock/varlock/node_modules/vitest/dist/workers/forks.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from theoephraim April 13, 2026 03:51
@theoephraim theoephraim marked this pull request as ready for review April 13, 2026 04:54
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 13, 2026

Open in StackBlitz

npm i https://pkg.pr.new/varlock@596

commit: 5e8624e

@theoephraim theoephraim merged commit 3170205 into main Apr 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False warning: 'OP_SERVICE_ACCOUNT_TOKEN found in environment but not connected to plugin' when @initOp is configured

2 participants