Repository navigation
Commit 9d21fc3
test(utils): assert the shared lock record the identity key gives, not a pairing it never promised
The ubuntu coverage leg failed this row with "Lock is not acquired/owned by you" thrown from
the row itself, frame lockfile.js:285 reached through fileLock.test.ts:1669, and the assertion the
row had expected to fail never appeared because a throw inside finally replaces the error already
propagating. The release was the compensating failure, not the first one.
The cause is the pairing, not the product. canonicalLockKey keys on dev:ino of the nearest existing
directory and carries the leaf as the caller wrote it, so the referent a link points at never enters
the key; lockArtefactPath names the artefact by realpath of the leaf, so replacing the link target
moves the artefact name and leaves the key where it was. proper-lockfile keeps one in-process record
per key - it assigns locks[file] with no guard at lockfile.js:243 and deletes it unconditionally at
:290 - so the second arrival on the same spelling replaces the first holder record instead of taking
a second one. The row asserted two independently releasable records, which is what its comment
claimed and the design never promised.
The row now asserts what the identity key actually gives: two artefacts on one record, the third
arrival refused on the second artefact, the second release landing and the first release throwing
ENOTACQUIRED with its artefact left on a volume it can no longer name to the library. Every
artefact-level assertion is kept, because those measured true. Releases go through a wrapper so a
runner that can execute the row reports the first failure rather than the compensating one, and the
renewal the refused release never reaches is cancelled in the finally instead of firing after the row
ends against a deleted artefact.
The same pairing measured against the real library outside any link: one key, artefacts
history.json.lock then history.json.next.lock, second release clean, first release ENOTACQUIRED,
artefact still on disk, one renewal still armed. On this box the row itself cannot run - it needs a
file symlink and fs.symlinkSync returns EPERM here - so it skips and the assertions above are the
library-level reproduction, not a local pass.
Reproduced and verified locally: vitest misc leg on this file 29 passed 8 skipped, prettier --check
clean, eslint --max-warnings=0 exit 0 with no suppression entry, tsc --noEmit exit 0. No --no-verify
was used and no pre-commit or commit-msg hook exists in this checkout to run.
Co-Authored-By: Claude <[email protected]>1 parent 87bc9cf commit 9d21fc3
1 file changed
Lines changed: 54 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1145 | 1145 | | |
1146 | 1146 | | |
1147 | 1147 | | |
| 1148 | + | |
1148 | 1149 | | |
1149 | 1150 | | |
1150 | 1151 | | |
| |||
1190 | 1191 | | |
1191 | 1192 | | |
1192 | 1193 | | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
1193 | 1203 | | |
1194 | 1204 | | |
1195 | 1205 | | |
| |||
1622 | 1632 | | |
1623 | 1633 | | |
1624 | 1634 | | |
1625 | | - | |
| 1635 | + | |
1626 | 1636 | | |
1627 | 1637 | | |
1628 | 1638 | | |
| |||
1631 | 1641 | | |
1632 | 1642 | | |
1633 | 1643 | | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1634 | 1655 | | |
1635 | 1656 | | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1636 | 1669 | | |
1637 | 1670 | | |
1638 | 1671 | | |
| |||
1644 | 1677 | | |
1645 | 1678 | | |
1646 | 1679 | | |
1647 | | - | |
1648 | | - | |
1649 | | - | |
1650 | | - | |
| 1680 | + | |
| 1681 | + | |
1651 | 1682 | | |
1652 | 1683 | | |
1653 | 1684 | | |
1654 | | - | |
1655 | | - | |
| 1685 | + | |
| 1686 | + | |
1656 | 1687 | | |
1657 | | - | |
| 1688 | + | |
| 1689 | + | |
1658 | 1690 | | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
1659 | 1698 | | |
1660 | 1699 | | |
1661 | | - | |
1662 | 1700 | | |
1663 | | - | |
1664 | | - | |
1665 | | - | |
1666 | 1701 | | |
1667 | 1702 | | |
1668 | 1703 | | |
1669 | | - | |
| 1704 | + | |
1670 | 1705 | | |
1671 | 1706 | | |
1672 | | - | |
| 1707 | + | |
1673 | 1708 | | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
1674 | 1714 | | |
1675 | 1715 | | |
1676 | 1716 | | |
| |||
0 commit comments