Skip to content

Give the hook a path that outlives the release it was installed from - #696

Merged
MongLong0214 merged 2 commits into
mainfrom
fix-693-current-link
Aug 16, 2026
Merged

Give the hook a path that outlives the release it was installed from#696
MongLong0214 merged 2 commits into
mainfrom
fix-693-current-link

Conversation

@MongLong0214

Copy link
Copy Markdown
Owner

Closes #693.

commitlore.bin recorded <data-root>/v<version>/dist/commitlore.mjs, so an
upgrade left every repository validating commits with the build it was installed
from. Measured on the first machine to upgrade:

commitlore            → v0.8.2      (CLI: v1.0.1)
agent-control-plane   → v0.8.2
stock-ai-newsletter   → v0.8.0

This repository was validating its own commits with v0.8.2 while v1.0.0 and
v1.0.1 were released from it.
doctor reported it on every run and stopped
nothing.

What changed

install.sh maintains <data-root>/current beside the versioned checkouts, and
hooks record that. It stays an absolute path to a .mjs, so the recorded
interpreter launches it and the hook remains independent of PATH — the two
properties the versioned path was chosen for.

The bin wrapper cannot serve here, and that is measured rather than assumed:
#694 recorded it and hooks failed under the restricted PATH a hook actually
runs in, because a shell script cannot be launched with a recorded interpreter.

Two deliberate limits

  • Only when it resolves to the running bundle. A current belonging to
    another install would send the hook to code this one never verified — worse
    than a version pin.
  • A host without symlinks still installs. Hooks there keep recording the
    versioned path, and commitlore hooks install after an upgrade remains the
    repair doctor already names. Not fatal, and logged.

The path is derived from the layout, not from the directory being called
commitlore — the first attempt matched that name and failed wherever the data
root is called something else.

Scope

Changes what is recorded from now on. Existing pins still need commitlore hooks install re-run; #695 documents that.

Verified by removing the derivation: the current case fails. 72 tests passing
across hooks and the new file. Canonical artifact 997d93d4.

commitlore.bin recorded <data-root>/v<version>/dist/commitlore.mjs, so an
upgrade left every repository validating commits with the build it was installed
from. Measured on the first machine to upgrade: three repositories pinned to
0.8.2 and 0.8.0 while the CLI was 1.0.1 -- this repository among them, through
two releases. doctor said so on every run and stopped nothing.

install.sh now maintains <data-root>/current beside the versioned checkouts, and
hooks record that. It stays an absolute path to a .mjs, so the recorded
interpreter launches it and the hook remains independent of PATH -- the two
properties the versioned path was chosen for.

The bin wrapper cannot serve here and that is not a guess: #694 recorded it and
hooks failed under the restricted PATH a hook actually runs in, because a shell
script cannot be launched with a recorded interpreter.

Two things deliberately narrow. The link is only recorded when it resolves to
the running bundle -- a current belonging to another install would send the hook
to code this one never verified, which is worse than a version pin. And a host
where the symlink cannot be made still installs: hooks there keep recording the
versioned path, and `commitlore hooks install` after an upgrade remains the
repair doctor already names.

The path is derived from the layout rather than from the directory being called
commitlore, after the first attempt matched on that name and failed anywhere the
data root is named otherwise.

Existing pins still need `commitlore hooks install` re-run. This changes what is
recorded from now on.

Limit: a hook records a path that does not name a release
Blast: system
Undo: easy
Certainty: firm
Provenance: authored
Record-Id: r-693curr
@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown

CommitLore — record lint

Trailers: clean — 2 commits in origin/main..c8149e7c506e8f64f075565938a6befc6c853f78
Active constraints: not read — commitlore: git log --follow accepts exactly one pathspec, so renames are not followed for 7 paths; query one path at a time to follow its rename chain (7 changed paths)

Trailer violations fail this check. Active constraints are informational — they are what the repository already decided, not a verdict on this PR.

The test asserting a foreign current is refused passed for the wrong reason: the
fixture pointed current at a path with no bundle, so realpathSync threw and the
fallback happened because the link was broken. The identity comparison never
ran, and removing it left the test green.

The other installation is now a working one. Only the comparison can reject it.

Two mutations, two different failures:
  removing the derivation      -> the version-free case fails
  removing the identity check  -> the foreign-current case fails

Before this, one mutation covered both and the second layer was unpinned. Caught
in review by asking which mutation each assertion answers -- a question the
passing suite could not answer for itself.

Limit: a rejection test names what does the rejecting
Blast: local
Undo: easy
Certainty: firm
Provenance: authored
Record-Id: r-693mut2
@MongLong0214
MongLong0214 merged commit 14909c3 into main Aug 16, 2026
12 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.

The hook records a version-pinned path, so an upgrade leaves it behind

1 participant