Skip to content

update: tracked-repo pull and the post-pull audit gate exist in three copies #443

Closed

Description

@runkids

Problem

"Update one tracked repo" — dirty check → pull / force pull → audit scan → ResetHard(beforeHash) on failure — exists as three pull flows and three audit gates. This is a fail-closed safety sequence, and the copies no longer behave the same.

Evidence (v0.25.0, aeaea40e)

  • cmd/skillshare/update_handlers.go — auditGateAfterPull:41, updateTrackedRepo:113, updateTrackedRepoQuick:306
  • internal/server/handler_update.go — updateTrackedRepo:302, auditGateTrackedRepo:374
  • internal/install/install_audit.go — auditGateFailClosed:247, auditTrackedRepoUpdate:299

Observed differences:

  • The server discards the dirty-check error (handler_update.go:307, isDirty, _ := git.IsDirty(repoPath)); the CLI treats it as a failure (update_handlers.go:120-126).
  • The CLI gate calls install.ApplyAcceptedFindings / RecordAcceptedFindings (update_handlers.go:20,62). internal/server has no direct call to either.
  • refreshTrackedRootSkillMetadata runs only in the CLI path.
  • The "rollback also failed, malicious content may remain" message is assembled separately in each copy.

Commits efcc3e6, d2b322e, b92938a and aafb7e7 look like the same follow-policy or branch change applied once per side (judged from commit titles only).

Proposed change

Make "update one tracked repo" a single operation in internal/install (or a new internal/update), built on auditGateFailClosed, which is the most complete gate today. It owns dirty detection, pull, audit gate, rollback and metadata refresh and returns a structured result. The CLI keeps spinner, prompt and printing; the handler converts to JSON.

Rollback paths (scan failure, threshold exceeded, reset failure) are then tested once, against a local bare repo.

Risks

  • The CLI asks whether to accept findings; the interface has to carry that decision point without growing wide.
  • updateTrackedRepo and updateTrackedRepoQuick are already two copies inside the CLI and may need merging first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architecture

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions