Skip to content

skillfollow: efficiency follow-ups (merge-sync canonicalize, batched git checks, repeated snapshots) #406

Closed as not planned

Description

@runkids

Summary

Efficiency findings from the /simplify review of PR #390 (ai_docs/reports/274-simplify.md). The in-PR fixes covered the early Follow() exit, the dashboard update stream, and the walker's root lookup. These remain.

Items

  1. Merge sync canonicalizes each link's parent directory per link (internal/sync/sync.go syncMerge → sameSkillLink → skillLinkTarget, internal/sync/skillfollow.go). Every user pays this, with or without .skillfollow: roughly skills × targets × path depth lstat calls per sync, plus a discarded ResolveLinkTarget result (one extra Readlink per link). Canonicalize each target path once per followScope and reuse the resolved link.
  2. FollowedLinksStaged / CheckFollowedLinks run git ls-files and git check-ignore once per declared link (internal/git/followed_links.go; same pattern in cmd/skillshare/doctor.go, follow_handlers.go, source_mutation.go). One ls-files -z -- <paths> plus one check-ignore --stdin -z per operation would do.
  3. Commit and push check followed links twice: the dashboard handler_git.go paths and CLI commit.go + push.go each build two snapshots and run CheckFollowedLinks twice because StageAll re-runs it. Four git subprocesses per link where two suffice.
  4. SameSkillLink / OwnsSourceLink build a followScope per skill per target (handler_diff_stream.go, CheckStatusMergeWithOptions), each canonicalizing the source again. Build one scope per target; use set.SourceRoot().
  5. Follow() reads every followed target directory in full only to prove readability (follow.go around the ReadDir on the resolved target); discovery reads it again. Open + ReadDir(1) or leaving it to markMissing is enough.
  6. Repeated snapshots: hub.go project mode builds configuredSkillFollowSet and overwrites it; init.go builds three; toggle, handlePatchSkillSource, and handleInstall build two or three per request. Thread the request/command snapshot.
  7. FollowedUpdate.CheckClean runs git status -uall in both Prepare and Pull; possibly intentional TOCTOU protection, decide and document.

References

  • ai_docs/reports/274-simplify.md "Follow-ups"

Activity

  1. runkids commented on Oct 5, 2026

    @runkids
    OwnerAuthor

    Closed with #390. The .skillfollow implementation is not being merged, so this follow-up no longer applies. If the need resurfaces against a new implementation, it will be filed fresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions