From cd584c024726ad8c41aab12a2b416731ba38bd0a Mon Sep 17 00:00:00 2001 From: Enrico Piovesan Date: Wed, 9 Sep 2026 19:30:54 -0600 Subject: [PATCH] fix(discover): more representative goal set, drop the no-plan card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feedback: the examples weren't representative and the "no structural path" card read as broken. Replace the three goals with ones that all produce a real successful run: - "Score how uncertain a reporting period is" — the summary.aggregate -> uncertainty.score chain (the only pure_read multi-node chain that exists in the registry today; period.finalize can't be forced into it since summary's inputs are already satisfiable from the facts, so the blurb no longer over-claims three). - "Price a quote" — core.calculate-price@1.2.0. - "Check a card number" — validation.validate-luhn@1.2.0 (tangible, executes in-browser fine despite a local-only preferred target). The no-plan renderNoPlan path stays as defensive handling if a live goal ever returns zero candidates. E2E: the no-plan spec is replaced by a validate-luhn plan+execute spec. npm test 5/5 (+1 skip); CHECK_REGISTRY green; build clean; test:e2e 2/2; all three goals browser-verified to terminal: succeeded. Co-Authored-By: Claude Sonnet 5 --- src/scripts/discover.js | 23 +++++++++++------------ tests/e2e/discover.spec.mjs | 16 +++++++++------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/scripts/discover.js b/src/scripts/discover.js index f29502a..3722856 100644 --- a/src/scripts/discover.js +++ b/src/scripts/discover.js @@ -22,8 +22,8 @@ const CONTRACT_SCHEMA_VERSION = '1.0.0'; const GOALS = [ { id: 'coverage', - label: 'Score the uncertainty of a reporting period', - blurb: 'Target: uncertainty.score. Facts: a partial coverage state with two included and one pending reference.', + label: 'Score how uncertain a reporting period is', + blurb: 'Aggregate a period’s included and pending references, then score the remaining uncertainty — the planner chains summary.aggregate into uncertainty.score on its own.', kind: 'chain', target: { capability_id: 'uncertainty.score', capability_version: '1.1.0' }, candidate_refs: [ @@ -39,8 +39,8 @@ const GOALS = [ }, { id: 'price', - label: 'Price a small quote', - blurb: 'Target: core.calculate-price. Facts: one line item, a versioned pricing config.', + label: 'Price a quote', + blurb: 'One line item, two units at $50, a versioned pricing config with no discounts or tax — target core.calculate-price.', kind: 'single', target: { capability_id: 'core.calculate-price', capability_version: '1.2.0' }, candidate_refs: [ @@ -56,16 +56,15 @@ const GOALS = [ }, }, { - id: 'noplan', - label: 'A goal with no structural path', - blurb: 'Target: core.calculate-price. Facts: only a currency — nothing produces the line items or pricing config it needs.', - kind: 'none', - target: { capability_id: 'core.calculate-price', capability_version: '1.2.0' }, + id: 'luhn', + label: 'Check a card number', + blurb: 'Does a 16-digit number pass the Luhn checksum? Facts: one number string — target validation.validate-luhn.', + kind: 'single', + target: { capability_id: 'validation.validate-luhn', capability_version: '1.2.0' }, candidate_refs: [ - { namespace: 'core', id: 'core.calculate-price', versionRange: '1.2.0' }, - { namespace: 'summary', id: 'summary.aggregate', versionRange: '1.1.0' }, + { namespace: 'validation', id: 'validation.validate-luhn', versionRange: '1.2.0' }, ], - starting_facts: { currency: 'USD' }, + starting_facts: { number: '4242424242424242' }, }, ]; diff --git a/tests/e2e/discover.spec.mjs b/tests/e2e/discover.spec.mjs index 7ed67f6..07bee3a 100644 --- a/tests/e2e/discover.spec.mjs +++ b/tests/e2e/discover.spec.mjs @@ -20,15 +20,17 @@ test('goal 1 auto-plans on load, then review + execute for real against the live await expect(page.locator('#discover-log')).toContainText('executed offline in your browser'); }); -test('the no-structural-path goal returns "no plan" as a real outcome, not an error', async ({ page }) => { +test('a single-capability goal (card checksum) plans and executes for real', async ({ page }) => { test.slow(); await page.goto('/discover.html'); await expect(page.locator('#discover-badge')).toHaveText('Planned — review the mappings', { timeout: 45_000 }); - await page.locator('.discover-goal[data-goal="noplan"]').click(); - await expect(page.locator('#discover-badge')).toHaveText('No plan — the goal has no structural path', { timeout: 45_000 }); - await expect(page.locator('#discover-result')).toHaveAttribute('data-outcome', 'noplan'); - await expect(page.locator('#discover-plan-mappings')).toContainText('No structural candidate'); - await expect(page.locator('#discover-exec')).toBeHidden(); - await expect(page.locator('#discover-log')).toContainText('0 candidates'); + await page.locator('.discover-goal[data-goal="luhn"]').click(); + await expect(page.locator('#discover-plan-target')).toHaveText('validation.validate-luhn@1.2.0', { timeout: 45_000 }); + await expect(page.locator('#discover-badge')).toHaveText('Planned — review the mappings'); + + await page.locator('#discover-exec').click(); + await expect(page.locator('#discover-badge')).toHaveText('Executed — real, offline, governed', { timeout: 45_000 }); + await expect(page.locator('#discover-trace')).toContainText('terminal: succeeded'); + await expect(page.locator('#discover-trace')).toContainText('validation.validate-luhn@1.2.0'); });