mirror of
https://github.com/azaion/ui.git
synced 2026-06-21 08:01:10 +00:00
[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:
@@ -70,21 +70,15 @@ const SOURCE_EXT = new Set(['.ts', '.tsx'])
|
||||
// Allowed by construction:
|
||||
// - barrel: from '../api' (no further /<File>)
|
||||
// - intra-component: from './sse' (starts with ./, not ../)
|
||||
const COMPONENT_DIRS = 'api|auth|components|features/[a-z-]+|hooks|i18n'
|
||||
const COMPONENT_DIRS = 'api|auth|class-colors|components|features/[a-z-]+|hooks|i18n'
|
||||
const DEEP_IMPORT_RE = new RegExp(
|
||||
String.raw`from\s+['"](?:\.\./)+(?:src/)?(?:${COMPONENT_DIRS})/[A-Za-z]`,
|
||||
)
|
||||
|
||||
// F3-pending exemptions for STC-ARCH-01:
|
||||
// - `features/annotations/classColors` — classColors is logically owned by
|
||||
// 11_class-colors but physically lives under 06_annotations. Re-exporting
|
||||
// it through the 06_annotations barrel creates a circular import:
|
||||
// AnnotationsPage -> DetectionClasses -> 06_annotations barrel
|
||||
// -> AnnotationsPage
|
||||
// so consumers (DetectionClasses, tests/detection_classes.test.tsx)
|
||||
// import the file directly. F3 will move the file and remove this
|
||||
// exemption.
|
||||
const ARCH_IMPORTS_EXEMPT_RE = /features\/annotations\/classColors/
|
||||
// STC-ARCH-01 has no exemptions today. F3 (the classColors carry-over) was
|
||||
// closed by AZ-511 — the file moved to its own component (`src/class-colors/`)
|
||||
// with a proper barrel, and consumers now import via that barrel.
|
||||
const ARCH_IMPORTS_EXEMPT_RE = null
|
||||
|
||||
const ARCH_IMPORTS_SCAN_ROOTS = ['src', 'tests', 'e2e']
|
||||
|
||||
@@ -166,7 +160,7 @@ function scanArchImports(file, root) {
|
||||
const line = lines[i]
|
||||
if (/^\s*\/\//.test(line)) continue
|
||||
if (!DEEP_IMPORT_RE.test(line)) continue
|
||||
if (ARCH_IMPORTS_EXEMPT_RE.test(line)) continue
|
||||
if (ARCH_IMPORTS_EXEMPT_RE && ARCH_IMPORTS_EXEMPT_RE.test(line)) continue
|
||||
hits.push(`${rel}:${i + 1}: ${line.trim().slice(0, 200)}`)
|
||||
}
|
||||
return hits
|
||||
|
||||
@@ -497,12 +497,11 @@ if [ "$RUN_STATIC" = "true" ]; then
|
||||
# from '../../components/ConfirmDialog'
|
||||
# from '../src/features/annotations/AnnotationsPage' (test files)
|
||||
# Allowed:
|
||||
# - barrel imports: from '../api', from '../../components'
|
||||
# - barrel imports: from '../api', from '../../components', from '../class-colors'
|
||||
# - intra-component: from './sse', from './MediaList' (./ not ..)
|
||||
# - F3-pending edge: from '../features/annotations/classColors'
|
||||
# (classColors lives under 06_annotations until F3 moves it; importing
|
||||
# through the 06_annotations barrel would create a circular import
|
||||
# AnnotationsPage → DetectionClasses → barrel → AnnotationsPage.)
|
||||
# No exemptions today — the prior F3 carry-over (classColors deep import) was
|
||||
# closed by AZ-511 when the file moved to `src/class-colors/` with its own
|
||||
# barrel.
|
||||
static_check_no_cross_component_deep_imports() {
|
||||
node "$PROJECT_ROOT/scripts/check-arch-imports.mjs" --mode=arch-imports
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user