Skip to content

fix: thread export main detection - #8

Merged
ECWireless merged 1 commit into
mainfrom
fix/thread-export-main-detection
Aug 1, 2026
Merged

ECWireless merged 1 commit into
mainfrom
fix/thread-export-main-detection

Conversation

@ECWireless

@ECWireless ECWireless commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

This pull request updates the logic for merging channel and thread exports, making the identification of the main export file more robust and explicit by requiring the channel ID as a parameter. It also improves test coverage for edge cases and updates configuration files to avoid leaking sensitive or unnecessary data.

Main export identification and merging logic:

  • Updated mergeThreadsInDirectory in src/services/thread-merger.ts to require the channelId parameter and identify the main export file by matching the trailing ID in its filename to the provided channel ID, rather than by inspecting message contents. This makes the process more reliable and explicit. [1] [2]
  • Updated all usages of mergeThreadsInDirectory in src/services/exporter.ts and tests to pass the channelId argument. [1] [2] [3] [4]

Test improvements:

  • Added a new test case to verify that the main export is correctly identified even when thread exports omit their starter messages, ensuring the updated logic handles this scenario.

Configuration updates:

  • Updated .dockerignore to exclude .env and /data directories, preventing sensitive or unnecessary files from being included in Docker builds.

Summary by CodeRabbit

  • Bug Fixes

    • Improved channel archiving by selecting the correct primary export for each channel.
    • Fixed thread merging when exported replies do not include the original starter message.
    • Enhanced validation feedback when the expected channel export is missing.
  • Tests

    • Added coverage for exports with omitted starter messages, ensuring main and reply content remains intact.

Copilot AI review requested due to automatic review settings August 1, 2026 16:06
@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4f9aa298-a1fa-410b-a59c-876408f41b4f

📥 Commits

Reviewing files that changed from the base of the PR and between e6a1a77 and 2a8e9b0.

📒 Files selected for processing (4)
  • .dockerignore
  • src/services/exporter.ts
  • src/services/thread-merger.ts
  • tests/thread-merger.test.ts

📝 Walkthrough

Walkthrough

The thread merger now receives a channel ID and uses it to identify the main export. The exporter passes this ID, tests cover missing starter messages, and .dockerignore excludes .env and /data.

Changes

Channel-aware thread merging

Layer / File(s) Summary
Main export identification
src/services/thread-merger.ts
mergeThreadsInDirectory now requires channelId and matches the main export by its trailing filename ID. Validation errors include the requested channel ID.
Exporter integration and merge validation
src/services/exporter.ts, tests/thread-merger.test.ts
The exporter passes channelId. Tests update existing calls and verify merges when thread exports omit the starter message.

Docker context exclusions

Layer / File(s) Summary
Ignored build context paths
.dockerignore
The Docker build context now excludes .env and /data in addition to node_modules.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: copilot, jipperism

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing thread export main-file detection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/thread-export-main-detection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR makes thread-export merging more deterministic by requiring the exported channel ID when merging, and using that ID to identify the “main” channel export by filename rather than by inspecting message contents. It also adds a regression test for thread exports that omit starter messages and tightens Docker build context exclusions.

Changes:

  • Update mergeThreadsInDirectory to require channelId and select the main export by matching the filename trailing ID to that channel ID.
  • Update the exporter and tests to pass channelId into mergeThreadsInDirectory.
  • Add a test covering the case where a thread export omits its starter message; update .dockerignore to exclude .env and /data.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/services/thread-merger.ts Changes main-export detection to use the provided channelId and improves the related error message.
src/services/exporter.ts Passes channelId into the updated merge function during channel export flow.
tests/thread-merger.test.ts Updates existing tests for the new function signature and adds coverage for missing-starter thread exports.
.dockerignore Excludes .env and /data from Docker build context to reduce leakage/unnecessary files.

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

@ECWireless
ECWireless merged commit 049ef04 into main Aug 1, 2026
2 checks passed
@ECWireless
ECWireless deleted the fix/thread-export-main-detection branch August 1, 2026 16:18
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.

2 participants