ES /docs

Forge comparison returns excessive removals — model structure mismatch

RCA: CPBimRevision::validateBimComparerResult | excessive removal detected

Error Log#

Datadog Logs

text
CPBimRevision::validateBimComparerResult | elements(total: 12552, created: 12552, deleted: 0) forge(removed: 12549, modified: 3, exist: 0)

Impact#

  • Service: cupixworks-any-bimrevision-agent
  • Team: updatedemo
  • 발생 횟수: 1
  • 최초 발생: 2026-04-06T15:32:12.003Z
  • 최근 발생: 2026-04-06T15:32:12.003Z

Root Cause Summary#

bimRevisionId 22424 (bimId 18883)에 대한 BIM revision comparison에서 Forge 비교 결과가 12552개 element 중 12549개를 "removed"로 반환했습니다. 이는 시스템의 excessive removal 안전장치(count threshold: 10000)에 의해 차단되었습니다. 근본 원인은 새 BIM 파일의 Forge URN이 이전 revision과 완전히 다른 모델 구조를 갖고 있어, Forge 비교기가 거의 모든 element를 "제거됨"으로 판정한 것입니다. BIM origin이 [0,0,0]에서 [54.17, 0.19, 17.31]로 크게 변경된 점도 이를 뒷받침합니다. 모델이 사실상 완전히 교체된 것으로 보이며, 기존 element와의 매칭이 거의 실패했습니다. 이 동작은 안전장치가 의도대로 작동하여 잘못된 대량 삭제를 방지한 것이며, 에러 자체는 정상적인 보호 메커니즘의 발동입니다.

Technical Analysis#

Code Path#

  • Entry point: bim-revision-service.ts:149run() 메서드가 SQS 메시지로부터 bimRevisionId 22424를 수신
  • Element 로딩: bim-revision-service.ts:320-342loadAllElements()에서 bimId 18883의 element 12552개 로딩 (created: 12552, deleted: 0)
  • Forge 비교 실행: bim-revision-service.ts:595-685runBimCompare()에서 현재/이전 URN으로 비교 실행
  • Threshold 로딩: bim-revision-service.ts:738-784loadBimRevisionEntityParameters()에서 facility entity parameter로부터 threshold 로딩 (ratio: 15%, count: 10000, bypass: false)
  • Validation: cpbim-revision.ts:152-232validateBimComparerResult()에서 결과 검증
  • Failure point: cpbim-revision.ts:234-265hasExcessiveRemoval()에서 removed count 12549 >= threshold 10000 감지
typescript
// cpbim-revision.ts:234-262
private hasExcessiveRemoval = (report: ForgeAgent.Report, cpBim: CPBim, threshold: BimRevisionThreshold): boolean => {
    const forgeRemovedCount = report.removed.length;
    const elementCreatedCount = cpBim.cpElementsCreated.length;
    const removedRatio = elementCreatedCount > 0 ? (forgeRemovedCount / elementCreatedCount) * 100 : 0;

    if (forgeRemovedCount >= threshold.countThreshold || (elementCreatedCount > 0 && removedRatio >= threshold.ratioThreshold)) {
        // ...
        this._validationErrorCode = ErrorCode.Agent.BimRevisionExcessiveRemoval;
        return true;  // validation 실패 → runBimCompare에서 throw
    }
    return false;
};
  • 기대 동작: Forge 비교기가 이전 revision과 현재 revision 사이의 element 변경 사항을 합리적인 범위(modified, removed, exist)로 분류해야 함
  • 실제 동작: 12552개 중 12549개가 removed, 3개만 modified, 0개 exist로 판정 — 사실상 전체 모델이 교체된 것과 동일한 결과

validation 실패 후 error code REV141 (BimRevisionExcessiveRemoval)이 설정되고, bim_comparison_stateError로 업데이트됨:

typescript
// bim-revision-service.ts:679-682
} else {
    const validationErrorCode = cpBimRevision.validationErrorCode ?? ErrorCode.Agent.BimRevisionExtractorInvalidResult;
    this.setErrorCode(validationErrorCode);
    throw new Error(`BimRevisionService::runBimCompare | end - validation failed (errorCode: ${validationErrorCode})`);
}

Log Evidence#

사용한 Datadog 쿼리:

text
service:cupixworks-any-bimrevision-agent status:error "validateBimComparerResult"
text
service:cupixworks-any-bimrevision-agent "22424"
text
service:cupixworks-any-bimrevision-agent "18883"

전체 실행 타임라인 (KST):

시각 이벤트
00:25:46 AwsS3Manager::constructor — agent 초기화
00:25:48 BaseService::runByMessage | id: 22424 — 처리 시작
00:25:48 BimRevisionService::loadAllElements | begin - bimId: 18883, facilityKey: osgj8f
00:26:05 BimRevisionService::loadRemovedElements | begin - bimId: 18883
00:26:05 BimRevisionService::loadAllElements | end - 12552 cpElements loaded - created: 12552, deleted: 0
00:26:06 Threshold 로딩: ratio: 15%, count: 10000, bypass: false
00:26:06 runBimCompare | begin — Forge 비교 시작
00:32:11 validateBimComparerResult | newBimOrigin: 54.17,0.19,17.31, currentOrigin: 0,0,0
00:32:11 validateBimComparerResult | modified: 3, removed: 12549, exist: 0
00:32:12 ERROR excessive removal detected - bimRevisionId: 22424, bimId: 18883, trigger: count 12549 >= 10000
00:32:12 ERROR elements(total: 12552, created: 12552, deleted: 0) forge(removed: 12549, modified: 3, exist: 0)
00:32:12 ERROR BimRevisionService::run | error: "validation failed (errorCode: REV141)"
00:32:12 Cleanup: /tmp/workspace/22424 제거

핵심 로그:

text
BimRevisionService::loadBimRevisionEntityParameters | threshold - ratio: 15%, count: 10000, bypass: false
text
CPBimRevision::validateBimComparerResult | newBimOrigin: 54.17481753183529,0.18898358987644315,17.30648765055639, currentOrigin: 0,0,0
text
CPBimRevision::validateBimComparerResult | excessive removal detected - bimRevisionId: 22424, bimId: 18883, trigger: count 12549 >= 10000
text
BimRevisionService::run | error: "BimRevisionService::runBimCompare | end - validation failed (errorCode: REV141)"

주요 분석 포인트:

  1. BIM origin이 [0,0,0][54.17, 0.19, 17.31]로 변경됨 — 모델 좌표계가 완전히 달라짐
  2. 12552개 element 중 12549개가 removed (99.98%) — ratio threshold 15%도 초과, count threshold 10000도 초과
  3. deleted: 0 — 이전 revision에서 삭제된 element가 없어 checkExistence 리스트도 비어있음
  4. Forge 비교에 약 6분 소요 (00:26:06 → 00:32:11) — 대규모 모델 비교

Fix Recommendation#

즉시 조치 (Critical)#

이 에러는 안전장치가 의도대로 작동한 것이므로, 코드 수정은 필요하지 않습니다. 대신 운영 조치가 필요합니다:

  • 팀(updatedemo)에 확인 필요: 새 BIM 파일이 의도적으로 완전히 다른 모델로 업로드된 것인지 확인
    • 의도적 교체인 경우: facility의 bim_revision_bypass_threshold entity parameter를 true로 설정하여 해당 facility에서 threshold를 우회하도록 하거나, 기존 BIM을 삭제 후 새로 생성하는 워크플로우 안내
    • 실수인 경우: 올바른 BIM 파일로 다시 업로드하도록 안내

단기 개선 (1주 이내)#

  • hasExcessiveRemoval()에서 bypass 시 처리 결과를 별도 채널(Slack 등)로 알림 추가를 검토 — 현재는 warn 로그만 남기고 처리를 계속함
  • Error 상태의 BIM revision에 대해 사용자에게 보이는 에러 메시지를 개선하여, "모델이 크게 변경되어 자동 비교가 차단되었습니다. 새 BIM으로 등록하거나 관리자에게 문의하세요" 형태의 안내를 제공

장기 개선 (재발 방지)#

  • BIM revision 업로드 시 이전 revision과의 기본적인 모델 구조 호환성 사전 검증 (element 수, origin 변화량 등)을 업로드 단계에서 수행하여, 비교 agent 실행 전에 사용자에게 경고 제공
  • Forge URN 기반 비교 전에 모델 메타데이터(element 수, model count 등)를 사전 비교하는 경량 validation 단계 추가

Monitoring#

  • Excessive removal 발생 추적:
text
service:cupixworks-any-bimrevision-agent "excessive removal detected"
  • BIM revision 전체 에러율:
text
service:cupixworks-any-bimrevision-agent status:error "BimRevisionService::run | error"
  • 특정 error code별 추적:
text
service:cupixworks-any-bimrevision-agent "REV141"

Risk Assessment#

  • Risk level: low
  • 예상 복잡도: trivial
  • 안전장치가 정상 작동하여 12549개 element의 잘못된 대량 삭제를 방지함. 데이터 손실 없음. 해당 BIM revision만 Error 상태로 설정되어 다른 처리에 영향 없음. 팀에 워크플로우 안내만 필요.