refactor(field-mapper): sort filename-safe types for deterministic output

airtable/seatable의 FILENAME_SAFE_TYPES 배열만 정의 순서가 정렬되지 않은
상태로 남아 있었다. settings-tab은 이 배열을 join(', ')으로 "Filtered to: …"
안내 문구에 그대로 노출하므로, 정렬되지 않은 순서가 그대로 사용자에게 보이는
비결정적 출력이 된다.

- 두 배열을 알파벳순으로 정렬 — 이미 모든 SUBFOLDER_SAFE_TYPES(3개 provider)와
  supabase의 FILENAME_SAFE_TYPES/READ_ONLY_TYPES가 따르던 컨벤션과 일치
- FieldTypeMapper 인터페이스 JSDoc에 getFilenameSafeTypes/getSubfolderSafeTypes의
  sorted+deduplicated 계약 명시 — 테스트로만 암묵 보장되던 불변식을 문서화
- 두 매퍼 단위 테스트의 기대 순서 동기화
This commit is contained in:
uppinote20 2026-06-11 17:13:46 +09:00 committed by uppinote
parent c21869d131
commit ec8a33f4f6
5 changed files with 16 additions and 14 deletions

View file

@ -16,10 +16,10 @@ import type { FieldTypeMapper, StandardFieldType } from '../types';
// value is server-computed) but still safe to use as a filename source
// because the computed value is stable and typically text-like.
const FILENAME_SAFE_TYPES = [
'formula',
'number',
'singleLineText',
'singleSelect',
'number',
'formula',
] as const;
const READ_ONLY_TYPES = [

View file

@ -18,11 +18,11 @@ import type { FieldTypeMapper, StandardFieldType } from '../types';
// `formula` appear here AND in READ_ONLY_TYPES below: they're great
// stable identifiers but the sync pipeline must not push to them.
const FILENAME_SAFE_TYPES = [
'text',
'single-select',
'number',
'auto-number',
'formula',
'number',
'single-select',
'text',
] as const;
const READ_ONLY_TYPES = [

View file

@ -83,14 +83,16 @@ export interface FieldTypeMapper {
isSubfolderSafe(providerType: string): boolean;
/**
* Returns all known provider-specific types that pass `isFilenameSafe`.
* Enables UIs to enumerate the whitelist without guessing.
* Returns all known provider-specific types that pass `isFilenameSafe`,
* sorted and deduplicated. Enables UIs to enumerate the whitelist without
* guessing.
*/
getFilenameSafeTypes(): readonly string[];
/**
* Returns all known provider-specific types that pass `isSubfolderSafe`.
* Used by settings-tab to filter the subfolder field dropdown.
* Returns all known provider-specific types that pass `isSubfolderSafe`,
* sorted and deduplicated. Used by settings-tab to filter the subfolder
* field dropdown.
*/
getSubfolderSafeTypes(): readonly string[];

View file

@ -294,10 +294,10 @@ describe('airtableFieldMapper', () => {
it('should return exactly the 4 filename-safe types', () => {
const types = airtableFieldMapper.getFilenameSafeTypes();
expect(types).toEqual([
'formula',
'number',
'singleLineText',
'singleSelect',
'number',
'formula',
]);
});

View file

@ -252,11 +252,11 @@ describe('seatableFieldMapper', () => {
it('should return exactly the 5 filename-safe types', () => {
const types = seatableFieldMapper.getFilenameSafeTypes();
expect(types).toEqual([
'text',
'single-select',
'number',
'auto-number',
'formula',
'number',
'single-select',
'text',
]);
});