Skip to content

Commit 1a8301a

Browse files
dmealingclaude
andcommitted
refactor(metadata): collapse FilterAttr.coerce no-op ternary; fix stale desugar comment
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3380a04 commit 1a8301a

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

server/typescript/packages/metadata/src/loader/validation-passes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ function checkFilterClauses(
338338
);
339339
continue;
340340
}
341-
// After parse-time desugaring (normalizeFilterAttr), every non-composition field clause
341+
// After parse-time desugaring (FilterAttr.desugar), every non-composition field clause
342342
// is canonical { op: value } — a bare scalar should not reach here; the object guard is defensive.
343343
if (typeof clause === "object" && clause !== null && !Array.isArray(clause)) {
344344
for (const op of Object.keys(clause)) {

server/typescript/packages/metadata/src/meta/meta-attr-filter.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ export class FilterAttr extends MetaAttr {
2222
}
2323

2424
override coerce(raw: unknown): AttrValue {
25-
// Object stored verbatim; a non-object (e.g. a legacy JSON string) is
26-
// returned as-is so validateValue rejects it.
27-
return typeof raw === "object" && raw !== null && !Array.isArray(raw)
28-
? (raw as AttrValue)
29-
: (raw as AttrValue);
25+
// Stored verbatim: an object is the canonical shape; a non-object (e.g. a
26+
// legacy JSON string) is passed through unchanged so validateValue rejects it.
27+
return raw as AttrValue;
3028
}
3129

3230
override desugar(value: AttrValue): AttrValue {

0 commit comments

Comments
 (0)