Commit 5b1b1aa
authored
* fix: fingerprint the built daemon's real import graph (#1545)
The static-import regex in computeDaemonCodeSignature required whitespace
around `from` and after `import`/`export`. The built daemon entry is a
minified bundle (tsdown/rolldown `minify: true`), whose real import
statements have zero whitespace (e.g. `import{o as e}from"../foo.js"`), so
the regex never matched any dependency edge and the graph walk silently
degraded to fingerprinting only the entry file (`graph:1`) instead of its
true ~50-file runtime graph.
That defeats the safety net the signature exists for: a daemon started from
one build can look identical to a client running a materially different
build as long as the entry file's own size/mtime happen to coincide, and the
"code-signature mismatch" takeover this check drives was one of the
mechanisms observed in #1545's worktree dev-daemon multiplication.
* refactor: fingerprint import specifiers by shape, not by import grammar
Replaces the two keyword-anchored regexes (one for static import/export/from
clauses, one for dynamic import()) with a single pattern that matches any
quoted, relative-path-shaped string literal. The prior approach had to track
the exact whitespace/keyword shape bundlers emit around a specifier, which is
exactly what broke for minified output in the immediately preceding commit —
formatted source, minified builds, static imports, re-exports, and dynamic
imports all put the same thing in the same place (a relative string literal),
so matching on that directly is both simpler and immune to future formatting
differences. A same-shaped string that isn't really an import is safe to
over-match: it just fails to resolve to a file and gets dropped.
Verified the file count is unchanged against this repo's real build (dist:
graph:50, src: graph:741, both identical to the keyword-anchored fix).
1 parent b59b4e5 commit 5b1b1aa
2 files changed
Lines changed: 84 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 67 | + | |
65 | 68 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1776 | 1776 | | |
1777 | 1777 | | |
1778 | 1778 | | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
1779 | 1847 | | |
1780 | 1848 | | |
1781 | 1849 | | |
| |||
0 commit comments