Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI Issues: YAML Cannot Find Constructors for FidesKeys #5113

Merged
merged 4 commits into from
Jul 22, 2024

Conversation

pattisdr
Copy link
Contributor

@pattisdr pattisdr commented Jul 20, 2024

Closes #2423

Description Of Changes

fides generate and fides annotate dataset commands are running into issues due to pyyaml not being able to find a constructor for the FidesKey tag. FidesKeys are ConstrainedStr underneath and have been successfully dumped as strings in the past. The commands appear to pass, but then data like this is written to the yaml file:

dataset:
- fides_key: !!python/object/new:fideslang.validation.FidesKey
  - public_a5735113d5
  organization_fides_key: default_organization
  name: public

Code Changes

  • Manually converting the FidesKeys in strings as a quick fix. This issue is not present in the Pydantic v2 work that is going out next release, potentially because how a FidesKey is constructed has changed.
  • Improving test coverage

Steps to Confirm

Fides Generate

  • nox -s dev -- shell
  • fides generate dataset db --connection-string postgresql+psycopg2://postgres:fides@fides-db:5432/fides .fides/test.yml (this generates a dataset from the locally running application db. No real secrets here, these are all public)
  • Confirm the generated dataset looks as expected, no double explanation points like above
dataset:
- fides_key: public_a5735113d5
  organization_fides_key: default_organization
  name: public

Fides Annotate

  • Open your .fides/db_dataset.yml
  • Remove a data category from an existing field
  • Run fides annotate dataset .fides/db_dataset.yml to annotate your dataset interactively
  • When prompted, enter a data category
  • Verify the data category looks as expected, no double exclamation points in the file
    description: A table to record manual steps within data subject execution
    data_categories: []
    fields:
    - name: connection_config_id
      description: The identifier of the system to locate this data within
      data_categories: [system.operations]
    - name: created_at

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Documentation:
    • documentation complete, PR opened in fidesdocs
    • documentation issue created in fidesdocs
    • if there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
  • Issue Requirements are Met
  • Relevant Follow-Up Issues Created
  • Update CHANGELOG.md
  • For API changes, the Postman collection has been updated
  • If there are any database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!

Copy link

vercel bot commented Jul 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2024 3:06pm

Copy link

cypress bot commented Jul 20, 2024

Passing run #9050 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge ad606d9 into 7db927b...
Project: fides Commit: 69ea4f6528 ℹ️
Status: Passed Duration: 00:35 💡
Started: Jul 22, 2024 3:17 PM Ended: Jul 22, 2024 3:18 PM

Review all test suite changes for PR #5113 ↗︎

@pattisdr pattisdr added run unsafe ci checks Runs fides-related CI checks that require sensitive credentials and removed run unsafe ci checks Runs fides-related CI checks that require sensitive credentials labels Jul 20, 2024
@pattisdr pattisdr marked this pull request as ready for review July 20, 2024 18:18
@pattisdr pattisdr requested a review from SteveDMurphy July 20, 2024 18:19
Copy link

codecov bot commented Jul 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.54%. Comparing base (5ff9973) to head (ad606d9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5113      +/-   ##
==========================================
+ Coverage   86.42%   86.54%   +0.12%     
==========================================
  Files         357      357              
  Lines       22345    22345              
  Branches     2954     2954              
==========================================
+ Hits        19312    19339      +27     
+ Misses       2516     2482      -34     
- Partials      517      524       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@erosselli erosselli left a comment

Choose a reason for hiding this comment

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

LGTM! Tested locally and it worked

Copy link
Contributor

@thingscouldbeworse thingscouldbeworse left a comment

Choose a reason for hiding this comment

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

looks like it works locally for me

@pattisdr
Copy link
Contributor Author

Thanks very much @thingscouldbeworse and @erosselli!

@pattisdr pattisdr merged commit bd9ba28 into main Jul 22, 2024
45 checks passed
@pattisdr pattisdr deleted the PROD-2423_fides_generate_cli_bug branch July 22, 2024 15:50
Copy link

cypress bot commented Jul 22, 2024

Passing run #9051 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

CLI Issues: YAML Cannot Find Constructors for FidesKeys (#5113)
Project: fides Commit: bd9ba28800
Status: Passed Duration: 00:35 💡
Started: Jul 22, 2024 4:01 PM Ended: Jul 22, 2024 4:01 PM

Review all test suite changes for PR #5113 ↗︎

@cypress cypress bot mentioned this pull request Jul 22, 2024
34 tasks
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.

3 participants