R3 — PLC sentinel(-480910 / -481000) drop policy (root cause fix)
- new: src/domain/policies/tag-value-sanitizer.policy.ts
- wired in deviceCollectorService.publishData() 진입부 — 모든 sink
(로컬 MQTT, IDC central MQTT, equipmentState, target DB) 직전 1회 호출
- typeof bug 수정: PLC/Edge 가 '-480910.000000' string 으로 전송하는 케이스
포함. coerceNumeric() 으로 number/string 양쪽 안전 변환 후 Set 매칭.
- T6 (Claude tracer agent) 진단 결과 — Edge 컨테이너에서 hash field 가
'-480910.000000' string 으로 적재되어 typeof === 'number' 만 검사하던
이전 로직 통과. dt-web 응답까지 sentinel 도달 확인됨.
R4.0 — Inbound Port 인터페이스만 정의 (런타임 영향 0)
- new: src/ports/inbound/plc-source.port.ts (PlcSourcePort)
- new: src/ports/inbound/rest-request.port.ts (RestRequestPort, RestResponse)
- new: src/ports/inbound/scheduled-trigger.port.ts (ScheduledTriggerPort)
- 어댑터 구현은 R4.1+ 단계에서 진행 (deviceCollectorService 의 thin wrapper).
영향:
- Edge pipeline-backend 빌드 시 sanitize 호출 활성화 → IDC Redis 까지
sentinel 도달 차단. dt-web 의 운영 워크어라운드 제거 가능.
- 4개 신규 파일 + 1개 기존 파일 +5 lines 수정.
Constraint: chpark 의 로컬 hex 작업과 동기화 필요 — git pull main 후 머지/리베이스 권장
Confidence: high (T6 tracer 가 진단 + Edge build 산물 코드 위치 일치)
Scope-risk: narrow (publishData 진입부 1줄 + 4 신규 파일)
Directive: SENTINEL_VALUES set 변경 시 coerceNumeric 의 string 처리도 함께 갱신
Not-tested: chpark 의 로컬 R1~R5 작업과의 충돌 (사용자가 안내 예정)
- edgeDeviceConfigReporter 신규: pipeline_device_connections + pipeline_equipment 조인해
IDC TimescaleDB의 edge_device_config_1 에 5분 주기로 적재 (DISTINCT ON 으로 최신값 조회용)
- app.ts: 부팅 시 startEdgeDeviceConfigReporter, SIGTERM/SIGINT 시 graceful stop 추가
- CollectedData 에 host/port 필드 추가, collectDevice 에서 device row 값 채움
- centralMqttForwarder.buildPayload 에 protocol/host/port 포함 (IDC 컨슈머가 활용)
- 312 마이그레이션(fleet_edge_raw_data host/port 컬럼) 등록 (sql 파일은 .gitignore 로 미동봉, OPS 절차로 적용)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MSSQL 수집기 (새 파일 mssqlClient.ts)
- Python sql_collector.py 의 MSSQL 모드 포팅
- watermark 기반 증분 SELECT, batch_mode (row 당 장비), fetch_size 지원
- timestamp_expression 으로 CONVERT/LEFT/RIGHT 등 복합 타임스탬프 표현 가능
- Protocol: MSSQL_DB
MQTT 구독 수집기 (새 파일 mqttCollectorClient.ts)
- tag.address = 토픽, 메시지 캐시 후 readTags() 호출 시 최신값 반환
- payload JSON 파싱 시 json_path 로 특정 필드 추출 가능
- Protocol: MQTT_SUB
Target DB retry queue (pipeline_target_retry_queue)
- 기존 in-memory Array → PG 영속화
- 실패 → enqueue(exp.backoff), 30s 워커가 재시도, 10회 초과 시 폐기
- IDC TimescaleDB 일시 다운 시 데이터 유실 방지 (기존 단순 warn → 적재)
Watermark 영속화 (pipeline_collector_watermark)
- connection_id 당 마지막으로 읽은 타임스탬프 기록
- MSSQL 증분 수집의 핵심, 재기동에도 중복 없음
deviceCollectorService.ts
- case "MSSQL_DB", "MQTT_SUB" 분기 추가
- clientCache 타입에 MssqlClient, MqttCollectorClient 추가
- publishData 5단계 실패 시 enqueueTargetRetry 호출
- startRetryWorker()/stopRetryWorker() 수명 주기 관리
app.ts
- 기동 시 startRetryWorker() 호출
pipelineDeviceTypes.ts
- DeviceProtocol union 에 MSSQL_DB, MQTT_SUB 추가
- PROTOCOL_OPTIONS / PROTOCOL_DEFAULTS 에 등록
- UI 드롭다운 및 기본값 지원
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
XGT FEnet 클라이언트
- 응답 data_length offset [12] → [16] (요청 시에만 [12,16] 둘 다 씀; 응답은 PLC가 [12:14]를 CPU 정보로 덮음)
- socket.setTimeout idle 타임아웃 제거 → connect 전용 수동 타이머 + setKeepAlive(10s). 폴링 간격(5s)마다 재연결되던 문제 해결
Edge 이벤트 리포터
- edgeStatusReporter.ts 추가: 60초 간격 edge_status_1 하트비트 + edge_events_1 이벤트 기록
- 기동/종료 이벤트 + PLC 상태 전이(connected/disconnected/error) 자동 기록
- PIPELINE_EDGE_* env 로 edge_id/company_id/UUID/table/interval 주입
edge_telemetry metadata 포맷 교정
- migrated_at → forwarded_at, _pipeline 추가 블록 제거
- 프로덕션 원본 스키마와 완전 호환: {priority, device_id(UUID), forwarded_at}
라우트 순서 버그 수정
- pipelineDeviceConnectionRoutes.ts: /target-databases* 가 /:id 뒤에 있어 /:id 가 먼저 매칭됨 → UI 저장 DB 드롭다운 비어있던 문제
- 정적 경로를 /:id 위로 이동
프론트 API URL 해석 일반화
- NEXT_PUBLIC_API_URL 가 localhost인데 브라우저는 원격이면 env 무시하고 현재 origin의 :8080 사용 → 엣지 원격 접속 시 API 연결 보장
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Docker/K8s 배포 설정을 pipeline-backend/pipeline-front로 통일
- 네임스페이스, 서비스, PVC 등 k8s 리소스명 pipeline-* 로 변경
- AI 에이전트 관리 기능 추가 (에이전트, 그룹, 프로바이더, 대화, API 키, 지식베이스)
- 장비 연결 관리 기능 추가 (PLC/Modbus/OPC-UA/MQTT)
- 배치 스케줄러에 AI agent/device collection/crawling 타입 추가
- 배치 편집 UI 개선 (6가지 실행 방식 지원)
- 회사별 페이지(COMPANY_*) 제거 및 AdminPageRenderer 최적화
- 메뉴 재구성: 장비 연결 관리 시스템관리로 이동, 에이전트 오케스트레이션으로 개명
- ai-assistant 디렉토리 제거 (backend-node로 통합)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>