Skip to content

Conversation

williamdalessandro
Copy link
Contributor

@williamdalessandro williamdalessandro commented Sep 18, 2025

Links

Preview Link showing the response of the test page post exclusion
Asana task

What

This is an implementation of version based directives specifically for Vault- differs from the TFC and TFEnterprise exclusions because those were simplified. Does accurate parsing of the version numbers along with relevant error handling/checks. Created new test suite for the new vault exclusions and added in new test to terraform exclusions

Why

Requested in the above asana ticket

How

Extends upon the existing script and copies the same format however it has unique checks since the exclusion operation is more involved. Made the code look identical so it can be easier to abstract in the future so that any product can have access to inclusions/exclusions, right now it just gets the job done.

Pics

The exclusion file
Screenshot 2025-09-18 at 4 53 11 AM

The result when ran
Screenshot 2025-09-18 at 4 28 41 AM

Testing

Can run

npx vitest scripts/prebuild/mdx-transforms/exclude-vault-content/index.test.mjs

and

npx vitest scripts/prebuild/mdx-transforms/exclude-terraform-content/index.test.mjs

in terminal to see the tests run for these. Added in a testing file

/content/vault/v1.20.x/content/docs/concepts/client-count/test-vault-exclusion.mdx

to see inclusions/exclusions at work. Will remove that file from the PR but want it around for testing reference.

Can spin up locally and see the page at

http://localhost:3000/vault/docs/concepts/client-count/test-vault-exclusion

or

http://localhost:3000/vault/docs/v1.20.x/concepts/client-count/test-vault-exclusion

Other info

Had to recompile the binaries since these are changes that take place in the scripts folder

Things left to do:

  • The following files need to be updated to account for vault exclusions

  • build-mdx-transforms-file.mjs - Added in and tests work

  • build-mdx-transforms-file.test.mjs (No change necessary here)

  • remove this testing file once the PR is deemed as good to go

  • Create a new ticket proposing a new structure change to make this more extensible with a plugin based OOP architecture

@williamdalessandro williamdalessandro requested review from a team as code owners September 18, 2025 08:58
@github-actions github-actions bot added the Vault Content update for Vault product docs label Sep 18, 2025
Copy link

github-actions bot commented Sep 18, 2025

Vercel Previews Deployed

Name Status Preview Updated (UTC)
Dev Portal ✅ Ready (Inspect) Visit Preview Tue Oct 7 18:52:02 UTC 2025
Unified Docs API ✅ Ready (Inspect) Visit Preview Tue Oct 7 18:42:57 UTC 2025

Copy link

github-actions bot commented Sep 18, 2025

Broken Link Checker

No broken links found! 🎉


This content should always appear.

<!-- BEGIN: VLT:>=v1.21.x -->
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make sure not to include this file when we ship this PR.

Copy link
Contributor

@RubenSandwich RubenSandwich left a comment

Choose a reason for hiding this comment

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

Let's created a shared.mjs file to keep some of the duplication down and keep the remark transforms contained.

https://github.com/hashicorp/web-unified-docs/pull/962/files#r2361077992

@RubenSandwich
Copy link
Contributor

RubenSandwich commented Sep 29, 2025

Does the inclusion work for partials?

@schavis Hey so from looking at the code, content is excluded before partials are processed, so this would mean that it currently doesn't work for partials- however I'll work to change that

@williamdalessandro it looks like that was done on purpose, by me; https://github.com/hashicorp/web-unified-docs-internal/pull/237/commits/c2c9dd65a7e699a9877c63a5d0e2b230d3a0bb6e. I can't exactly remember why though as it was during a push to get some TFE documentation out the door. I dug through a bunch of slack chat logs and this was the closest I could find that might give a hint here.

Overall what I am saying is that I am okay with changing it, but let's add some tests for the partial then remove content Plugin workflow. In the slack conversation it looks like a bunch of conversation is around this page: https://github.com/hashicorp/web-unified-docs/blob/main/content/terraform-docs-common/docs/cloud-docs/api-docs/index.mdx. So let's base our partial then remove content Plugin workflow tests around that page.

RubenSandwich
RubenSandwich previously approved these changes Oct 2, 2025
Copy link
Contributor

@RubenSandwich RubenSandwich left a comment

Choose a reason for hiding this comment

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

Looks great @williamdalessandro!

// before deciding whether to remove this node
// const hadChildren = !!node.children
const wasInsideRange = insideRange
if (node.children) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding tests to cover all of this. It definitely seemed like this rabbit hole went deep. 😢

RubenSandwich
RubenSandwich previously approved these changes Oct 7, 2025
Copy link
Contributor

@RubenSandwich RubenSandwich left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for covering these cases with tests.

Just one question with these changes: https://github.com/hashicorp/web-unified-docs/pull/962/files#r2410883284.

@williamdalessandro williamdalessandro marked this pull request as draft October 7, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HCP Terraform Vault Content update for Vault product docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants