Slack view: delete a day file when its messages move to another day

Open Beginner friendly
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
markdown, python

Research direction

Start with src/diffdata/discover/slack_export.py and the existing tests for Slack export; the issue says this file is also changing in the planned second PR for #14, so check whether that has merged before starting. Add a synthetic fixture for a message moving days, then verify a build deletes its now-empty day file while preserving other files and other channels' folders.

Written by the indexing model from the issue text.

Description

lane:discover
Lane

discover

Requirement IDs

DIS-1

What and why

A known limit from PR #16, split out of #14's second PR by the plan agreed on #14.

The problem:

  • build rewrites the Slack view, one markdown file per channel per UTC day (slack/export/<channel>/<date>.md), from the store.
  • It writes the days that have messages, but it never deletes a day file that no longer has any.
  • That can happen when a message moves to another day. For example, a reply that was also sent to the channel shows up first as a standalone post on its own day. A later thread read puts it under its parent post, on the parent's day.
  • The old day file is then left behind, still showing the message as a standalone post.

How bad it is: rare, and nothing is lost: the store has everything. But the view shows a message twice, once in the wrong place.

Suggested fix: after writing a channel's day files, delete any *.md file in that channel's export folder whose day has no messages any more. These are our own generated copies, rebuilt from the store on every build, so deleting them is allowed. Never touch anything outside slack/export/<channel>/.

Done when
  • A day file whose messages all moved to another day is deleted on the next build, with a test
  • Other files in the folder, and other channels' folders, are left alone
  • Synthetic fixtures only
Notes

Small and self-contained, about 15 lines plus a test. Best done after #14's second PR merges, because both change src/diffdata/discover/slack_export.py.

Dominant language
Python
Stars
0
Forks
0
Avg merge
5d 16h
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SPARDiffData/differential-data-collection

All issues in SPARDiffData/differential-data-collection

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.