Skip to content

fix: filter out deleted but referenced variables - #57

Merged
alexey1312 merged 3 commits into
mainfrom
alexey1312/filter-by-deletedButReferenced
Feb 13, 2026
Merged

fix: filter out deleted but referenced variables#57
alexey1312 merged 3 commits into
mainfrom
alexey1312/filter-by-deletedButReferenced

Conversation

@alexey1312

Copy link
Copy Markdown
Collaborator

This pull request introduces support for handling "deleted but referenced" variables in the color variables loading process. The main change ensures that variables marked as deleted (but still referenced elsewhere) are skipped during loading, improving data accuracy and preventing deprecated variables from being processed. The update also includes new tests to validate this behavior and supporting changes to the model and test helpers.

Support for "deleted but referenced" variables:

  • Added an optional deletedButReferenced property to the VariableValue model to represent variables that are deleted but still referenced elsewhere.
  • Updated ColorsVariablesLoader to skip variables where deletedButReferenced is true during the loading process.

Testing and test helpers:

  • Enhanced VariablesMeta.makeWithAliases test helper to accept a list of deleted variable IDs and include the deletedButReferenced flag in generated test data. [1] [2]
  • Added a new test, testSkipsDeletedButReferencedVariables, to verify that deleted-but-referenced variables are not loaded by ColorsVariablesLoader.

Add logic in ColorsVariablesLoader to skip variables marked as
deletedButReferenced in Figma responses. Extend VariableValue with a
deletedButReferenced property to track this status. Update test helpers
and add a test case to ensure that deleted but referenced variables are
not included in loader results. The change prevents errors from
attempting to load variables that are no longer active.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @alexey1312, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the color variable loading process by introducing a mechanism to gracefully handle variables that have been marked as deleted but are still referenced. This ensures that deprecated or removed variables are not processed, improving data integrity and preventing potential issues from stale data. The changes include updates to the variable model, the loading logic, and comprehensive test coverage to validate the new behavior.

Highlights

  • Variable Filtering: Implemented logic in ColorsVariablesLoader to prevent loading variables explicitly marked as deletedButReferenced.
  • Model Update: Added an optional deletedButReferenced boolean property to the VariableValue model to indicate a variable's status.
  • Test Helper Enhancement: Extended the VariablesMeta.makeWithAliases test helper to accept a list of deleted variable IDs, allowing for the generation of test data that includes the deletedButReferenced flag.
  • New Test Case: Introduced testSkipsDeletedButReferencedVariables to validate that the ColorsVariablesLoader correctly filters out variables marked as deleted but referenced.
Changelog
  • Sources/ExFigCLI/Loaders/Colors/ColorsVariablesLoader.swift
    • Added a guard statement within the compactMap closure to filter out variableMeta instances where deletedButReferenced is true, preventing them from being loaded.
  • Sources/FigmaAPI/Model/Variables.swift
    • Introduced an optional deletedButReferenced: Bool? property to the VariableValue struct, allowing the model to represent variables that are deleted but still referenced.
  • Tests/ExFigTests/Helpers/TestHelpers.swift
    • Modified the makeWithAliases function to accept a new deletedVariableIds: Set<String> parameter.
    • Updated the JSON generation logic within makeWithAliases to conditionally include the "deletedButReferenced": true field for variables whose IDs are present in the deletedVariableIds set.
  • Tests/ExFigTests/Loaders/ColorsVariablesLoaderTests.swift
    • Added a new test function testSkipsDeletedButReferencedVariables to verify that the ColorsVariablesLoader correctly excludes variables marked as deleted but referenced during the loading process.
Activity
  • The pull request was created by alexey1312.
  • No human activity (comments, reviews, approvals) has been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request correctly filters out 'deleted but referenced' variables. The changes to the model and loader are appropriate, and the new test case effectively validates the behavior. I've included a couple of suggestions for improvement. One is a performance and readability enhancement in the ColorsVariablesLoader. The other is a suggestion to improve the robustness of the test helpers by using JSONEncoder instead of manual string building for JSON, which is becoming more fragile with these changes.

Comment thread Tests/ExFigTests/Helpers/TestHelpers.swift
@alexey1312
alexey1312 force-pushed the alexey1312/filter-by-deletedButReferenced branch from c2cfa43 to 999ef24 Compare February 13, 2026 07:32
@alexey1312
alexey1312 merged commit d81b1cb into main Feb 13, 2026
1 check passed
@alexey1312
alexey1312 deleted the alexey1312/filter-by-deletedButReferenced branch February 13, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant