Skip to content

Sprint 1: refactor App workflows and add regression tests#33

Open
Coldaine wants to merge 2 commits into
Laumss:mainfrom
Coldaine:codex/loom-sprint-1-refactor
Open

Sprint 1: refactor App workflows and add regression tests#33
Coldaine wants to merge 2 commits into
Laumss:mainfrom
Coldaine:codex/loom-sprint-1-refactor

Conversation

@Coldaine
Copy link
Copy Markdown

@Coldaine Coldaine commented May 9, 2026

Summary

  • extract App.js workflow ownership into import, grouping, zip, export, runtime, and search modules/hooks
  • add regression fixtures and Jest coverage for provider parsing, branch grouping, zip import, search indexing, and markdown/PDF export orchestration
  • document the new Sprint 1 boundaries and add CI-ready test commands

Verification

  • npm run test:ci
  • npm run build

Copilot AI review requested due to automatic review settings May 9, 2026 04:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors src/App.js by extracting import/runtime/search/export workflows into dedicated services and hooks, and adds a Jest-based regression test suite to validate the new boundaries.

Changes:

  • Extracted file import parsing/metadata/merge logic into fileImportService + useFileManager, and moved global search indexing timing into useGlobalSearchIndex.
  • Added ZIP import + remote sync service (zipConversationService) and export orchestration service (exportOrchestrator), plus runtime adapter helpers for extension/web payload flows.
  • Introduced Jest + Babel test setup with fixtures and regression coverage for import parsing, branch grouping, ZIP import, search indexing, and export orchestration.

Reviewed changes

Copilot reviewed 23 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/zipConversationService.test.js Regression test for ZIP import parsing + renames/export context + generated File payloads.
tests/styleMock.js Jest moduleNameMapper stub for stylesheet imports.
tests/helpers/fileFactories.js Test helpers to emulate File-like objects for text/binary inputs.
tests/globalSearchManager.test.js Regression test ensuring imported content is indexed and searchable with rename mapping applied.
tests/fixtures/claude-conversation.json Claude conversation fixture used across tests.
tests/fixtures/chatgpt-conversation.json ChatGPT branch fixture used to validate provider parsing/branch behavior.
tests/fileMock.js Jest moduleNameMapper stub for static assets.
tests/fileImportService.test.js Regression test for provider parsing into processed data + metadata.
tests/exportOrchestrator.test.js Regression tests for Markdown/PDF export orchestration with mocked exporters.
tests/branchGroupingService.test.js Regression test for grouping main + branch JSONL files together.
src/utils/globalSearchManager.js Refactor to reuse shared import pipeline (processImportFile) and adjust cache clearing.
src/services/zip/zipConversationService.js New ZIP import parsing + card generation + remote sync batching logic.
src/services/runtime/runtimeAdapterService.js New runtime helpers for lang/theme application, payload-to-File conversion, and session persistence.
src/services/import/fileImportService.js New shared import pipeline (parse/process/metadata/batch extraction/merge helpers).
src/services/import/conversationGroupingService.js New grouping logic for JSONL branch reconstruction prior to merged import.
src/services/export/exportOrchestrator.js New orchestration for Markdown/PDF exports + extension config resolution + pending export handling.
src/hooks/useGlobalSearchIndex.js New hook centralizing “build global index when ready” timing and error handling.
src/hooks/useFileManager.js New hook owning file loading, metadata extraction, merged JSONL handling, and file switching.
src/App.js Integrates the extracted hooks/services; removes inlined workflow implementations.
README.md Adds test commands and Sprint 1 architecture reference; minor formatting change.
package.json Adds Jest/Babel dev deps, Jest config, and test, test:watch, test:ci scripts.
docs/sprint-1-architecture.md New architecture note documenting Sprint 1 module boundaries.
babel.config.js Babel config for Jest transforms (targets current Node).
.gitignore Adds node_modules/, build/, and coverage/ ignores.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +6 to +27
const groups = new Map();
const fileNameToIntegrity = new Map();
const integrityToGroup = new Map();
const chatIdHashToGroup = new Map();
const mainChatToGroup = new Map();

filesData.forEach((fileData) => {
const metadata = fileData.data[0]?.chat_metadata;
const integrity = metadata?.integrity;
const mainChat = metadata?.main_chat;
const chatIdHash = metadata?.chat_id_hash;

if (mainChat) return;

const baseName = normalizeFileBaseName(fileData.fileName);
const groupKey = integrity || chatIdHash?.toString() || fileData.fileName;

if (integrity) {
fileNameToIntegrity.set(baseName, integrity);
fileNameToIntegrity.set(fileData.fileName, integrity);
integrityToGroup.set(integrity, groupKey);
}
Comment on lines 8 to 13
constructor() {
this.messageIndex = new Map();
this.fileData = new Map();
this.fileCache = new Map(); // 文件内容的缓存 { fileName: { lastModified: timestamp, data: parsedData } }
this.searchCache = new Map();
}
Comment thread README.md

- `npm test` runs the Jest suite locally.
- `npm run test:ci` runs the CI-ready, non-watch test command with coverage.
- [`docs/sprint-1-architecture.md`](C:/Users/pmacl/.codex/worktrees/6c61/loominary/docs/sprint-1-architecture.md) summarizes the Sprint 1 module boundaries.
@@ -0,0 +1,13 @@
# Sprint 1 Architecture Note

Sprint 1 narrows [`/src/App.js`](C:/Users/pmacl/.codex/worktrees/6c61/loominary/src/App.js) back to app composition by moving critical workflows into dedicated seams:
Comment thread README.md
## Contributing

A contributing guide and development roadmap are on the way. In the meantime, if you have any idea, please [open an discussion](https://github.com/Laumss/Loominary/discussions). No newline at end of file
A contributing guide and development roadmap are on the way. In the meantime, if you have any idea, please [open an discussion](https://github.com/Laumss/Loominary/discussions).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants