Skip to content

Conversation

@jpblancoder
Copy link
Contributor

@jpblancoder jpblancoder commented Oct 6, 2025

Hi Arc XP team, initially a bug fix for the content sources issue that I previously mentioned.

Plus additional improvements and some new scripts that I thought would be helpful. I had to make some assumptions about the database schema column values. Let me know if you have any questions, about my intentions.

Breaking changes

  • Move "Global content sources in resolvers" from all-content-sources-usage.sh to new all-content-sources-resolvers.sh file. Both scripts now support CSV output.

New features

  • Create find-features-by-content-source.sh to find features that use a specific content source (with like search). Supports CSV output.
  • Create find-resolvers-by-content-source.sh to find resolvers that use a specific content source (with exact match). Supports CSV output.
  • Create view-page-or-template.sh to dump the view to a file for debugging. Supports CSV output.
  • Create view-rendering.sh to dump the view to a file for debugging. Supports CSV output.
  • Create view-resolver.sh to dump the view to a file for debugging. Supports CSV output.
  • Add _debug files and *.csv to .gitignore. For temporary debugging files and saving CSV output files.

Improvements

  • Update _duckdb-views.sql to pass down the feature/chain fingerprint column value, to help developer's easier identify the desired block in PB Editor view.
  • Update describe-page-or-template.sh to order by chainName or featureName column, instead of countOfTimesUsed column. This should help a dev scan the items for specific blocks more quickly.
  • Update all-page-urls.sh to add published (version Id) column, order by uri column, and correct script help output.
  • Update find-pages-by-chain-name.sh to order by 3 column values, instead of none.
  • Update find-pages-by-feature-name.sh to order by 3 column values, instead of none.
  • Update find-pages-by-uri.sh to order by 3 column values, instead of none. Correct script help output.
  • Update README.md and help.sh with new terminal commands.

Bug fixes

  • Update _duckdb-views.sql to move view_resolver processing to top of file, and convert two columns to integers. Not a bug, just reorganizing the file, since I also move the next view.
  • Update _duckdb-views.sql to move view_page_and_template processing to top of file. Used by the following view, so it needs to be declared above it, as it's used to help solve the primary bug.
  • Update _duckdb-views.sql to view_rendering to remove unwanted rendering items when converting.
    • PublishedLayoutItems: Only include rendering items from published versions, according to the view_page_and_template view.
    • LatestLayoutItems: Only include the latest rendering, by creation date, for each page's published version.
    • The above two changes reduces the number of rendering items from 461,965 to 10,535 (97.7% reduction). Which greatly improves the execution speed of SQL queries in various scripts.
    • Stop recursively unnest() certain column values, by only un-nesting a single level. To avoid variants property un-nesting found in features. Which I assume we can safely ignore. Correct me, if that's wrong.
  • Correctly determine the content source(s) for features and chains, by checking the customFields for contentService key. The value saved is a delimited, e.g. "content-service-1|another-service-2|other-service-3". Since feature blocks can have multiple content sources configured via their customFields.
  • Include commented-out code to "Optionally exclude feature-linked children feature blocks". If a developer only cares about finding the feature-linked parent feature blocks. Excluding them would reduce the noise (amount of features) that some scripts output.

@jpblancoder jpblancoder marked this pull request as ready for review October 6, 2025 01:03
Copy link
Collaborator

@mfyz mfyz left a comment

Choose a reason for hiding this comment

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

Everything looks great 👏 Thanks @jpblancoder for the new scripts and improvements on both existing scripts, help and README formatting.

QUERY="COPY ($QUERY) TO STDOUT WITH (FORMAT CSV, HEADER);"
else
# Print the header
YELLOW='\033[0;33m'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Excellent. Thanks for fixing the CSV output to be pure for piping.

WHERE isPageOrTemplate = 'Page'
AND published IS NOT NULL"
AND published IS NOT NULL
ORDER BY uri ASC"
Copy link
Collaborator

Choose a reason for hiding this comment

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

👌

2. all-features-usage.sh [-c]
Shows all features used in published pages, templates and how many times they are used
📄 ${GREEN}describe-page-or-template.sh${RESET} -i <page_or_template_id>
Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks for formatting and organizing the help output. Looks great.

@mfyz mfyz merged commit 73bfd86 into arcxp:main Oct 14, 2025
@gmacgregor
Copy link

@mfyz please consider trumpeting these excellent additions in a ArcXP release note or perhaps over at https://github.com/orgs/arcxp/discussions :)

@mfyz
Copy link
Collaborator

mfyz commented Oct 14, 2025

100%. I'll update the corresponding ALC doc, post a gh-discussions post to both celebrate and give credit to awesome TGAM team.
I'll request it to be added in upcoming release note emails as well.
Thanks for the excellent contribution.

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