T-139: M2.4a — Versioned Feature Library core: declarative DuckDB SQL feature definitions + registerSignal registry + versioned Parquet batch-plan runner over an injected DuckDbExecutor in libs/research/src/feature-library.ts (pure, no new deps)
This commit is contained in:
parent
94d8631d40
commit
98451ee07c
2 changed files with 75 additions and 0 deletions
|
|
@ -1166,6 +1166,59 @@ describe('QA: relation-source allow-list and Vault boundary edge cases', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('allows POSITIONAL JOIN between declared inputs and fails closed on unknown join modifiers or unparsed JOIN tokens', () => {
|
||||
expect(() =>
|
||||
validateFeatureDefinition(
|
||||
makeSimpleDef({
|
||||
inputs: ['bars_1d', 'fx_1d'],
|
||||
sql: 'SELECT b.listing_id, b.ts, b.ts AS known_at, b.close / f.rate AS value FROM {{input:bars_1d}} AS b POSITIONAL JOIN {{input:fx_1d}} AS f',
|
||||
})
|
||||
)
|
||||
).not.toThrow();
|
||||
|
||||
expect(() =>
|
||||
validateFeatureDefinition(
|
||||
makeSimpleDef({
|
||||
inputs: ['bars_1d', 'fx_1d'],
|
||||
sql: 'SELECT listing_id, ts, ts AS known_at, close AS value FROM {{input:bars_1d}} POSITIONAL JOIN {{input:fx_1d}} AS f',
|
||||
})
|
||||
)
|
||||
).not.toThrow();
|
||||
|
||||
// Unknown modifier immediately after FROM/alias must fail closed (never fall through to expression scan).
|
||||
expectFeatureErrorCode(
|
||||
() =>
|
||||
validateFeatureDefinition(
|
||||
makeSimpleDef({
|
||||
sql: 'SELECT b.listing_id, b.ts, b.ts AS known_at, b.close AS value FROM {{input:bars_1d}} AS b LATERAL_UNKNOWN JOIN staging_tbl AS s',
|
||||
})
|
||||
),
|
||||
'INVALID_SQL_STATEMENT'
|
||||
);
|
||||
|
||||
// Chained JOIN after an ON predicate with an unknown modifier still hits relation allow-list validation.
|
||||
expectFeatureErrorCode(
|
||||
() =>
|
||||
validateFeatureDefinition(
|
||||
makeSimpleDef({
|
||||
sql: 'SELECT b.listing_id, b.ts, b.ts AS known_at, b.close AS value FROM {{input:bars_1d}} AS b JOIN {{input:bars_1d}} AS c ON b.ts = c.ts UNKNOWN_MOD JOIN staging_tbl AS s',
|
||||
})
|
||||
),
|
||||
'EXTERNAL_DATA_ACCESS'
|
||||
);
|
||||
|
||||
// Unparsed JOIN keyword inside a WHERE expression tail must fail closed.
|
||||
expectFeatureErrorCode(
|
||||
() =>
|
||||
validateFeatureDefinition(
|
||||
makeSimpleDef({
|
||||
sql: 'SELECT b.listing_id, b.ts, b.ts AS known_at, b.close AS value FROM {{input:bars_1d}} AS b WHERE b.close > 0 JOIN staging_tbl AS s',
|
||||
})
|
||||
),
|
||||
'INVALID_SQL_STATEMENT'
|
||||
);
|
||||
});
|
||||
|
||||
it('accepts a leap-day cutoff and clamps the cutoff year to the last microsecond of the prior day', () => {
|
||||
const writes = planFeatureBatch(RET_1D_V1, {
|
||||
curatedRoot: '/c',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue