Skip to content

Add @deprecated item decorator#644

Open
Copilot wants to merge 4 commits intomainfrom
copilot/add-deprecated-decorator
Open

Add @deprecated item decorator#644
Copilot wants to merge 4 commits intomainfrom
copilot/add-deprecated-decorator

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Adds a @deprecated decorator for env-spec config items that surfaces a deprecation warning (never a hard error) and annotates generated TypeScript types with @deprecated JSDoc so IDEs show strikethrough on access.

Decorator behavior

# @deprecated                          # warns: "This config item is deprecated"
# @deprecated="Use NEW_API_KEY instead" # warns with message
# @deprecated=false                    # explicit opt-out (no warning)
OLD_API_KEY=
  • Item still resolves normally — deprecation produces a warn validation state, not error
  • @deprecated=false allows opt-out (useful for override scenarios)

Changes

  • decorators.ts — registers deprecated in builtInItemDecorators; process() throws a warning SchemaError with the optional message appended after :
  • config-item.ts — adds isDeprecated and deprecationMessage getters using simplifiedValue from the parsed decorator (no async resolution needed); extends TypeGenItemInfo with both fields
  • type-generation.ts — emits @deprecated [message] JSDoc tag when info.isDeprecated is true, enabling IDE strikethrough on deprecated env accesses
  • deprecated-decorator.test.ts — tests for warning-only behavior, message formatting, @deprecated=false opt-out, validationState === 'warn', getter values, and type gen info

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: /usr/local/bin/node /usr/local/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 /home/REDACTED/.nvm/package.json /home/REDACTED/.nvm/rename_test.sh /home/REDACTED/.nvm/test k/no�� m (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/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 journal-or-kmsg ndor/bin/git tail bin/�� (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/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 linked an issue Apr 22, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 22, 2026 18:34
Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/86c3a61d-4c29-49b1-b072-fecf43de4aef

Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com>
Copilot AI changed the title [WIP] Add @deprecated decorator for marking deprecated variables Add @deprecated item decorator Apr 22, 2026
Copilot AI requested a review from philmillman April 22, 2026 18:37
@philmillman philmillman marked this pull request as ready for review April 22, 2026 18:39
@bumpy-bot
Copy link
Copy Markdown
Collaborator

bumpy-bot commented Apr 22, 2026

bumpy-frog

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

patch Patch releases

  • varlock 0.9.1 → 0.9.2

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@philmillman philmillman requested a review from theoephraim April 22, 2026 18:44
const msgPart = decVal.isStatic && _.isString(decVal.staticValue)
? `: ${decVal.staticValue}`
: '';
throw new SchemaError(`This config item is deprecated${msgPart}`, { isWarning: true });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure about having a warning here. I thought it would just add it to the generated ts types?
The user knows it's likely still set, or else they would remove it from the schema altogether.

We could potentially still mark it somehow in the varlock load output, but the warning may be a bit too agressive?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm on the fence there too. I could see a case for warning, especially in CI, but maybe we put it behind a flag?

expect(g.configSchema.ALSO_NOT_DEPRECATED.isDeprecated).toBe(false);
});

it('@deprecated is included in type gen info', async () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob want one too checking the type output with just the @deprecated and no custom message

Comment thread .bumpy/add-deprecated-decorator.md Outdated
Co-authored-by: Theo Ephraim <theo@dmno.dev>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

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

commit: 744aa2b

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.

Add @deprecated decorator

4 participants