How do I debug a site template?

I’m a complete newbie trying to learn the Ghost DSL…
I have this on sidebar.hbs

{{!-- show the featured 5 articles on the home page --}}
{{#get "posts" filter="featured:true" limit="5" as |sidebar_featured_post|}}
    {{#if sidebar_featured_post}}
        {{> "sidebar/sidebar-story" widgetTitle=(t "Featured Posts") widgetPosts=sidebar_featured_post}}

which passes widgetPosts=sidebar_featured_post to sidebar/sidebar-story.

sidebar/sidebar-story.hbs picks up the var here

<div class="sidebar-items u-marginBottom30 u-flexColumn">
<h3 class="sidebar-title u-textColorDarker title-line">{{widgetTitle}}</h3>

{{#foreach widgetPosts}}
<div class="sidebar-post u-relative">
    <a href="{{url absolute="true"}}" class="u-flex">
        <span class="u-flex0 sidebar-post-border u-flexCenter u-fontSize36 u-fontWeightSemibold">{{@number}}</span>
        <h3 class="u-flex1 u-fontSize15 u-fontWeightMedium u-lineHeightTight u-flexCenter">{{title}}</h3>

but the foreach isn’t triggering. How do I debug this to see which posts are picked up by get, and what widgetPosts holds in sidebar-story.hbs?

Thank you

For anyone looking, it turned out that {{#foreach}} only picks up posts that are visibility: public. Adding visibility="all" as above fixed the issue so that foreach shows all the posts regardless of the visibility.