refactor(loader): tighten the disabled gate and rehome the note
Address review: the gate module docstring now states the actual evaluation contexts (config after injections against the plugin context, disabled at every mount decision against the loader context); metadataExpressionErrors rejects expressions nested below disabled and syntax-checks the disabled expression itself so an unparseable gate fails at the gate instead of the boot. The tutorial's !!js claims follow, and the loader note moves to implemented/architecture with its inbound links retargeted.
This commit is contained in:
@@ -20,4 +20,20 @@ describe('verify-cordis-config metadata expressions', () => {
|
||||
const problems = metadataExpressionErrors({ id: { __jsExpr: 'process.platform' }, name: 'pkg' }, '[0]')
|
||||
expect(problems).toContain('[0].id: !!js is not interpolated here')
|
||||
})
|
||||
|
||||
it('rejects an expression nested below disabled (only the field itself interpolates)', () => {
|
||||
const problems = metadataExpressionErrors(
|
||||
{ id: 'tool-bash', name: 'pkg', disabled: { when: { __jsExpr: 'process.platform' } } },
|
||||
'[0]',
|
||||
)
|
||||
expect(problems).toContain('[0].disabled.when: !!js is not interpolated here')
|
||||
})
|
||||
|
||||
it('rejects a disabled expression that does not parse (the loader would fail the boot)', () => {
|
||||
const problems = metadataExpressionErrors(
|
||||
{ id: 'tool-bash', name: 'pkg', disabled: { __jsExpr: 'process.platform ===' } },
|
||||
'[0]',
|
||||
)
|
||||
expect(problems.some(problem => problem.includes('[0].disabled: disabled expression does not parse'))).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user