packages/v2/e2e/src/update-field/README.md
This directory contains end-to-end tests for the updateField command in Teable v2.
update-field/
├── helpers.ts # Shared test utilities
├── README.md # This file
├── computed/
│ ├── dependency-cascade.spec.ts # Computed dependency cascades (metadata + seeding triggers)
│ ├── record-value-seeding.spec.ts # Record-level value verification after computed seed
│ ├── conversion.spec.ts # Computed/system field type conversions
│ └── update-properties.spec.ts # Computed/system field property updates
├── singleLineText/
│ ├── update-properties.spec.ts # Property updates (name, showAs, defaultValue, constraints)
│ └── conversion/
│ ├── to-number.spec.ts # Text → Number
│ ├── to-date.spec.ts # Text → Date
│ ├── to-checkbox.spec.ts # Text → Checkbox
│ ├── to-singleSelect.spec.ts # Text → SingleSelect (requires option generation)
│ ├── to-multipleSelect.spec.ts # Text → MultipleSelect
│ └── to-link.spec.ts # Text → Link (NOT IMPLEMENTED)
├── number/
│ ├── update-properties.spec.ts # Property updates (formatting, showAs)
│ └── conversion/
│ └── to-others.spec.ts # Number → various types
├── singleSelect/
│ └── update-properties.spec.ts # Options management, defaultValue
├── link/
│ └── update-properties.spec.ts # Relationship changes (NOT IMPLEMENTED)
└── ... (other field types)
The following features exist in v1 but are NOT YET IMPLEMENTED in v2:
V1 behavior: Text values are matched against the primary field of the foreign table. Matches create links.
V2 status: Returns error "Cannot convert to link field type"
Required implementation:
Reference: apps/nestjs-backend/src/features/field/field-calculate/field-converting-link.service.ts
V1 behavior: When converting to SingleSelect/MultipleSelect, new options are automatically created from existing cell values with random colors.
V2 status: ✅ Implemented in FieldTypeConversionVisitor.generateSelectOptionsFromValues()
Implementation details:
V1 behavior: Can change between oneWay↔twoWay and manyMany↔oneMany relationships.
V2 status: Not implemented. UpdateLinkRelationshipSpec exists but schema changes not executed.
Required implementation:
V1 behavior: Can convert link field to text (titles) or select (titles as options).
V2 status: Returns error "Cannot convert from link field"
Required implementation:
V1 behavior: When select options are renamed or deleted, all record values are updated accordingly.
V2 status: Not implemented. Option changes don't update record values.
Required implementation:
modifySelectOptions(): Build updatedChoiceMap of old→new namesReference: field-converting.service.ts → modifySelectOptions() method
V1 behavior: When rating max is reduced, values exceeding the new max are clamped.
V2 status: Not implemented. Reducing max may leave invalid values.
Required implementation:
modifyRatingOptions(): Find records with values > new maxReference: field-converting.service.ts → modifyRatingOptions() method
V1 behavior: Toggling isMultiple converts between single user and user arrays.
V2 status: Not implemented. isMultiple changes may leave incompatible values.
Required implementation:
Reference: field-converting.service.ts → modifyUserOptions() method
V1 behavior: Text values are matched against collaborator names/emails to find user IDs.
V2 status: Not implemented. Text→User conversion not supported.
Required implementation:
Reference: field-converting.service.ts → convert2User() method
V1 behavior: After a field update, all dependent computed fields (formula, lookup, rollup) have their record values recalculated.
V2 status: Not implemented. Field metadata cascades work (FieldUpdateSideEffectService propagates cellValueType, hasError), but record value recomputation does not occur.
Current state:
FieldUpdateSideEffectService cascades field metadata changes but does NOT trigger record value recomputationTableSchemaUpdateVisitor executes SQL for select option removal, rating clamping, user multiplicity — but no computed seed followsPostgresTableSchemaRepository.update() only runs ComputedFieldBackfillService for new fields, not existing field updatesPostgresTableRecordRepository.runComputedUpdate()Decision: Always seed when type changes (even text→select where DB values don't change), for safety since cellValueType changes may affect formula evaluation.
Required implementation:
runComputedUpdate() for all dependent computed fieldsTest coverage: See computed/dependency-cascade.spec.ts (sections A-E) and computed/record-value-seeding.spec.ts
The computed/dependency-cascade.spec.ts file is organized into these sections:
The computed/record-value-seeding.spec.ts file verifies actual record cell values (not just metadata):
/tables/updateField endpoint: NOT YET IMPLEMENTED
The UpdateFieldCommand and UpdateFieldHandler exist in v2-core, but the HTTP contract and express route are not yet added to v2-contract-http and v2-contract-http-express.
Once the endpoint is implemented:
pnpm --filter @teable/v2-e2e test src/update-field/
test.todo() with detailed comments[NOT IMPLEMENTED] or [V1 PARITY]