Skip to content

leave lockfiles out of line and file counts - #157

Merged
iamnotstatic merged 1 commit into
mainfrom
iamnotstatic/skip-lockfiles
Nov 12, 2026
Merged

iamnotstatic merged 1 commit into
mainfrom
iamnotstatic/skip-lockfiles

Conversation

@iamnotstatic

Copy link
Copy Markdown
Owner

Raised publicly on X: a regenerated lockfile counted toward the 50-line ship bar, so a single npm install that rewrote package-lock.json could earn a ship on its own.

Change: parseNumstat in src/git.ts skips well-known lockfiles by basename: package-lock.json, npm-shrinkwrap.json, yarn.lock, pnpm-lock.yaml, bun.lock(b), deno.lock, Cargo.lock, Gemfile.lock, poetry.lock, Pipfile.lock, uv.lock, pdm.lock, composer.lock, go.sum, mix.lock, pubspec.lock, Podfile.lock, Package.resolved, packages.lock.json, flake.lock, gradle.lockfile. They no longer count toward lines or files, for committed work, uncommitted work, or the per-commit facts sent to the server. A rename onto a lockfile path is caught (git reports old => new), and a file merely named like one (lockfile.ts, my-package-lock.json) still counts. The commit itself still counts as a commit.

What moves: totals go down for anyone whose commits carry lockfile churn, so some sessions that shipped before will not. That is the point, but it is a counting change, and it only reaches people who upgrade.

Mixed versions, checked against the code:

  • A session open across the upgrade sees its totals dip. trackShipEvents (CLI) and clampBaseline (server) both clamp the event baseline down, so later ships are measured in the new units and nothing is paid twice.
  • A commit already on record from an older CLI is matched by commit id (commit_credits primary key), so its new smaller line counts don't make it new work.
  • One gap: a commit rebased after upgrading gets a new id and a different work key, so it could be paid once more. It needs a lockfile in the commit, an upgrade mid-work, and a rebase.

Tests: three new cases in test/git-stats.test.mjs. The two lockfile ones fail without the fix (checked by disabling the skip and rebuilding), and the third guards against over-matching. Full suite 231/231, server typecheck clean.

README now says lockfiles are left out. The website copy is unchanged, because older CLIs still count them.

Needs a CLI release to reach anyone.

A regenerated package-lock.json, yarn.lock or Cargo.lock can add thousands
of lines, so one dependency bump cleared the 50-line ship bar on its own.
parseNumstat now skips well-known lockfiles by basename (including the new
path of a rename), for committed work, uncommitted work and per-commit
facts alike. A file merely named like one, such as lockfile.ts, still
counts.

Totals drop for anyone whose commits carried lockfile churn. A session
open across the upgrade sees its totals dip, and both the CLI and the
server already clamp the event baseline down, so later ships are measured
in the new units without paying anything twice. Commit facts for a commit
already on record match by commit id; only a commit rebased after the
upgrade would file as new work.
@iamnotstatic
iamnotstatic merged commit 0f61a82 into main Nov 12, 2026
3 checks passed
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.

1 participant