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

Fix D&D resource display names #5498

Merged
merged 7 commits into from
Nov 19, 2024
Merged

Conversation

jpople
Copy link
Contributor

@jpople jpople commented Nov 15, 2024

Closes #HJ-162

Description Of Changes

Fixes D&D resource display names to be more generalizable across systems and handle some edge cases better by no longer relying (solely) on URN length.

Steps to Confirm

To test, have some data in your detection or discovery tables with:

  • nested fields (I used BigQuery)
  • a system without a database layer (I used DynamoDB)
  1. View D&D tables
  2. At all levels, non-subfield resource names should display the resource's name as-is
  3. Subfields should display all names below the top-level field name, separated by .

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
  • Followup issues:
    • Followup issues created (include link)
    • No followup issues
  • 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!
    • No migrations
  • 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
    • No documentation updates required

Copy link

vercel bot commented Nov 15, 2024

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

Name Status Preview Comments Updated (UTC)
fides-plus-nightly ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 8:15pm

Copy link

cypress bot commented Nov 15, 2024

fides    Run #11090

Run Properties:  status check passed Passed #11090  •  git commit f0d554c5f3 ℹ️: Merge 3ca7ec519d513826ed85c5bbf999434f946e6a7c into c7e645fd2d7e6d7367d961443817...
Project fides
Branch Review refs/pull/5498/merge
Run status status check passed Passed #11090
Run duration 00m 38s
Commit git commit f0d554c5f3 ℹ️: Merge 3ca7ec519d513826ed85c5bbf999434f946e6a7c into c7e645fd2d7e6d7367d961443817...
Committer jpople
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

!resource.parent_table_urn ||
splitUrn.length === TOP_LEVEL_FIELD_URN_PARTS
!table_name ||
!top_level_field_name ||
Copy link
Contributor

Choose a reason for hiding this comment

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

If it would be helpful I am adding in top_level_field_urn as well in this PR: https://github.com/ethyca/fidesplus/pull/1727/files#diff-8bd50e59212bea55bbd599dd3564999eecbda0c718c2681318bbc990a29d28c9R354

not sure if it's actually better or the same as top_level_field_name but I figured better to give as much info as possible now and then we can remove one later if it's not helpful

Copy link
Contributor

@thingscouldbeworse thingscouldbeworse Nov 15, 2024

Choose a reason for hiding this comment

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

I imagine top_level_field_name to be maybe a little tricky in structures like

same_name
    |------- same_name
                |------- same_name
                            |------- same_name

etc etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for flagging-- yeah, that'll make this much cleaner if I can just elide that.

// for a subfield, we want to show all subfield names separated by "."
return splitUrn.slice(TOP_LEVEL_FIELD_URN_PARTS).join(URN_SEPARATOR);
partsToRemove.forEach((part) => {
const index = splitUrn.indexOf(part!);
Copy link
Contributor

Choose a reason for hiding this comment

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

super nitpicky: I would feel more comfortable with this if it were wrapped in an if rather than using a forced Type !

Suggested change
const index = splitUrn.indexOf(part!);
if (!!part) {
const index = splitUrn.indexOf(part);

Take this example:

"my string has a null word in it".indexOf(null);

returns 16 because Javascript!

Copy link
Contributor

@gilluminate gilluminate left a comment

Choose a reason for hiding this comment

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

Code looks good. Thanks for updating the nitpick.

@jpople jpople merged commit ee3924d into main Nov 19, 2024
13 checks passed
@jpople jpople deleted the jpople/hj-162/nested-field-display-names branch November 19, 2024 20:34
Copy link

cypress bot commented Nov 19, 2024

fides    Run #11092

Run Properties:  status check passed Passed #11092  •  git commit ee3924d878: Fix D&D resource display names (#5498)
Project fides
Branch Review main
Run status status check passed Passed #11092
Run duration 00m 38s
Commit git commit ee3924d878: Fix D&D resource display names (#5498)
Committer jpople
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

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