mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-03 07:18:03 +01:00
fix(sealed): strip quotes before the label-key prefilter so a quoted header fragment still joins
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
502562dfd0
commit
cf03cc74ac
2 files changed
+3
-1
No files matched your search
+1
-1
@@ -136,7 +136,7 @@ export function fileRecords(file: string, text: string): Field[][] | null {
|
||||
|
||||
/** Joined-record fingerprints of one file's text; null when it cannot be checked. */
|
||||
export function fileJoins(file: string, text: string, p: JoinPolicy): Joins | null {
|
||||
const folded = normalizeKey(text);
|
||||
const folded = normalizeKey(text.replace(/"/g, ''));
|
||||
if (!text.includes('\\u') && !p.label_keys.some(k => folded.includes(normalizeKey(k)))) return new Map();
|
||||
const records = fileRecords(file, text);
|
||||
if (!records) return null;
|
||||
|
||||
@@ -88,6 +88,7 @@ describe('formats and matching', () => {
|
||||
'k.jsonl': `{"${HEAD_B}":{"stratum":"seeded"}}\n`,
|
||||
'l.json': '{"units":{"unit-one":{"stratum":"decoy"}}}\n',
|
||||
'm.tsv': '"Stratum"\t"head"\n"decoy"\t"5b7db3a"\n',
|
||||
'n.csv': '"Strat"um,head\ndecoy,5b7db3a\n',
|
||||
'tsconfig.json': '{\n // a comment, so not strict JSON\n "compilerOptions": { "strict": true }\n}\n',
|
||||
});
|
||||
expect(found(s).sort((a, b) => a.file.localeCompare(b.file))).toEqual([
|
||||
@@ -99,6 +100,7 @@ describe('formats and matching', () => {
|
||||
{ rule: 'sealed.label_join', file: 'j.json', commit: sha, keys: ['stratum', 'tags', '(key)'] },
|
||||
{ rule: 'sealed.label_join', file: 'k.jsonl', commit: sha, keys: ['stratum', '(key)'] },
|
||||
{ rule: 'sealed.label_join', file: 'm.tsv', commit: sha, keys: ['stratum', 'head'] },
|
||||
{ rule: 'sealed.label_join', file: 'n.csv', commit: sha, keys: ['stratum', 'head'] },
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user