Commit Graph
12 Commits
Author SHA1 Message Date
DongHyeonka a37ebba39c fix(architecture): 기능 안 계층 밖 폴더가 src/adapters에 닿으면 막는다
문제
feature-and-app-roots-do-not-reach-adapters는 기능 루트 파일
(src/features/*.ts, src/features/<id>/*.ts), src/contexts, src/apps만 본다.
그래프는 간선 하나씩 검사하므로, 기능 안에 계층이 아닌 폴더(support/ 등)를
만들어 그 파일이 http adapter 배럴을 import하고 기능 presentation이 그 파일을
import하면 presentation이 구체 adapter에 닿는다. 1105 리뷰 12-R3 변이에서
check:architecture와 ESLint가 둘 다 통과했다.

고른 방법
- 규칙의 from을 "src/features 아래 모든 파일, 기능의 adapters/ 폴더 밖"으로
  바꾼다(`^src/(features/|contexts/|apps/)`, pathNot
  `^src/features/([^/]+/adapters/|feature-adapter-contribution\.ts$)`). 규칙
  주석이 이미 "기능 안에서는 adapters/ 폴더만 src/adapters에 닿는다"고 적고
  있었고, 그 문장을 경로로 옮긴 것이다. 파일 단위 예외는 기존 하나
  (feature-adapter-contribution.ts, type only) 그대로고 새로 더하지 않았다.
- domain·application·presentation은 자기 규칙이 이미 src/adapters를 막는다.
  이제 그 파일들이 src/adapters를 import하면 이 규칙도 같이 걸린다(위반 두 줄).
  더 엄격해질 뿐 허용이 바뀌지는 않는다.
- 지금 src/features에서 src/adapters를 import하는 곳은 reference-feature의
  adapters/ 두 파일과 feature-adapter-contribution.ts뿐이라 새 위반은 없다.
  create:feature가 만드는 adapter import도 adapters/ 안이다.
- 그래프 회귀 fixture에 support/ 재수출(거절), 그것을 읽는 presentation,
  기능 adapters/ import(허용)를 더하고 check:architecture에 두 단언을 더했다.
  규칙 경로를 check:architecture와 같은 방식으로 읽는 vitest 테스트를 더했다.
- layers.md 표와 매뉴얼 01의 설명을 고쳤다.
- 버린 대안: 계층 밖 폴더 자체를 금지(폴더 이름 목록 검사). 제품이 contracts/
  같은 다른 이름을 쓰면 계속 목록을 고쳐야 한다. 규칙마다 support/ 패턴 추가:
  다음 폴더 이름에서 같은 틈이 난다.

위험·한계
- 다운스트림이 기능 안 adapters/ 밖에서 src/adapters를 import하고 있었다면 이제
  check:architecture가 실패한다. 그 파일을 adapters/로 옮기면 된다.
- ESLint는 여전히 간선 하나만 보므로 이 경로를 잡지 않는다. 그래프가 잡는다.

검증
- desktop batch에서 확인: node scripts/run-vitest.ts run
  tests/architecture/feature-adapter-reach.test.ts, corepack pnpm
  check:architecture(그래프 fixture 단언 2개 추가 PASS, 저장소 위반 0 기대).
- RED 기대: "rejects a concrete adapter import from a feature folder that is not
  a layer", "leaves a feature's adapters folder and the type-only contribution
  file to reach adapters"(support/adapters/ 경로 단언).

Refs: 0929/12-03
2026-11-05 22:41:50 +09:00
DongHyeonka fbd8f7d148 chore(review): 1103 게이트·드릴 조치 브랜치를 합친다
Refs: docs/reviews/2026-11-03-maturity-review/README.md 02-06 11-06 12-09 10-01 11-03~11-05 12-02 12-04 12-05 12-08 14-04 16-02

# Conflicts:
#	docs/manual/01-add-a-feature.md
#	docs/manual/02-decision-tables.md
#	docs/manual/reference/patterns.md
2026-11-04 23:08:05 +09:00
DongHyeonka d1db7e7887 fix(architecture): 금지 fixture를 그 계층의 운영 ESLint 설정으로 검사한다
문제
tests/fixtures/architecture/forbidden/**에는 fixture 전용 ESLint 블록이
붙어 있었다. 모든 계층의 금지 import와 fetch·localStorage·sessionStorage
금지를 합친 것이다. check-architecture.ts는 fixture마다 ESLint 종료 코드가
0이 아니면 거부됐다고 셌다. 그래서 운영 src/presentation/** 블록에서 계층
import 금지와 fetch 금지를 지워도(변이 M2) check:architecture는 "9 forbidden
rejected"로 통과했다. 전역 fetch·localStorage 금지는 이 ESLint 블록 말고 지키는
검사가 없다.

고른 방법
- 새 scripts/lib/architecture-lint-fixtures.ts가 fixture마다 그것이 대표하는
  운영 경로(lintAs, 예: src/presentation/__architecture_fixture__/…)와 거부해야
  하는 규칙(rejectedBy)을 적는다. ESLint API lintText(code, { filePath })로
  그 경로의 운영 설정을 그대로 적용한다. 금지 fixture는 그 규칙이 보고해야
  통과하고, 허용 fixture는 계층 규칙(no-restricted-imports·globals)이 아무것도
  보고하지 않아야 통과한다. 목록에 없는 fixture 파일도 실패로 센다.
- domain fixture는 domain 코드가 실제로 사는 src/features/*/domain 블록으로
  검사한다(최상위 src/domain 폴더는 없다).
- fixture 전용 ESLint 블록을 지운다. check-architecture.ts에서 쓰이지 않게 된
  pnpm 하위 프로세스 실행과 npm_execpath 요구를 지운다.
- 버린 대안: 금지 fixture 삭제. import 방향은 그래프가 지키지만 전역 금지의
  검출이 0이 된다. 종료 코드만 보고 운영 경로로 옮기기. 다른 규칙(화면 문구
  등)이 걸려도 거부로 센다.

위험·한계
- 계층 규칙 이름이 바뀌면 fixture 표의 rejectedBy도 같이 고쳐야 한다(고치지
  않으면 실패로 드러난다).
- 출력 문구가 "3 allowed PASS, 9 forbidden rejected by the production rule for
  their layer"로 바뀐다. 이 문구를 읽는 스크립트는 없다.

검증
- RED: 수정 전 변이 M2(운영 presentation 블록의 계층 import 금지와 fetch 금지
  삭제)에서 check:architecture exit 0, "9 forbidden rejected".
- 수정 뒤 같은 변이에서 check:architecture exit 1, presentation fixture 5개가
  "was accepted"로 실패. 되돌린 뒤 exit 0.
- 새 tests/unit/architecture-lint-fixtures.test.ts 3건(운영 설정 통과,
  overrideConfig로 규칙을 끄면 실패, 목록 밖 fixture 실패) 통과.
  architecture-report 3건 통과. check:types 통과, eslint 통과.

Refs: docs/reviews/2026-11-03-maturity-review/12-guardrails-ci.md 12-04
2026-11-04 21:10:19 +09:00
DongHyeonka 64f19ac665 fix(architecture): zod 하위 경로 import도 src/contracts/zod.ts를 거치게 한다
문제
zod-is-reached-through-contracts-zod 규칙의 to.path가 ^zod$다. src 파일이
"zod/v4"를 import하면 check:architecture가 rc=0으로 통과한다(실험 Z1). 그
모듈은 src/contracts/zod.ts의 jitless 설정보다 먼저 스키마를 만들 수 있고,
그러면 운영 CSP가 zod의 Function 탐침을 부팅마다 보고한다(F-7).

고른 방법
to.path를 ^zod(/|$)로 넓힌다. 그래프 fixture에 "zod/v4"를 import하는 파일과
그것이 거절되는지 보는 회귀 검사를 더했다. layers.md 규칙 표도 고쳤다.

버린 대안
- eslint no-restricted-imports에 zod 패턴 추가: 같은 규칙을 두 도구에
  둔다. 경계 규칙은 dependency-cruiser가 정본이다.

위험·한계
- src 안에 zod 하위 경로 import는 지금 없다(grep). 다운스트림이 쓰고
  있으면 check:architecture가 실패한다. src/contracts/zod.ts의 z로 바꾼다.

검증
- 수정 뒤: 참조 기능 스키마 파일 import를 "zod/v4"로 바꾸면
  "Architecture violation [zod-is-reached-through-contracts-zod]: ... ->
  zod/v4"로 실패, "zod"도 실패.
- 규칙을 ^zod$로 되돌리면 새 회귀 검사 "zod subpath import outside
  src/contracts/zod.ts is rejected"가 실패한다.
- check:architecture(29 regression checks PASS), check:types, eslint,
  verify:documentation 통과.

Refs: docs/reviews/2026-11-03-maturity-review/07-contracts.md P-07-06
2026-11-04 20:38:14 +09:00
donghyeon-kaandClaude Opus 5.5 9dc95ca066 fix(contracts): set zod jitless before any schema is built so the production csp sees no eval (F-7, 13-08)
zod probed Function("") on its first object schema, which the production CSP
(no unsafe-eval) reported on every boot. Schema code now imports z from
src/contracts/zod.ts, enforced by a dependency-cruiser rule, and the CSP smoke
drops its init-script workaround.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 12:58:57 +09:00
DongHyeonkaandClaude Opus 5.5 b0f7944b41 fix(architecture): print why an import is forbidden and where to go (12-11)
Graph violations printed only the rule name and file pair, and ESLint only the
pattern. The graph now prints the import specifier and the rule's comment,
every rule has one, and ESLint pattern groups carry a message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:49:32 +09:00
DongHyeonkaandClaude Opus 5.5 e070efa6b5 fix(architecture): narrow boundary exceptions and give each a reason and owner (12-07)
Every adapter group's second-level index.ts counted as a public barrel although
only storage/indexeddb and storage/opfs need one. layers.md called the
cross-context-invalidation kernel edge frozen while any adapter could use it.
Exceptions now name the exempt path, reason, owner and revisit condition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:43:41 +09:00
DongHyeonkaandClaude Opus 5.5 7bbe48277c fix(architecture): refuse import.meta.glob in the import graph (12-06)
A glob loaded adapter modules without naming one, so the graph, ESLint and the
type check all passed it. It is now a parse failure like a non-literal import().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:40:00 +09:00
DongHyeonkaandClaude Opus 5.5 39b9fbffb7 fix(architecture): stop running dependency-cruiser, which checked zero modules (12-05)
dependency-cruiser 18 cannot parse TypeScript 7, so it cruised no module, passed,
and its report and the docs claimed it checked the layers. The import graph is
the only checker; .dependency-cruiser.json stays as its rule file (D-11).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:37:21 +09:00
DongHyeonkaandClaude Opus 5.5 7f2a1607f3 refactor(architecture): move regex import rules into the import graph (12-10, 12-08)
Icon vendor, design-system deep import and realtime composition were regular
expressions beside graph rules, and the regex missed relative deep imports
inside presentation. They are graph rules with fixtures now, with the
components/ui facades and page-templates named. package-script-graph.ts stays;
the reason is recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:33:14 +09:00
DongHyeonkaandClaude Opus 5.5 f8b6a3613c fix(architecture): reject adapter re-exports through feature roots, contexts and apps (12-03)
The graph checks one edge at a time, so presentation reached a concrete adapter
through a re-export in a feature root file or a context with every rule passing.
Those modules may no longer import src/adapters, and presentation may no longer
import apps or contexts (app-router.tsx is the named exception).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:26:27 +09:00
donghyeon-ka 6f6c48ebb7 refactor: 도메인이 100개 1000개씩 늘어나도 유지보수 쉬운 구조로 변경 2026-09-24 00:42:21 +09:00