Commit Graph

80 Commits

Author SHA1 Message Date
Misaka_Company
c86508989b docs: add release notes for version 1.12.2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 15:20:27 +08:00
Misaka_Company
b2b29e9754 docs: add release notes for version 1.12.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 14:53:23 +08:00
Misaka_Company
343cb24234 chore: run pretier format across project
- Format TypeScript source files
- Format documentation files
- Update eslint config formatting
2026-04-14 14:03:58 +08:00
Misaka_Company
1f033eb315 docs: add plans/ directory naming conventions
- Add date-prefixed naming format: YYYY-MM-DD-description-type.md
- Document -plan.md and -design.md type suffixes
- Add examples from existing plan files
- Update classification examples to include plans/ naming
2026-04-14 12:25:46 +08:00
Misaka_Company
681f3ba517 refactor(docs): reorganize documentation directory structure
- Create user/ - User guides and configuration documentation
- Create features/ - Feature specifications and business flows
- Create debugging/ - Debug guides and quick references
- Create testing/ - Test infrastructure, reports, and plans
- Create internal/ - Internal plans, analyses, and templates
- Move cleaner/*.md to cleaner/ directory
- Move LOGGING_*.md to developer/guides/

Add docs/README.md as documentation index with category navigation
and quick lookup guide.

The reorganized structure makes it easier for users and developers
to quickly locate relevant documentation.
2026-04-14 12:15:09 +08:00
Misaka_Company
1a48dca57c docs: add release notes for version 1.12.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 10:50:05 +08:00
Misaka_Company
7dfa88c2a3 refactor(cleaner): remove Markdown report generator
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 12:06:19 +08:00
Misaka_Company
e1d55b8b39 feat(cleaner): add outer-level retry on fatal crash with execution ID
When CleanerService hits a fatal error (browser crash, timeout), the
outer catch now sets result.crashed=true. CleanerApplicationService
detects this, closes the dead browser session, re-logs into ERP, and
re-runs all orders once. An execution ID (CLN-yyyyMMddHHmmss-XXXX)
generated at startup ensures report files are deduplicated across
retries. Reports now display execution ID and app version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 10:07:29 +08:00
Misaka
8b173890fa feat(cleaner): add multi-signal deletion verification with material-level retry
Replace fragile single-signal (row change only) deletion verification
with a robust multi-signal approach using row change + material count +
ERP message detection. Add material-level retry (up to 3 attempts) for
transient failures, with detailed tracking of failed/uncertain deletions.

- Add DeletionOutcome/DeletionErrorCategory enums and FailedMaterial type
- Add deleteWithVerification() core method with retry logic
- Add evaluateDeletionSignals() pure logic (unit tested, 9 cases)
- Add helper methods: readMaterialCount, checkErpMessages, handleConfirmDialog
- Extend CleanerResult/OrderCleanDetail with failed/uncertain tracking
- Update report generator with failed materials detail section
- Update ExecutionReportDialog to display failed/uncertain stats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 21:55:47 +08:00
Misaka_Company
1c0a000a67 fix(preload): add missing selectedManagers param to getCleanerData type declaration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 08:52:58 +08:00
Misaka
bb86208d32 docs: add release notes for version 1.11.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 19:22:20 +08:00
Misaka
3be7959067 feat(cleaner): support selectedManagers filtering for admin cleaner execution
Admin can now pass selectedManagers to getCleanerData so material codes
are queried from MaterialsToBeDeleted by ManagerName IN (selectedManagers).
When no managers are selected, fallback to DiscreteMaterialPlanData by
orderNumbers. User behavior is unchanged. Includes updated tests and
role-based flow documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 19:20:22 +08:00
Misaka
fb3bdbc493 test: fix mock configuration and lint errors in unit tests
- Fix logger mock missing default export in extractor.test.ts
- Fix performance-monitor mock configuration
- Fix prefer-const in validation-database.test.ts
- Fix no-unsafe-function-type in cleaner-handler.test.ts
- Fix no-empty-function in cleaner-application-service.test.ts
- Run prettier format on test files

All 622 tests now passing (59 files, 3 skipped)
2026-04-05 22:04:32 +08:00
Misaka
d16f2d1af0 docs: add release notes for version 1.10.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 21:40:55 +08:00
Misaka
d0f8ad0fef test(erp): add unit tests for ERP services and test coverage docs
Add unit tests for core ERP service modules including ErpBrowserManager,
cleaner, erp-auth, extractor-core, extractor, and order-resolver. Also
includes test coverage improvement plan and quality review report.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 17:23:00 +08:00
Misaka
e54d94fce2 style: apply formatter to docs, types, and test files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 11:56:22 +08:00
Misaka
6c730616b8 docs: add PostgreSQL integration implementation plan
6-task TDD plan covering SqlDialect abstraction, PostgreSqlService,
DAO refactoring, and config/factory integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 09:14:33 +08:00
Misaka
4f4e5fd91a docs: add PostgreSQL integration design document
Design for integrating PostgreSQL as a third database option using
a SqlDialect abstraction layer to unify SQL dialect differences
across MySQL, SQL Server, and PostgreSQL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 09:09:39 +08:00
Misaka
d45b65fa44 test: complete Wave 3 - Mock Library (6 tasks, 15+ Mock factories)
Wave 3: Mock Library Implementation
====================================

**Mock Factories (15+ total)**:
- Logger/ConfigManager (createMockLogger, createMockConfigManager)
- ErpAuthService (createMockErpAuthService with isLoggedIn/loginFails options)
- TypeORM/Database (createMockDataSource, createMockRepository, createMockDatabaseService)
- Electron/IPC (createMockElectron, createMockIpcRenderer)
- Utility modules (createMockFs, createMockPath, createMockExcelJS, createMockAxios, createMockChildProcess, createMockCrypto)

**Files Modified/Created**:
- tests/mocks/types.ts: +243 lines (Mock type definitions)
- tests/mocks/index.ts: +475 lines (Factory function implementations)
- docs/MOCK_LIBRARY_USAGE.md: 197 lines (Usage guide with 12+ examples)
- tests/unit/mocks/electron-ipc.test.ts: 12 tests (Electron/IPC Mock verification)

**Quality**:
- Zero any types
- All Mocks ≤20-30 lines
- Complete JSDoc documentation
- All factory functions support overrides customization

**Total Progress**:
- Wave 1: 4/4 
- Wave 2: 5/5 
- Wave 3: 6/6 
- Overall: 15/34 
2026-04-04 20:33:45 +08:00
Misaka
7473f34485 test: complete Wave 2 - all entity factories + documentation
- tests/fixtures/factory.ts: Config/Database + 6 additional factories (547 lines total)
  - UserFactory (3 methods: createAdmin, createUserDefault, createGuest)
  - OrderFactory (2 methods: createOrder, createOrders)
  - MaterialFactory (2 methods: createMaterial, createMaterials)
  - ConfigFactory (1 method: createErpConfig)
  - DatabaseFactory (1 method: createDatabaseConfig)
  - ExtractResultFactory (2 methods)
  - CleanerResultFactory (2 methods)
  - AuditLogFactory (1 method)
  - UpdateReleaseFactory (1 method)
  - ProductionInputFactory (1 method)
  - ValidationErrorFactory (1 method)
  Total: 17 factory methods across 10 factory classes

- Test coverage:
  - user-factory.test.ts: 3 tests
  - order-material-factory.test.ts: 4 tests
  - config-factory.test.ts: 5 tests
  - other-factories.test.ts: 15 tests
  Total: 27 factory tests

- docs/TEST_FACTORY_USAGE.md: User guide with examples (152 lines)

All factories support overrides customization and follow the <=100 lines per factory constraint.
2026-04-04 20:23:45 +08:00
Misaka
2e102d8ab3 refactor(tests): Move ConfigManager and Update tests to proper locations
## Summary:
- Create tests/unit/config-manager.test.ts (6 tests)
- Move ConfigManager tests from logger.test.ts to dedicated file
- Create tests/integration/update-workflow.test.ts (3 tests)
- Update skip comments in update-service.test.ts
- Reduce skipped tests from 8 to 4 (-50%)

## Results:
- Test Files: 42 passed (100%)
- Tests: 325 passed, 4 skipped (98.8% execution)
- Skipped tests reduced: 8 → 4
- Coverage improved: 97.5% → 98.8%

## Architecture Improvements:
- Logger and ConfigManager tests completely separated
- Unit tests vs Integration tests responsibilities clarified
- Mock strategies clearly defined per file
- Skipped tests have clear documentation

## Files Changed:
- NEW: tests/unit/config-manager.test.ts
- NEW: docs/P2_REFACTOR_SUMMARY.md
- NEW: docs/SKIPPED_TESTS_EXPLANATION.md
- MODIFIED: tests/unit/logger.test.ts
- MODIFIED: tests/unit/update-service.test.ts
2026-04-04 19:13:49 +08:00
Misaka
0ceb09df2a docs: add P2 test fix plan (13 failures to 0)
- Detailed analysis of 3 failing test files
- Task breakdown: logger.test.ts (11 failures), update-service (1), update-installer (1)
- Estimated effort: 3-4 hours
- Solution blueprints for each failure type
2026-04-04 18:45:54 +08:00
Misaka
1cbb4492ba docs: add P0/P1 test fix summary report 2026-04-04 18:43:47 +08:00
Misaka
fe02e37848 test(P0): fix critical test infrastructure issues
- Add complete Electron mock with all required APIs (getVersion, getName, etc.) - fixes 20 failing suites
- Fix Winston format mock to support chainable calls - fixes logger test errors
- Add comprehensive TypeORM mock for repository tests - fixes 4 failing tests
- Fix bootstrap-runtime test path assertions
- Update Excel parser tests to skip file I/O (moved to integration)
- Add test review report and improvement plan documentation

## Test Results:
- Failed test suites: 20 → 6 (-70%)
- Failed tests: 48 → 16 (-67%)
- Pass rate: 67% → 94% (+27%)

## Remaining (P1/P2 - not blocking):
- logger.test.ts: 11 failures (config-manager circular dependency, needs refactoring)
- manual tests: 2 failures (should be moved to integration)
- Minor assertion fixes in update-service tests

Fixes: P0 test infrastructure issues
2026-04-04 18:36:38 +08:00
Misaka
a5c4639392 docs: add release notes for version 1.9.0 2026-04-04 18:11:24 +08:00
Misaka
42b76c4de5 docs(logging): add comprehensive logging operations guide 2026-04-04 10:54:18 +08:00
Misaka
24d9bfebaf fix(logger): use app.isPackaged for log dir detection and add logging docs
Previously getLogDir() only checked app.isReady(), which caused
development builds to write logs to the user data directory instead
of the local project logs/ folder. Now uses app.isPackaged to
correctly distinguish production from development environments.

Also adds comprehensive logging system documentation and a debug
utility for verifying Electron environment detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 09:22:20 +08:00
Misaka
883f98065a refactor(logger): optimize logging architecture with 6 improvements
1. Extract shared module: consolidate getLogDir() and isProduction()
   into shared.ts, eliminate duplication across logger modules
2. Make retention config effective: delay file transport creation
   until config is loaded, apply appRetention/auditRetention from config.yaml
3. Add before-quit log flush: close logger and audit logger on
   app exit to prevent log loss
4. Unify logError entry point: remove duplicate logError from index.ts,
   re-export from error-utils.ts with richer error context
5. Renderer log level filtering: add client-side level check in preload
   to skip IPC for filtered-out messages
6. Child logger cache + audit cleanup: cache child loggers in IPC
   handler for performance, remove redundant timestamp format in audit logger

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 20:53:53 +08:00
Misaka_Company
51f8e0a6e7 docs: add release notes for version 1.8.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 15:18:02 +08:00
Misaka_Company
ffbda4c618 docs: add release notes for version 1.7.2 2026-04-01 13:55:50 +08:00
Misaka_Company
5b310d944b docs: add release notes for version 1.7.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 08:36:09 +08:00
Misaka_Company
571ec2325f docs: add release notes for version 1.7.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 15:28:08 +08:00
Misaka_Company
b7e9e5e472 docs: add release notes for version 1.6.2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 12:51:15 +08:00
Misaka_Company
82a6e24132 docs: add release notes for version 1.6.1
Document the major refactoring work and improvements in 1.6.1:
- Component architecture restructure (948 → 200 lines)
- Tooltip display fixes and formatting improvements
- Performance optimizations following Vercel React best practices
- Enhanced code maintainability and developer experience

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 12:15:38 +08:00
Misaka_Company
4a1a78ee14 refactor(ui): restructure ReportAnalysisDialog into modular architecture
Break down 948-line monolithic component into 11 focused modules following
Vercel React best practices:

**Module Structure:**
- types.ts: Centralized type definitions and constants
- hooks/: Custom hooks for data management (useReportData, useChartData, useReportFilters)
- components/: Reusable UI components (MetricSelector, ViewModeToggle, UserFilter, ReportChart, Tooltips)
- utils/: Parser and aggregator utility functions

**Key Improvements:**
- Reduced main component from 948 to ~200 lines (79% reduction)
- Separated concerns: data fetching, state management, and UI rendering
- Enhanced reusability and testability of individual components
- Maintained backward compatibility with existing imports

**Additional Fixes:**
- Fixed tooltip displaying duplicate average time values
- Formatted time values to 1 decimal place in both views
- Removed redundant time display from tooltip footer

**Performance Optimizations Applied:**
- Moved tooltip components outside parent component (rerender-no-inline-components)
- Hoisted regex pattern creation outside loops (js-hoist-regexp)
- Used functional setState updates (rerender-functional-setState)
- Memoized expensive computations and callbacks

All changes maintain existing functionality while improving code quality
and maintainability.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 12:14:35 +08:00
Misaka_Company
a56d37a2e9 docs: add release notes for version 1.6.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:36:41 +08:00
Misaka
ffc3cbb4a9 feat: implement background update download without blocking user login
- Change update check and download to async execution, allowing immediate app entry for User users
- Updates run in background, showing update prompt when download completes
- Optimize login flow experience, eliminating blocking time caused by update downloads
- Add release notes for version 1.5.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 21:43:03 +08:00
Misaka_Company
97bf918ed1 docs: add release notes for version 1.5.0 2026-03-24 17:45:34 +08:00
Misaka_Company
1d5268a4da docs: add release notes style guide 2026-03-24 17:44:48 +08:00
Misaka_Company
5cd1e98bbf docs: add release notes for v1.4.2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 10:20:52 +08:00
Misaka
bdde4fefd0 docs: add architecture handbook index 2026-03-21 20:51:16 +08:00
Misaka
180f4aab0a docs: add developer guides 2026-03-21 20:48:09 +08:00
Misaka
31a32db899 docs: add module handbook index 2026-03-21 20:39:28 +08:00
Misaka
14e7abe11e docs: add developer module guides 2026-03-21 20:37:50 +08:00
Misaka
57ca1d5650 docs: add developer architecture handbook 2026-03-21 20:25:45 +08:00
Misaka
f40512449a docs: add developer docs index 2026-03-21 20:10:50 +08:00
Misaka
957cfbda46 docs: add react optimization plan 2026-03-21 18:40:55 +08:00
Misaka
325e6fcc89 docs: add electron optimization plan 2026-03-21 10:28:11 +08:00
Misaka
0e77479955 style: format codebase files 2026-03-21 09:34:44 +08:00
Misaka
08bd2cb7d5 docs: add refactor overview documents 2026-03-21 09:07:13 +08:00