leerness 1.9.405 → 1.9.406

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.406 — 2026-06-07 — rule/decision/lesson add 동시쓰기 lost-update 차단 (8번째 버그헌트, UR-0110)
4
+
5
+ **🔒 멀티에이전트 데이터 무결성 — rule/decision/lesson add 의 read-modify-write 가 락 없이 실행돼 동시 쓰기 시 항목이 조용히 유실되던 것 차단(UR-0043 락 정책의 커버리지 갭 메움).**
6
+
7
+ ### 배경 (2차 버그헌트 concurrency 차원)
8
+ 1.9.303(UR-0043)이 task/plan add 의 동시 lost-update 를 _withLock 으로 막았으나, rule add / decision add / lesson save 는 누락. 2차 버그헌트가 실측 재현: 14개 동시 rule add → 11~13개만 잔존(2~3개 영구 유실), 12 동시 decision add → 10개. atomic write 라 파일은 무손상이나 개수 무결성 깨짐(늦은 writer 가 이른 항목 덮어씀).
9
+
10
+ ### 구현
11
+ - ruleAdd / decisionAdd / lessonSave 의 RMW 전체를 `_withLock(rulesPath/decisionsJsonPath/lessonsJsonPath, () => {...})` 로 직렬화(task add 와 동일 패턴). ruleAdd 는 멱등 skip 을 락 내 반환값으로 처리.
12
+
13
+ ### 검증 (회귀 0)
14
+ - **selftest 151→152 PASS** (3함수 _withLock 와이어).
15
+ - **E2E 344→345 PASS** (락 리팩터 멱등성/정확성 보존: dup skip + 순차 카운트).
16
+ - 실측 동시성: 14 rule / 12 decision / 10 lesson 동시 add → 전부 무손실 + stale lock 없음.
17
+
3
18
  ## 1.9.405 — 2026-06-07 — 시크릿 placeholder FP 회귀수정 (8번째 버그헌트, UR-0109)
4
19
 
5
20
  **🔧 자기 회귀 수정 — 1.9.401 의 looksReal 가드가 긴 서술형 placeholder를 실키로 오탐(FP)하던 것 차단.**
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **AI 코딩 에이전트의 거짓 완료·중복·망각·충돌을 막아주는 검수·기억·협업 CLI 하네스.**
4
4
  > **A CLI harness that stops AI coding agents from faking completion, duplicating work, forgetting context, and colliding.**
5
5
 
6
- [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.405-green)]() [![tests](https://img.shields.io/badge/e2e-344%2F344-success)]() [![selftest](https://img.shields.io/badge/selftest-151-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
6
+ [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.406-green)]() [![tests](https://img.shields.io/badge/e2e-345%2F345-success)]() [![selftest](https://img.shields.io/badge/selftest-152-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
7
7
 
8
8
  ```
9
9
  ╔══════════════════════════════════════════════════════════════╗
@@ -471,7 +471,7 @@ MIT — © leerness contributors
471
471
  <!-- leerness:project-readme:start -->
472
472
  ## Leerness Project Harness
473
473
 
474
- 이 프로젝트는 Leerness v1.9.405 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.406 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
475
475
 
476
476
  ### 정체성 — AI 에이전트 운영 레이어 (UR-0030)
477
477
 
@@ -525,7 +525,7 @@ leerness memory restore decision <date|title>
525
525
 
526
526
  ### MCP server (외부 AI 통합)
527
527
 
528
- Leerness v1.9.405는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
528
+ Leerness v1.9.406는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
529
529
 
530
530
  ```jsonc
531
531
  // 카테고리별
@@ -546,7 +546,7 @@ Leerness v1.9.405는 stdio JSON-RPC MCP server를 내장합니다 — Claude Cod
546
546
  `<<autonomous-loop-dynamic>>` 신호만 보내면 AI가:
547
547
  1) 다음 라운드 후보 선정 → 2) 코드 변경 → 3) stress-v* 신규 작성 + 누적 회귀 → 4) e2e 219/219 → 5) npm pack + git tag + GitHub release → 6) main 자동 push (1.9.140+) → 7) session close → 8) 다음 라운드 예약.
548
548
 
549
- 현재 누적: **70 라운드 (1.9.40 → 1.9.405)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.406)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
550
550
 
551
551
  ### 성능 가이드 (1.9.140 측정)
552
552
 
@@ -584,6 +584,6 @@ leerness release pack --close --auto-main-push
584
584
  - `.harness/session-handoff.md`: 다음 세션 인수인계 (자동 작성)
585
585
  - `.harness/lessons.md` / `decisions.md` / `rules.md`: 영구 메모리 (5 surface)
586
586
 
587
- Last synced by Leerness v1.9.405: 2026-06-06
587
+ Last synced by Leerness v1.9.406: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -31,7 +31,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
31
31
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
32
32
  const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST, _DEFAULT_PLATFORM_CONSTRAINTS, _DEFAULT_DOMAIN_CATALOG, _LSP_LANG_PATTERNS, OPTIMISM_PATTERNS, BUILT_IN_PERSONAS, STRINGS, BUILTIN_CATALOG, ROADMAP_STATUS_LABEL, ROADMAP_STATUS_COLOR, SECRET_PATTERNS, MERGE_OVERWRITE_FILES, MINIMAL_SKIP_KEYS, REQUIRED_WORKSPACE_FILES, KEYWORD_STOPWORDS, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368/369 (UR-0025): catalog 분리 (MERGE_OVERWRITE_FILES/MINIMAL_SKIP_KEYS 포함)
33
33
 
34
- const VERSION = '1.9.405';
34
+ const VERSION = '1.9.406';
35
35
 
36
36
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
37
37
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -3010,6 +3010,7 @@ function _selfTestCases() {
3010
3010
  { name: '7번째 버그헌트 P2 (UR-0107): api-skill show/drop 에러 exit code 1 (1.9.403)', run: () => { const src = read(__filename); const showId = src.includes("api-skill show <id>')); process.exitCode = 1"); const dropId = src.includes("api-skill drop <id>')); process.exitCode = 1"); const addUrl = src.includes("api-skill add <url> [--direction") && src.includes('process.exitCode = 1'); return showId && dropId && addUrl; } },
3011
3011
  { name: '7번째 버그헌트 P2 (UR-0105 잔여): reuse autodetect / creds check --json 에러 구조화 (1.9.404)', run: () => { const src = read(__filename); const reuseOk = src.includes("failJson(has('--json'), 'no_scan_dir'"); const credsOk = src.includes("failJson(has('--json'), 'no_service'"); return reuseOk && credsOk; } },
3012
3012
  { name: '8번째 버그헌트 회귀수정 (UR-0109): 긴 서술형 placeholder FP 차단(마커 우선) + 실키 FN 유지 (1.9.405)', run: () => { const m = require('../lib/pure-utils'); const ph = m._isPlaceholderSecret; const fpFixed = ph('your-super-secret-api-key-example-value') === true && ph('this-is-just-an-example-placeholder-value') === true && ph('example-api-key-do-not-use-1234567890') === true; const fnKept = ph('sk-EXAMPLEab12cd34ef56gh78ij90kl') === false && ph('sk-proj-realKEYexample9988776655') === false; const realKept = ph('a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6') === false; const shortPh = ph('your-api-key-here') === true && ph('changeme') === true; return fpFixed && fnKept && realKept && shortPh; } },
3013
+ { name: '8번째 버그헌트 (UR-0110): rule/decision/lesson add 동시쓰기 _withLock 직렬화 (UR-0043 갭 메움) (1.9.406)', run: () => { const src = read(__filename); const L = '_withLock('; const ruleLock = src.includes(L + 'rulesPath' + '(root), () =>'); const decLock = src.includes(L + 'decisionsJsonPath' + '(root), () =>'); const lesLock = src.includes(L + 'lessonsJsonPath' + '(root), () =>'); return ruleLock && decLock && lesLock; } },
3013
3014
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3014
3015
  ];
3015
3016
  }
@@ -6451,9 +6452,12 @@ function lessonSave(root, text) {
6451
6452
  if (!_requireInit(root, 'lesson save')) return; // 1.9.311 (UR-0047): init 가드
6452
6453
  if (!text) return fail('lesson text required. 예: leerness lesson save "JWT는 refresh token도 짧게 (15분 권장)"');
6453
6454
  const tag = arg('--tag', '');
6454
- const all = _loadLessons(root);
6455
- all.push({ date: today(), text, tag: tag || null });
6456
- _saveLessons(root, all);
6455
+ // 1.9.406 (8번째 버그헌트, UR-0110): RMW 락 직렬화 — 동시 lesson save lost-update 방지(UR-0043 패턴).
6456
+ _withLock(lessonsJsonPath(root), () => {
6457
+ const all = _loadLessons(root);
6458
+ all.push({ date: today(), text, tag: tag || null });
6459
+ _saveLessons(root, all);
6460
+ });
6457
6461
  ok(`lesson saved`);
6458
6462
  _autoRoadmap(absRoot(root), 'data-change');
6459
6463
  }
@@ -6534,15 +6538,18 @@ function decisionAdd(root, title) {
6534
6538
  const alternatives = arg('--alternatives', '');
6535
6539
  const impact = arg('--impact', '');
6536
6540
  // 1.9.339 (UR-0053): canonical JSON write path — 기존 항목(JSON 우선, 없으면 MD backfill) 로드 후 추가, JSON+MD projection 동시 저장.
6537
- const all = _loadDecisions(root);
6538
- all.push({
6539
- date: today(), title,
6540
- decision: title,
6541
- reason: reason || null,
6542
- alternatives: alternatives || null,
6543
- impact: impact || null
6541
+ // 1.9.406 (8번째 버그헌트, UR-0110): RMW 락 직렬화 — 동시 decision add lost-update 방지(UR-0043 패턴).
6542
+ _withLock(decisionsJsonPath(root), () => {
6543
+ const all = _loadDecisions(root);
6544
+ all.push({
6545
+ date: today(), title,
6546
+ decision: title,
6547
+ reason: reason || null,
6548
+ alternatives: alternatives || null,
6549
+ impact: impact || null
6550
+ });
6551
+ _saveDecisions(root, all);
6544
6552
  });
6545
- _saveDecisions(root, all);
6546
6553
  ok(`decision added: ${title}`);
6547
6554
  // 1.9.43+ handoff lessons 회수 흐름과 자동 통합 (decisions.md fuzzy 매칭됨)
6548
6555
  _autoRoadmap(absRoot(root), 'data-change');
@@ -13608,19 +13615,21 @@ function ruleAdd(root, description) {
13608
13615
  const trigger = arg('--trigger', 'every-session');
13609
13616
  // 1.9.310 (UR-0046): 무효 trigger 거부 (이전엔 warn 후 등록 → 오타 룰 등록됨). --force 우회.
13610
13617
  if (!_validateChoice(trigger, RULE_TRIGGERS, 'rule trigger')) { process.exitCode = 1; return; }
13611
- const rules = readRules(root);
13612
- // 1.9.212: 멱등성 보장 같은 description + trigger + active 상태 이미 존재 시 skip (사용자 명시)
13613
- if (!has('--force')) {
13614
- const dup = rules.find(r => r.rule === description && r.trigger === trigger && r.status === 'active');
13615
- if (dup) {
13616
- ok(`rule exists (skip): ${dup.id} [${dup.trigger}] ${description} (--force 덮어쓰기)`);
13617
- return;
13618
- }
13619
- }
13620
- const id = nextRuleId(root);
13621
- rules.push({ id, trigger, rule: description, added: today(), status: 'active', lastVerified: '-' });
13622
- writeRules(root, rules);
13623
- ok(`rule added: ${id} [${trigger}] ${description}`);
13618
+ // 1.9.406 (8번째 버그헌트, UR-0110): read-modify-write 전체를 락으로 직렬화 — 동시 rule add lost-update 방지(UR-0043 패턴, task add 와 동일).
13619
+ const result = _withLock(rulesPath(root), () => {
13620
+ const rules = readRules(root);
13621
+ // 1.9.212: 멱등성 보장 같은 description + trigger + active 상태 이미 존재 시 skip (사용자 명시)
13622
+ if (!has('--force')) {
13623
+ const dup = rules.find(r => r.rule === description && r.trigger === trigger && r.status === 'active');
13624
+ if (dup) return { skip: true, id: dup.id };
13625
+ }
13626
+ const id = nextRuleId(root);
13627
+ rules.push({ id, trigger, rule: description, added: today(), status: 'active', lastVerified: '-' });
13628
+ writeRules(root, rules);
13629
+ return { skip: false, id };
13630
+ });
13631
+ if (result.skip) { ok(`rule exists (skip): ${result.id} [${trigger}] ${description} (--force 로 덮어쓰기)`); return; }
13632
+ ok(`rule added: ${result.id} [${trigger}] ${description}`);
13624
13633
  _autoRoadmap(root, 'data-change');
13625
13634
  }
13626
13635
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.405",
3
+ "version": "1.9.406",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -5712,5 +5712,36 @@ total++;
5712
5712
  if (!ok) failed++;
5713
5713
  }
5714
5714
 
5715
+ // 1.9.406 회귀 (8번째 버그헌트, UR-0110): rule/decision/lesson add 락 리팩터가 멱등성/정확성 보존 (skip 플래그 회귀가드)
5716
+ total++;
5717
+ {
5718
+ let ok = false;
5719
+ try {
5720
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-lockrefactor-'));
5721
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5722
+ const run = (args) => cp.spawnSync(process.execPath, [CLI, ...args, '--path', d], { encoding: 'utf8', timeout: 15000 });
5723
+ // rule: 멱등성(dup skip) 보존
5724
+ run(['rule', 'add', 'lock refactor rule', '--trigger', 'every-session']);
5725
+ const dup = run(['rule', 'add', 'lock refactor rule', '--trigger', 'every-session']); // 중복 → skip
5726
+ run(['rule', 'add', 'lock refactor rule 2', '--trigger', 'every-session']);
5727
+ const rl = JSON.parse(run(['rule', 'list', '--json']).stdout); const rs = rl.rules || rl;
5728
+ const ruleOk = rs.length === 2 && /skip/.test(dup.stdout || '');
5729
+ // decision: 2개 순차 → 2 보존
5730
+ run(['decision', 'add', 'lock dec A', '--reason', 'r']);
5731
+ run(['decision', 'add', 'lock dec B', '--reason', 'r']);
5732
+ const decs = JSON.parse(fs.readFileSync(path.join(d, '.harness', 'decisions.json'), 'utf8'));
5733
+ const decOk = decs.length === 2;
5734
+ // lesson: 2개 순차 → 2 보존
5735
+ run(['lesson', 'save', 'lock lesson A']);
5736
+ run(['lesson', 'save', 'lock lesson B']);
5737
+ const les = JSON.parse(fs.readFileSync(path.join(d, '.harness', 'lessons.json'), 'utf8'));
5738
+ const lesOk = les.length === 2;
5739
+ fs.rmSync(d, { recursive: true, force: true });
5740
+ ok = ruleOk && decOk && lesOk;
5741
+ } catch {}
5742
+ console.log(ok ? '✓ B(1.9.406) 8th버그헌트: rule/decision/lesson add 락 리팩터 멱등성·정확성 보존 (UR-0110)' : '✗ 락 리팩터 회귀가드 실패');
5743
+ if (!ok) failed++;
5744
+ }
5745
+
5715
5746
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5716
5747
  if (failed > 0) process.exit(1);