A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
JavaScript claude-code-pluginclaude-code-skillscode-appsgithub-copilot-pluginpower-appspower-pagespower-platform
plan-alm renderer: surface tableCount discovery scope (a 0 isn't always a tiny site) (#205)
T-Nid8456f9d2e9ae
diff --git a/plugins/power-pages/scripts/lib/compute-split-plan.js b/plugins/power-pages/scripts/lib/compute-split-plan.jsindex 41b7155c3..19f9ec3ff 100644--- a/plugins/power-pages/scripts/lib/compute-split-plan.js+++ b/plugins/power-pages/scripts/lib/compute-split-plan.js@@ -61,6 +61,11 @@ function buildSizeAnalysis(estimate, thresholds) {tableCount: {value: estimate.tableCount,tier: classifyTier(estimate.tableCount, 10, thresholds.maxTableCount),+ // Carry the discovery scope so the renderer can disambiguate a genuine+ // "0 tables" from "couldn't enumerate" — without it a 0 reads as a tiny+ // site. estimate.tableCountScope ∈ "site-referenced" | "manifest-only" |+ // "unavailable" (the last → 0 tables by default, not a confirmed empty schema).+ scope: estimate.tableCountScope || null,},webFilesAggregateMB: {value: estimate.webFilesAggregateMB,diff --git a/plugins/power-pages/scripts/tests/compute-split-plan.test.js b/plugins/power-pages/scripts/tests/compute-split-plan.test.jsindex 635b93d32..9000e4486 100644--- a/plugins/power-pages/scripts/tests/compute-split-plan.test.js+++ b/plugins/power-pages/scripts/tests/compute-split-plan.test.js@@ -45,6 +45,22 @@ function baseEstimate(overrides = {}) {};}+// --- buildSizeAnalysis: tableCountScope passthrough -------------------------++test('buildSizeAnalysis carries tableCountScope onto sizeAnalysis.tableCount.scope', () => {+ const thresholds = baseConfig().thresholds;+ const a = buildSizeAnalysis(baseEstimate({ tableCount: 0, tableCountScope: 'unavailable' }), thresholds);+ assert.equal(a.tableCount.value, 0);+ assert.equal(a.tableCount.scope, 'unavailable', 'scope must pass through so the renderer can disambiguate a real 0 from "could not enumerate"');++ const b = buildSizeAnalysis(baseEstimate({ tableCount: 7, tableCountScope: 'site-referenced' }), thresholds);+ assert.equal(b.tableCount.scope, 'site-referenced');++ // Older estimate blobs without the field → null (renderer omits the note).+ const c = buildSizeAnalysis(baseEstimate({ tableCount: 3 }), thresholds);+ assert.equal(c.tableCount.scope, null);+});+// --- selectStrategy branches ------------------------------------------------test('Scenario A (typical customer): Green everywhere → single solution', () => {diff --git a/plugins/power-pages/scripts/tests/render-alm-plan.test.js b/plugins/power-pages/scripts/tests/render-alm-plan.test.jsindex f91b17f63..30f0e7b5b 100644--- a/plugins/power-pages/scripts/tests/render-alm-plan.test.js+++ b/plugins/power-pages/scripts/tests/render-alm-plan.test.js@@ -1980,3 +1980,56 @@ test('render-alm-plan: omits the Completed footer line when COMPLETED_AT is absefs.rmSync(tmpDir, { recursive: true, force: true });}});++// ── tableCount discovery-scope annotation (Size Analysis signal) ──────────────++test('render-alm-plan: tableCount "unavailable" scope renders a clarifying note (a 0 is not a tiny site)', () => {+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'render-alm-out-'));+ const outputPath = path.join(tmpDir, 'alm-plan.html');+ try {+ const data = makeValidData({+ sizeAnalysis: { tableCount: { value: 0, tier: 'green', scope: 'unavailable' } },+ });+ const { status } = runScript(data, outputPath);+ assert.equal(status, 0);+ const html = fs.readFileSync(outputPath, 'utf8');+ assert.match(html, /signal-scope-info/, 'an under-reporting scope must render the scope note');+ assert.match(html, /unavailable/i);+ assert.match(html, /not.*a confirmed empty schema/i);+ } finally {+ fs.rmSync(tmpDir, { recursive: true, force: true });+ }+});++test('render-alm-plan: tableCount "manifest-only" scope renders the manifest caveat', () => {+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'render-alm-out-'));+ const outputPath = path.join(tmpDir, 'alm-plan.html');+ try {+ const data = makeValidData({+ sizeAnalysis: { tableCount: { value: 2, tier: 'green', scope: 'manifest-only' } },+ });+ const { status } = runScript(data, outputPath);+ assert.equal(status, 0);+ const html = fs.readFileSync(outputPath, 'utf8');+ assert.match(html, /signal-scope-info/);+ assert.match(html, /datamodel manifest only/i);+ } finally {+ fs.rmSync(tmpDir, { recursive: true, force: true });+ }+});++test('render-alm-plan: tableCount "site-referenced" (complete) scope renders NO scope note', () => {+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'render-alm-out-'));+ const outputPath = path.join(tmpDir, 'alm-plan.html');+ try {+ const data = makeValidData({+ sizeAnalysis: { tableCount: { value: 5, tier: 'green', scope: 'site-referenced' } },+ });+ const { status } = runScript(data, outputPath);+ assert.equal(status, 0);+ const html = fs.readFileSync(outputPath, 'utf8');+ assert.doesNotMatch(html, /signal-scope-info/, 'the complete scope must not add a caveat');+ } finally {+ fs.rmSync(tmpDir, { recursive: true, force: true });+ }+});diff --git a/plugins/power-pages/skills/plan-alm/scripts/render-alm-plan.js b/plugins/power-pages/skills/plan-alm/scripts/render-alm-plan.jsindex b19487f77..184ab5a84 100644--- a/plugins/power-pages/skills/plan-alm/scripts/render-alm-plan.js+++ b/plugins/power-pages/skills/plan-alm/scripts/render-alm-plan.js@@ -354,6 +354,18 @@ function buildSignalCards() {signalExtras += `<div class="signal-sample-info" style="font-size:11px;margin-top:6px;padding-top:6px;border-top:1px solid var(--surface2);color:var(--text-dim);">Aggregate extrapolated from a stratified sample of <strong>${webFileSampleSize}</strong> of <strong>${webFileCount.toLocaleString()}</strong> web files.</div>`;}}+ // Tables signal annotation: a 0 / low count means different things depending+ // on HOW the tables were discovered. "site-referenced" is the complete signal+ // (table-permissions ∩ env custom tables); the other two scopes can under-report+ // — surface that so a reviewer doesn't read a 0 as a confirmed empty schema.+ if (s.key === 'tableCount' && a.scope && a.scope !== 'site-referenced') {+ const scopeNote = a.scope === 'unavailable'+ ? 'Custom-table discovery was <strong>unavailable</strong> (no table-permission source resolved) — this count defaults to 0, <strong>not</strong> a confirmed empty schema.'+ : a.scope === 'manifest-only'+ ? 'Counted from the datamodel manifest only (the live environment table list was unavailable) — may differ from what is actually deployed.'+ : `Discovery scope: <strong>${escapeHtml(a.scope)}</strong>.`;+ signalExtras += `<div class="signal-scope-info" style="font-size:11px;margin-top:6px;padding-top:6px;border-top:1px solid var(--surface2);color:var(--text-dim);">${scopeNote}</div>`;+ }return `<div class="signal-card"><div class="signal-name">${s.label}</div><div class="signal-value" style="color:${color};">${valueDisplay}</div>