Skip to content

test: 현재 코드 전용 자동화 테스트 진입점을 추가한다 - #10

Open
OstenHun wants to merge 2 commits into
developfrom
feature/donghun-current-code-test-foundation
Open

test: 현재 코드 전용 자동화 테스트 진입점을 추가한다#10
OstenHun wants to merge 2 commits into
developfrom
feature/donghun-current-code-test-foundation

Conversation

@OstenHun

@OstenHun OstenHun commented Sep 4, 2026

Copy link
Copy Markdown
Member

현재 코드 전용 npm test와 테스트 4개를 추가하고 Linux + Node.js 20을 필수 CI 기준으로 고정했습니다. 최신 head의 CI는 통과했으며 비작성자 리뷰가 남아 있습니다. Windows PowerShell은 선택적 로컬 호환성 확인입니다.

연결된 작업 항목 및 계약

  • Closes: [작업] 현재 코드 전용 Node 테스트 기반을 구축한다 #9. 이슈는 병합 전 닫지 않습니다.
  • 영향을 받는 기준: AGENTS.md의 로컬 검증, PRD 04의 현재 코드 전용 테스트 진입 조건
  • 기준: develop@71f20692a302dd587bb699935824651e3c8a01a7
  • 작업 브랜치: feature/donghun-current-code-test-foundation
  • 검증 head: 820b5e22641030c715fb2029f2f7047152a6c8b1
  • 요청된 비작성자 검토자: worud8457

핵심 검토

기존 저장소에는 자동화된 test 명령과 테스트 파일이 없어 현재 Discord·Diagnostic·YAML 코드의 회귀를 반복 검증할 수 없었습니다. 이제 현재 코드 전용 테스트를 한 명령으로 실행하고, Linux + Node.js 20에서 설치·테스트·정적 검사·빌드를 PR마다 검증합니다.

필수 제품 검증의 정본 환경은 Linux + Node.js 20입니다. Windows PowerShell은 선택적 로컬 개발 호환성 확인이며 필수 CI를 대체하지 않습니다. 현재 테스트 기반의 통과만으로 #4/#7 제품 계약, P0 전체 검증 또는 병합 준비 완료를 주장하지 않습니다. 최신 head에 대한 비작성자 리뷰가 남아 있습니다.

변경 전과 변경 후

  • package.json: npm test가 테스트 TypeScript를 타입 검사한 뒤 현재 코드 테스트를 실행합니다.
  • tests/run-tests.mjs: *.test.ts를 정렬해 직접 열거하고, 파일 0개·child process 시작 오류·테스트 실패를 non-zero로 처리합니다. PowerShell/Bash 전용 문법이나 셸 glob에 의존하지 않습니다.
  • tsconfig.test.json: 제품 TypeScript와 테스트 파일을 함께 정적 검사합니다.
  • tests/unit/current-code-foundation.test.ts: catalog 파싱·freeze, writable Tool 거부, 선택 plugin의 Tool 노출, 임시 표시/Discord 포매팅을 4개 테스트로 검증합니다.
  • .github/workflows/current-code-validation.yml: 기존 workflow가 없어 단일 Ubuntu/Node 20 job을 추가했습니다. develop 대상 PR과 develop push에서 실행하며 PR은 실제 head SHA를 checkout합니다. 실행 명령은 npm ci, npm test, npm run typecheck, npm run build 네 개입니다. contents: read, checkout 자격 증명 비보존, 10분 timeout을 적용합니다.

이번 후속 커밋 820b5e2의 저장소 변경은 CI 파일 하나입니다. 기존 테스트 기반은 c5400eb에 있습니다. src/**, 의존성, package-lock.json, PRD·스키마, PR #8 문서 브랜치를 변경하지 않았습니다. #4 출력 포트와 #7 Report Agent·정본 Discord 전달 구현은 별도 범위입니다.

절충안 분석

기존 tsx와 Node 내장 node:test를 사용해 새 프레임워크와 잠금 파일 변경을 피했습니다. Vitest 도입은 현재 필요한 기반보다 설정·의존성 변경이 크고, #4/#7에서 개별 러너를 만들면 실행 의미가 중복됩니다.

CI는 Linux/Node 20 단일 job을 선택했습니다. Windows까지 필수 matrix에 넣으면 검증 비용이 늘고 선택적 호환성 확인이라는 기준과 맞지 않습니다. Node/tsx의 플랫폼 차이는 두 환경의 결과를 분리해 기록합니다. CI 명령 실패는 job 실패로 이어지며, 의존성 다운로드 장애는 테스트 회귀와 구분해 로그로 확인해야 합니다.

검증 근거

필수 제품 검증: Linux + Node.js 20

Actions 실행 34255016082Linux / Node.js 20 jobcompleted / success입니다. checkout 로그의 SHA도 위 검증 head와 일치합니다.

실제 환경은 Ubuntu 24.04.4, Node v20.20.2, npm 10.8.2입니다. 2026-09-08 17:06:01 UTC에 완료했습니다.

정확한 명령 결과 입증 범위
npm ci 통과: 56 packages 설치 Linux/Node 20의 lockfile 기반 설치
npm test 통과: 4 tests, 1 suite, 0 fail 현재 테스트 발견·타입 검사·실행
npm run typecheck 통과 현재 제품 TypeScript 정적 검사
npm run build 통과 TypeScript 빌드와 기존 catalog 복사

선택적 로컬 호환성: Windows PowerShell

환경: Node v24.13.0, npm 11.19.1, 기존 worktree.

정확한 명령 결과
npm test 통과: 호스트 PowerShell에서 4 pass, 0 fail
npm run typecheck 통과
npm run build 통과
git diff --check origin/develop...HEAD 통과

샌드박스에서는 tsxos.userInfo() 호출이 uv_os_get_passwd returned ENOMEM으로 실패했습니다. 동일한 npm test를 호스트에서 재실행해 통과했습니다. 로컬 의존성과 잠금 파일이 그대로여서 이번 세션에서는 로컬 npm ci를 반복하지 않았습니다.

유지하는 이전 검증 기록

  • c5400eb의 Windows 환경에서 npm ci --offline --no-audit --no-fund 통과: 56 packages.
  • 커밋하지 않은 임시 실패 테스트를 넣은 npm test는 4 pass, 1 fail, exit 1이었습니다. 이번 CI 변경에서 실패 주입을 다시 실행하지 않았습니다.
  • 테스트 파일 0개 분기는 코드에 있으며 이 분기의 실제 실행 증거는 없습니다.
  • 새 테스트/설정의 정적 검사에서 레거시 MCP, OpenAI, Discord SDK, fetch 참조는 0건이었습니다. 현재 import 경로도 메모리 입력을 처리하는 순수 모듈입니다.
  • 이전 Node 20 미실행 공백은 위 Linux CI 실행으로 해소했습니다.

위험 및 롤백

테스트는 메모리 fixture와 순수 모듈만 사용합니다. 실제 자격 증명, 프로세스 비밀정보 값, OpenAI, Discord, Prometheus, Loki, AMDB Backend를 사용하지 않습니다. CI의 저장소 checkout과 공개 npm 의존성 설치는 네트워크를 사용합니다. 제품용 secrets와 운영 source 설정은 주입하지 않습니다.

CI만 되돌리려면 820b5e2를 revert합니다. 테스트 기반 전체를 되돌리려면 CI와 c5400eb의 테스트 스크립트·설정·파일을 함께 revert합니다. 제품 코드와 데이터 마이그레이션은 없습니다.

병합 점검표

  • 범위와 비목표가 #9와 일치합니다.
  • 최신 head의 Linux + Node.js 20에서 네 필수 명령이 모두 통과했습니다.
  • Windows PowerShell 결과를 선택적 로컬 호환성 증거로 분리했습니다.
  • 자격 증명, 런타임 프롬프트 전문, 원시 provider/source output을 포함하지 않았습니다.
  • 비작성자 검토자가 최신 head를 검토하고 승인해야 합니다.
  • PR을 develop에 병합한 뒤 #9를 닫습니다. 자동 merge는 수행하지 않습니다.

@OstenHun OstenHun self-assigned this Sep 4, 2026
@OstenHun
OstenHun requested a review from worud8457 September 4, 2026 08:18
@OstenHun
OstenHun marked this pull request as ready for review September 8, 2026 17:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T17:14:14.248017Z 820b5e2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 820b5e2264

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const registry = new PluginRegistry(createCatalog());

assert.deepEqual(registry.listToolsForPlugins([]), []);
assert.deepEqual(registry.listToolsForPlugins(["backend"]), [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add an unselected plugin to the selection test

If listToolsForPlugins regresses to returning every plugin whenever the selection is nonempty, this test still passes because backend is the catalog's only plugin; the empty-selection assertion does not exercise exclusion either. Add a second plugin/tool and verify that selecting backend omits it so this test actually protects the selected-plugin boundary.

Useful? React with 👍 / 👎.

assert.equal(catalog.plugins[0]?.tools[0]?.description, "Check backend health");
assert.equal(Object.isFrozen(catalog), true);
assert.equal(Object.isFrozen(catalog.plugins), true);
assert.equal(Object.isFrozen(catalog.plugins[0]?.tools), true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert deep freezing of tool definitions

If catalog freezing regresses to cover only the root and collection arrays, all three assertions still pass while individual tool definitions and nested objects such as access, inputSchema, and execution remain mutable. Assert those leaf objects are frozen, or attempt a representative mutation, so the test named for deep-freeze behavior detects the unsafe partial implementation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant