fix: name assets-only edges by what is built from what

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-09-30 16:43:55 +02:00
co-authored by Claude Opus 5.5
parent 358b7dec44
commit 6fb492fabf
2 changed files with 12 additions and 2 deletions
@@ -46,6 +46,6 @@ describe('describeEdge', () => {
nameOf,
dataOf
)
).toEqual({ subject: 'raw', phrase: 'feeds', object: 'clean', note: 'Via Clean.' })
).toEqual({ subject: 'clean', phrase: 'is built from', object: 'raw', note: 'By Clean.' })
})
})
@@ -1,4 +1,5 @@
import { describeSchedule } from '$lib/utils/describeCron'
import { NO_ASSET_NODE_ID } from './assetsOnlyView'
/** What a hovered edge says: "`subject` `phrase` `object`", then a note. */
export type EdgeDescription = { subject: string; phrase: string; object?: string; note?: string }
@@ -70,7 +71,16 @@ export function describeEdge(
}
case 'asset-flow': {
const via = (e.via ?? []).map(nameOf).join(', ')
return { subject: src, phrase: 'feeds', object: tgt, note: via ? `Via ${via}.` : undefined }
// The scripts that build nothing only read: name them, not the node.
if (e.target === NO_ASSET_NODE_ID) {
return { subject: src, phrase: 'is read by', object: via || tgt }
}
return {
subject: tgt,
phrase: 'is built from',
object: src,
note: via ? `By ${via}.` : undefined
}
}
case 'dbt-ref':
return { subject: tgt, phrase: 'references', object: src, note: 'dbt ref().' }