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

add a subcommand into diff processor to detect missing docs #11156

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

iyabchen
Copy link
Contributor

@iyabchen iyabchen commented Jul 14, 2024

hashicorp/terraform-provider-google#14743
Part 1 - add missing docs command into diff-processor to detect new fields or new resource without doc. This only covers resource, NOT data sources.

  • For all field diffs, it gets the resource doc
  • Parse resource doc to get the list of existing arguments and attributes defined in the doc
    • returned as a list of string, each string represented a flattend field, eg. a.b.c
    • the parse might not be 100% accurate and not covered all corner cases. Whether a field is a nested object is determined by whether that field description contains a nested tag (some resource, eg. compute_instance params field does not have that in the description)
  • If the field is argument and not int he argument list returned by doc parser, then it's included in the result; similary for attribute
    • however, i'm not sure about the argument/attribute condition written in the code is correct or not.

Release Note Template for Downstream PRs (will be copied)


@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

@iyabchen iyabchen marked this pull request as ready for review July 19, 2024 23:23
@iyabchen iyabchen requested review from a team and shuyama1 and removed request for a team July 19, 2024 23:24
Copy link

@shuyama1 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@iyabchen iyabchen marked this pull request as draft July 25, 2024 19:08
@iyabchen iyabchen removed the request for review from shuyama1 July 25, 2024 19:08
@iyabchen
Copy link
Contributor Author

Found some bugs already, need some rework.

@iyabchen iyabchen force-pushed the diff-processor-missing-docs branch from a2f2de7 to 12ea5d1 Compare August 28, 2024 22:47
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

@shuyama1 shuyama1 self-requested a review September 4, 2024 01:28
@iyabchen iyabchen force-pushed the diff-processor-missing-docs branch from 12ea5d1 to 0e9ec45 Compare September 14, 2024 01:18
@iyabchen iyabchen marked this pull request as ready for review September 14, 2024 01:19
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

Copy link

@GoogleCloudPlatform/terraform-team @shuyama1 This PR has been waiting for review for 2 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

Copy link

github-actions bot commented Oct 7, 2024

@iyabchen, this PR is waiting for action from you. If no action is taken, this PR will be closed in 28 days.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

@shuyama1
Copy link
Member

shuyama1 commented Oct 7, 2024

Sorry for the delay! I just returned from vacation and am reviewing it now!

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

Errors

google provider:

  • Failed to build branch auto-pr-11156-old

@shuyama1
Copy link
Member

/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

Copy link

@iyabchen, this PR is waiting for action from you. If no action is taken, this PR will be closed in 14 days.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

@shuyama1
Copy link
Member

@iyabchen, this PR is waiting for action from you. If no action is taken, this PR will be closed in 14 days.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

I apologize for the delay in my review. I'm currently in another round of detailed review. Please ignore this message. Thank you for your patience!

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

Mostly looks good, some minor comments asking for more clarify and unit test coverages.


type MissingDocField struct {
Field string
Section string
Copy link
Member

Choose a reason for hiding this comment

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

I assume section indicates if this field is in argument or attribute section, IIRC? Can you add a small comment for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Section is removed since not differentiate argument and attribute now.

return ret, nil
}

func isAttribute(fieldDiff diff.FieldDiff) bool {
Copy link
Member

Choose a reason for hiding this comment

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

I might be reading this wrong - it seems that we still count the non-top level computed fields as attributes?

I’m starting to wonder that even if we only run the missing doc detector on newly added fields, inconsistencies in how attributes and arguments are divided in existing resource docs could still lead to issues(?), like for subfields added to existing objects. What are your thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided to not differentiate between argument and attribute, since finding some fields not conforming to that rule, eg. terraform_labels.

Copy link

@iyabchen, this PR is waiting for action from you. If no action is taken, this PR will be closed in 2 weekdays.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

Copy link

github-actions bot commented Nov 4, 2024

@iyabchen, this PR is being closed due to inactivity.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR hasn't generated any diffs, but I'll let you know if a future commit does.

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

LGTM overall! Thanks for putting in the work. Sorry for the delay in reviewing and merging—I’ve been a bit short on time to monitor CI changes. I’ll test it out this afternoon, and if everything goes well, I’ll merge it.

Next steps:

  • add the missing doc detector logic for the datasource (PR in progress)
  • surface this detector in the diff-report

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.

3 participants