The upstream diff (spike S12)
pnpm upstream:diff runs scripts/upstream-diff.mjs.
Context
Lattice ports @tanstack/table-core 9.3.1 and @tanstack/virtual-core 3.19.16. Lattice does
not depend on these packages, so upstream fixes do not come by themselves. The maintainer must
see what changed upstream in each ported file, and port only the fixes that Lattice needs.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
pnpm upstream:diff runs scripts/upstream-diff.mjs.
- It reads the pin of each package from the root
PORT_MAP.md(the first word of the Version cell). - It reads the map of each package:
packages/core/PORT_MAP.mdandpackages/virtual/PORT_MAP.md. Each row is one ported file:Lattice path | Upstream path | Version | Changes in the port. - It finds the newest stable tag
@tanstack/table-core@Xand@tanstack/virtual-core@Xwithgit ls-remote. It does not use prerelease tags.--project table --to 9.4.0gives the target for one upstream. The two upstreams have different version lines, so--toneeds--project. - It fetches the pinned tags and the target tag into
.upstream/tableand.upstream/virtual. The fetch is shallow (--depth=1) and has no blobs (--filter=blob:none). Git gets a blob only when a diff needs it. - For each row, it prints
git diff <row version> <target> -- <upstream path>, or "unchanged". - It lists the files that upstream added in the package folder between the pin and the target, and that the map does not have.
The script never changes HEAD or the work tree of .upstream/*. The port reads the pinned
source there.
The Upstream path format
Write the path from the root of the upstream repo, for example
packages/table-core/src/core/table/constructTable.ts. A path without the package folder
(src/core/table/constructTable.ts) also works: the script adds the folder. The Version cell
is the upstream version of the file at the time of the port, as a plain version (9.3.1).
Consequences
- The tests use no network. They make a git repo with tags in a temp folder and fetch from it
with a
file://URL. - After a fix is ported, the maintainer changes the Version cell of the row. The next diff then starts from the new version.
- The script shows diffs only. A person decides what to port.
Confirmation
Not recorded in the original ADR.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0009-upstream-diff.md at commit 4c77ac4. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0009-upstream-diff.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-01 | Joe Gaudet | Status in the Markdown file: accepted, 2026-12-01. |
| 2026-12-03 | Joe Gaudet | Commit 7ce4af2: Lattice 1.0 (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0009-upstream-diff.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.