Transport import: case-insensitive name collision in ApplyTemplatesAsync dictionary; preview N+1; stale flattener doc #93
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found during #47 (transport import performance):
ApplyTemplatesAsyncbuilds a dictionary from a by-name DB query. Under SQL Server's case-insensitive collation two templates whose names differ only in case would make that dictionary throw. Untested — check whether template names are already unique case-insensitively (constraint/validation); if not, add a test and a case-insensitive comparer.Component-TemplateEngine.mdsays the flattener reads GetAllTemplatesAsync; no such call found in the Flattening code — verify and fix the doc.Fixed on main
c7d868c5: (a) base templates are already unique case-insensitively (filtered unique index on Template.Name where IsDerived=0, CI collation), but derived templates aren't covered, and the old ordinal dictionaries also missed 'PUMP' vs 'Pump'. ApplyTemplatesAsync and preview now use a non-throwing case-insensitive lookup, base wins over derived. (b) preview reads database connections / notification lists / API methods once via GetAll*Async and matches case-insensitively (apply-side lookups unchanged). (c) Component-TemplateEngine.md corrected — the flattener loads chains via GetTemplateWithChildrenAsync memoised per FlattenSession, never GetAllTemplatesAsync. Tests: ImportNameLookupTests (call-counting proxy: 0 by-name queries, 1 GetAll per library, differently-cased target names not reported New; duplicate case variants; base-over-derived) — all 3 fail with the old lookup. Transport 198, Transport.IntegrationTests 141 passed; slnx 0 warnings.