5탭 계약 대조 — 계약 원본 사본을 앱 저장소에 두어 어느 체크아웃에서도 검증

This commit is contained in:
Sn-Kinos
2026-09-14 13:30:26 +09:00
parent 60ea6974df
commit 1c51662c25
3 changed files with 76 additions and 1 deletions
+24 -1
View File
@@ -300,8 +300,31 @@ Future<void> _enterShell(WidgetTester tester) async {
/// `design/craft-allowlist.yaml` 의 `APP_TABS` 를 읽어 온다.
/// 앱 코드가 계약 표기에서 벗어나면 여기서 깨진다.
///
/// 계약 정본은 상위 저장소(p-fancake)에 있고 이 저장소(p-fanuzu)는 분리돼 있어
/// 상대 경로가 체크아웃 위치를 탄다. 그래서 저장소 안에 사본을 두고
/// **FANUZU_DESIGN_DIR → 저장소 내 design/ → 형제 경로** 순으로 본다.
/// 사본이 있으므로 git worktree 에서도 환경 변수 없이 통과한다.
///
/// 하나도 없으면 **통과가 아니라 실패**로 끝낸다 — 못 읽은 것을 「맞다」로 세면
/// 계약 대조가 조용히 사라진다.
List<String> _contractTabs() {
final file = File('../design/craft-allowlist.yaml');
final candidates = [
if (Platform.environment['FANUZU_DESIGN_DIR'] case final dir?)
'$dir/craft-allowlist.yaml',
'design/craft-allowlist.yaml',
'../design/craft-allowlist.yaml',
'../p-fancake/design/craft-allowlist.yaml',
];
final file = candidates
.map(File.new)
.firstWhere(
(f) => f.existsSync(),
orElse: () => throw StateError(
'craft-allowlist.yaml 을 찾지 못했다. FANUZU_DESIGN_DIR 로 지정하라. '
'찾아본 곳: ${candidates.join(' · ')}',
),
);
final line = file.readAsLinesSync().firstWhere(
(l) => l.trimLeft().startsWith('APP_TABS:'),
orElse: () =>