Skip to content

fix: infer namespace for namespaced model spec tests edges (v1.0.44) - #32

Merged
kanehooper merged 1 commit into
mainfrom
eval/blast-radius-v1.0.44
Apr 6, 2026
Merged

kanehooper merged 1 commit into
mainfrom
eval/blast-radius-v1.0.44

Conversation

@kanehooper

Copy link
Copy Markdown
Contributor

Summary

Spec files nested under namespaced subdirectories of spec/models/ (e.g. spec/models/salesforce/service_provider_spec.rb) were silently dropped from blast radius impactedTests results.

Root Cause

In src/core/graph.js, the spec→model edge builder derived the model class name purely from the filename:

const className = classify(basename) // service_provider → ServiceProvider

For spec/models/salesforce/service_provider_spec.rb, this produced ServiceProvider. Since extractions.models['ServiceProvider'] did not exist (only 'Salesforce::ServiceProvider' did), no "tests" edge was created and the spec never appeared in impactedTests.

Fix

Before checking extractions.models, infer the namespace from any subdirectory segments between models/ and the spec filename. The code now tries the namespaced FQN first (Salesforce::ServiceProvider), falls back to the plain class name (ServiceProvider), and silently skips only if neither exists in the model map.

// spec/models/salesforce/service_provider_spec.rb
// nsDirs = ['salesforce'] → namespacedClassName = 'Salesforce::ServiceProvider'
const resolvedModelName =
  extractions.models[namespacedClassName] ? namespacedClassName :
  extractions.models[className]           ? className           : null

Plain (non-namespaced) specs are unaffected.

Test

Adds: 'creates tests edge from namespaced model spec to FQN' in test/core/graph.test.js

Eval

get_blast_radius mean composite: 1.000 (6/6 apps, 25 probes)
All 1701 unit tests pass

Spec files in subdirectories under spec/models/ (e.g.
spec/models/salesforce/service_provider_spec.rb) were silently
dropped from blast radius impactedTests because the edge builder
derived the class name from basename only (ServiceProvider) while
extractions.models keyed by FQN (Salesforce::ServiceProvider).

Fix: infer namespace from directory structure between models/ and
the spec filename, try namespaced FQN first in extractions.models,
fall back to plain class name. Plain (non-namespaced) specs are
unaffected.

Adds test: 'creates tests edge from namespaced model spec to FQN'

Fixes blast radius test discovery for namespaced models.

Eval: get_blast_radius mean composite 1.000 (6/6 apps, 25 probes)
closes eval/blast-radius-v1.0.44
@kanehooper
kanehooper merged commit f8c86eb into main Apr 6, 2026
0 of 3 checks passed
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.

1 participant