Skip to content

refactor: drop three write-only maps - #10607

Merged
johannesjo merged 2 commits into
super-productivity:masterfrom
irontaek:refactor/drop-write-only-maps
Oct 9, 2026
Merged

johannesjo merged 2 commits into
super-productivity:masterfrom
irontaek:refactor/drop-write-only-maps

Conversation

@irontaek

@irontaek irontaek commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Three maps are populated but never read:

  • src/app/op-log/validation/is-related-model-data-valid.ts — validateTasksToProjectsAndTags does projectTaskMap.set(project.id, projectTaskSet) for every project; nothing reads projectTaskMap (the validation uses projectTaskSet directly). Never read since the file arrived with the pfapi → op-log move.
  • packages/plugin-dev/sync-md/.../generate-task-operations.ts — mdById is filled next to mdByTitle, but only mdByTitle, spById, spByTitle and duplicateIds are used afterwards.
  • packages/plugin-dev/doc-mode/src/ui/editor.ts — lastWrittenTitles is set after a successful title write and cleared on context switch, but refreshTaskRef never consults it; the echo guard that actually runs is pendingTitleWrites. It has been this way since the plugin was added in 1c10ff6.

Solution

Remove the three maps and the lines that fill them. For lastWrittenTitles the doc comment and the .then comment described it as the echo check in refreshTaskRef, which it never was, so those sentences go with it. No behavior change.

If you'd rather wire lastWrittenTitles into refreshTaskRef (skip the refresh when task.title === lastWrittenTitles.get(taskId)) instead of removing it, I'm happy to switch this PR to that.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation
  • Other (please describe)

Checklist

  • I have included relevant changes to the documentation/wiki.
  • I have run npm run checkFile on changed .ts/.scss files — ran prettier 3.8 --check on the three files; full root install not done
  • I have added tests for my changes (if applicable)
  • Existing tests still pass — sync-md jest src/background/sync: 4 suites, 37 tests pass; tsc --noEmit error counts in doc-mode/sync-md are unchanged from master (pre-existing, from missing built plugin-api types)
  • My commit messages follow the Angular format (type(scope): description)

https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq

- op-log validation: projectTaskMap is set per project and never read
- sync-md: mdById is filled and never read (mdByTitle and the id set are)
- doc-mode: lastWrittenTitles is set/cleared but refreshTaskRef never
  consults it; the echo guard is pendingTitleWrites. Comments that
  described the map as the echo check are dropped with it.

Claude-Session: https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Hello there irontaek! 👋

Thank you and congrats 🎉 for opening your first PR on this project! ✨ 💖

We will try to review it soon!

@johannesjo

Copy link
Copy Markdown
Collaborator

🔍 Reviewed – no blocking issues found at ddb692a.

Thanks for the PR! This removes three write-only maps (projectTaskMap, mdById, lastWrittenTitles); I confirmed on master that none of them is read anywhere, so the change is behavior-neutral and the comment cleanup in editor.ts matches what the code actually does.

Nits

  • src/app/op-log/validation/is-related-model-data-valid.ts:270 – // Create entry for this project described the removed projectTaskMap.set(...); with the map gone it no longer matches the line below (it just builds the set of task ids to validate). Reword to something like // Collect the project's task ids (active + backlog) or drop it.

Automated review pass (Claude Code). Anything unclear or wrong – say so and I'll take a look.

@irontaek

irontaek commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the review — reworded the comment to // Collect the project's task ids (active + backlog) in 32c09a3.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Preview Deployment

Status URL
Deployed https://d03dc79c.super-productivity-preview.pages.dev

Branch: refactor/drop-write-only-maps
Commit: 32c09a3


Deployed with Cloudflare Pages

@johannesjo

Copy link
Copy Markdown
Collaborator

Thank you very much! <3

@johannesjo
johannesjo merged commit 1701dbc into super-productivity:master Oct 9, 2026
32 checks passed
johannesjo added a commit that referenced this pull request Oct 9, 2026
…nt-desktop-backup-fail-b9ebaa

* origin/master: (23 commits)
  fix(tasks): save pending note edit before switching task (#10623)
  refactor(sync): split conflict-resolution service by responsibility (#10621)
  test(electron): cover local REST API guards and backup restore #8735 (#10604)
  fix(task-repeat-cfg): skip deleted instances in the next tooltip #10516 (#10603)
  refactor: drop three write-only maps (#10607)
  fix(notes): insert checklist items reliably on repeated toolbar clicks (#10566)
  feat(search): include projects and tags as search results (#10223) (#10606)
  Revert "ci: cancel superseded PR workflow runs"
  ci: cancel superseded PR workflow runs
  ci(e2e-sync): skip sync suites on draft PRs
  docs(sync-server): address review of env and sync-nav follow-ups
  docs(sync-server): align env.example, WebDAV caveat and sync nav
  docs(sync-server): fix SMTP/migration claims and review findings
  docs(sync-server): stop recommending master-sha pins in config comments
  docs(sync-server): clarify supported self-hosting path
  docs(agents): clarify E2E_WORKERS limits in e2e agent guide
  docs(agents): guide agent sessions on shared-machine e2e runs
  test(e2e): allow capping local workers via E2E_WORKERS
  fix(notes): keep hover controls clear of note text in the live editor (#10544) (#10605)
  feat(android): native deadline reminders up to 1 week before (#10619)
  ...

# Conflicts:
#	electron/backup.test.cjs
johannesjo added a commit that referenced this pull request Oct 9, 2026
…ract-investigation-c4c2b9

* origin/master: (36 commits)
  fix(tasks): save pending note edit before switching task (#10623)
  refactor(sync): split conflict-resolution service by responsibility (#10621)
  test(electron): cover local REST API guards and backup restore #8735 (#10604)
  fix(task-repeat-cfg): skip deleted instances in the next tooltip #10516 (#10603)
  refactor: drop three write-only maps (#10607)
  fix(notes): insert checklist items reliably on repeated toolbar clicks (#10566)
  feat(search): include projects and tags as search results (#10223) (#10606)
  Revert "ci: cancel superseded PR workflow runs"
  ci: cancel superseded PR workflow runs
  ci(e2e-sync): skip sync suites on draft PRs
  docs(sync-server): address review of env and sync-nav follow-ups
  docs(sync-server): align env.example, WebDAV caveat and sync nav
  docs(sync-server): fix SMTP/migration claims and review findings
  docs(sync-server): stop recommending master-sha pins in config comments
  docs(sync-server): clarify supported self-hosting path
  docs(agents): clarify E2E_WORKERS limits in e2e agent guide
  docs(agents): guide agent sessions on shared-machine e2e runs
  test(e2e): allow capping local workers via E2E_WORKERS
  fix(notes): keep hover controls clear of note text in the live editor (#10544) (#10605)
  feat(android): native deadline reminders up to 1 week before (#10619)
  ...

# Conflicts:
#	e2e/tests/task-dragdrop/task-multi-drag.spec.ts
#	packages/super-sync-server/README.md
#	packages/super-sync-server/docker-compose.yml
#	packages/super-sync-server/env.example
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