[AZ-511] classColors carve-out to src/class-colors/ (closes F3)

Move src/features/annotations/classColors.ts to its own component directory
src/class-colors/ with a proper barrel; update the 4 consumer imports to go
through the barrel; remove the F3-pending exemption from STC-ARCH-01 and from
the architecture test fixture; clean up the 5 coupled doc/script touchpoints.
Closes baseline finding F3 and retires the 5-coupled-places carry-over surface
logged in LESSONS.md 2026-05-12.

- Add `class-colors` to scripts/check-arch-imports.mjs COMPONENT_DIRS so deep
  imports past the new barrel are caught symmetric to every other component.
- Replace the architecture test "exemption WORKS" fixture with the stronger
  "deep import into class-colors NOW FAILS" assertion (Risk 4 mitigation).
- module-layout.md: Layout Rules + Per-Component Mapping (11_class-colors,
  06_annotations, 03_shared-ui) + Verification Needed #1 + shared/class-colors
  block all updated to reflect the new home.
- 11_class-colors/description.md: Caveats §7 + Module Inventory updated.
- architecture_compliance_baseline.md: F3 marked CLOSED with full pre-resolution
  context preserved (mirrors AZ-485/F4 + AZ-486/F7 pattern); F4 carry-forward
  exemption note retired.
- 04_verification_log.md: open questions #1 + #8 marked RESOLVED.
- Build passes with no circular-import warnings (AC-4); fast suite 231/13
  skipped green (AC-5); static profile green (AC-3 — zero exemptions remain).

Batch report: _docs/03_implementation/batch_14_cycle3_report.md

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-13 03:08:36 +03:00
parent 70fb452805
commit c368f60853
19 changed files with 228 additions and 69 deletions
+6
View File
@@ -0,0 +1,6 @@
export {
getClassColor,
getPhotoModeSuffix,
getClassNameFallback,
FALLBACK_CLASS_NAMES,
} from './classColors'
+1 -1
View File
@@ -7,7 +7,7 @@ import { api, endpoints } from '../api'
// Importing through the 06_annotations barrel would create a cycle
// (DetectionClasses -> 06_annotations barrel -> AnnotationsPage -> DetectionClasses).
// STC-ARCH-01 exempts this single path as an F3-pending edge.
import { getClassColor, FALLBACK_CLASS_NAMES } from '../features/annotations/classColors'
import { getClassColor, FALLBACK_CLASS_NAMES } from '../class-colors'
import type { DetectionClass } from '../types'
interface Props {
+1 -1
View File
@@ -7,7 +7,7 @@ import CanvasEditor, { type CanvasEditorHandle } from './CanvasEditor'
import AnnotationsSidebar from './AnnotationsSidebar'
import { DetectionClasses } from '../../components'
import { AnnotationSource, AnnotationStatus, MediaType } from '../../types'
import { getClassColor, getClassNameFallback, getPhotoModeSuffix } from './classColors'
import { getClassColor, getClassNameFallback, getPhotoModeSuffix } from '../../class-colors'
import type { Media, AnnotationListItem, Detection } from '../../types'
export default function AnnotationsPage() {
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { FaDownload } from 'react-icons/fa'
import { api, createSSE, endpoints } from '../../api'
import { getClassColor } from './classColors'
import { getClassColor } from '../../class-colors'
import type { Media, AnnotationListItem, PaginatedResponse } from '../../types'
interface Props {
+1 -1
View File
@@ -2,7 +2,7 @@ import { useRef, useEffect, useState, useCallback, forwardRef, useImperativeHand
import { endpoints } from '../../api'
import { MediaType } from '../../types'
import type { Media, AnnotationListItem, Detection, Affiliation, CombatReadiness } from '../../types'
import { getClassColor, getPhotoModeSuffix, getClassNameFallback } from './classColors'
import { getClassColor, getPhotoModeSuffix, getClassNameFallback } from '../../class-colors'
interface Props {
media: Media
-8
View File
@@ -2,11 +2,3 @@ export { default as AnnotationsPage } from './AnnotationsPage'
// CanvasEditor remains in the Public API while F2 (cross-feature edge to
// 07_dataset) is open. Closing F2 will remove this re-export.
export { default as CanvasEditor } from './CanvasEditor'
//
// classColors symbols are NOT re-exported here. The file is logically owned
// by 11_class-colors but lives under this directory until F3 moves it. Re-
// exporting through this barrel creates a circular dependency
// AnnotationsPage -> DetectionClasses -> 06_annotations barrel -> AnnotationsPage
// because DetectionClasses (03_shared-ui) imports classColors. Consumers
// import classColors directly via `src/features/annotations/classColors`
// as a documented F3-pending exemption. STC-ARCH-01 carries the exemption.