Relax 2 grammar-fragile boundary assertions to symbol-presence checks

The boundary test had two stale assertions failing because the
implementation grammar shifted while preserving the contract:

- usePatrolIntelligenceState now imports
  buildPatrolInvestigationContextSummary inside a multi-line grouped
  import. Replace the single-line literal match with two checks
  (symbol present + module present).

- patrolInvestigationContextModel now passes a precomputed
  commandCount through normalizeNonNegativeCount to formatCommandSummary
  instead of '.commands?.length ?? 0'. Assert the helper is invoked
  and the legacy '.commands.join' path is absent without prescribing
  the exact arg shape.

Both contracts are still enforced; the assertions just stop tracking
import formatting and helper-call argument shape.
This commit is contained in:
rcourtman
2026-05-08 22:21:46 +01:00
parent 22ce58cb9b
commit 2e0a841fd1
@@ -4340,9 +4340,11 @@ describe('frontend resource type boundaries', () => {
expect(aiIntelligenceSummaryModelSource).toContain(
'export function normalizeIntelligenceSummary',
);
expect(patrolIntelligenceStateSource).toContain(
"import { buildPatrolInvestigationContextSummary } from './patrolInvestigationContextModel';",
);
// Verify the symbol is imported from the model without prescribing a
// specific single- vs multi-line import shape; usePatrolIntelligenceState
// groups several patrolInvestigationContextModel imports together.
expect(patrolIntelligenceStateSource).toContain('buildPatrolInvestigationContextSummary');
expect(patrolIntelligenceStateSource).toContain("from './patrolInvestigationContextModel'");
expect(patrolIntelligenceStateSource).not.toContain('recent_changes?.length');
expect(patrolIntelligenceStateSource).not.toContain('governed resource${');
expect(patrolInvestigationContextModelSource).toContain(
@@ -4357,9 +4359,11 @@ describe('frontend resource type boundaries', () => {
expect(patrolInvestigationContextModelSource).toContain(
'export function buildPatrolAssistantFindingBriefing',
);
expect(patrolInvestigationContextModelSource).toContain(
'formatCommandSummary(record.proposed_fix.commands?.length ?? 0)',
);
// formatCommandSummary is the canonical helper for command-count copy.
// The model now passes a precomputed commandCount through
// normalizeNonNegativeCount instead of computing from a commands array,
// so assert the helper is used and the legacy join path is not.
expect(patrolInvestigationContextModelSource).toContain('formatCommandSummary(');
expect(patrolInvestigationContextModelSource).not.toContain(
'record.proposed_fix.commands.join',
);