Skip to content

chore: rewrite v2 component history to preserve git blame#2551

Open
balzss wants to merge 182 commits into
masterfrom
rewrite-v2-blame
Open

chore: rewrite v2 component history to preserve git blame#2551
balzss wants to merge 182 commits into
masterfrom
rewrite-v2-blame

Conversation

@balzss
Copy link
Copy Markdown
Contributor

@balzss balzss commented May 11, 2026

Summary

Rewrites master's history so that git blame on v2/* component files traces back through their v1/* predecessors (and through them, to the pre-multi-version originals). Today, 211 of 479 v2 files have squashed blame because the commits that introduced them used git add rather than git mv.

The working tree at the tip of this branch is byte-identical to master — only the commit history leading up to it differs. Verified by tree-hash comparison: 1f10331faa2931ac26fc7f24dfec8cbe67bb6489 on both sides.

What changed

For each of 18 "split" commits that introduced v2 files (full list below), a synthetic predecessor commit was inserted that does a pure git mv v1/X → v2/X. The original commit's tree is unchanged. The synthetic-rename gives git's rename detection something to lock onto when running blame on v2 files; the next commit recreates v1, so v1 files lose their post-split blame but their full prior history is intact up to that point.

This is the technique from the original #2486 PR, re-applied to current master (since master has moved 160 commits and added new v2 components since #2486 was opened in March).

Split commits rewritten

Files Commit Description
301 f691f0b96e refactor(many): add multi-version support for finished packages
137 8e0f9ef7e6 refactor(many): add pr components to the refactor
37 fd7780fc7b feat(ui-color-picker): rework ColorPicker
26 4f49e3e27d feat(ui-buttons): add v2 button components
21 fb95519583 feat(many): rework Select/SimpleSelect/TimeSelect
17 0562fe2b43 feat: rework Drilldown
9 fba6b4d6a7 feat: rework AppNav
9 af97f0c0bc feat: rework Rating
9 a99d7fe70b refactor(many): fix migration bugs
8 36c02c6b3e feat: rework DataPermissionLevels and NutritionFacts
6 335cc5b00b feat: rework Mask
5 a201f69884 feat: rework ToggleDetails
5 5e7a355640 feat: rework Img
5 10f637b938 feat: rework InPlaceEdit and Editable
5 066524ff00 feat: rework Byline
4 ff5f2b3866 fix(ui-many): fix imports of the multiversion support
3 5a9405c0a1 feat: rework DateTimeInput/replace DateInput v1
1 30035d3544 chore(ui-scripts): combined svc-instui token changes

608 v1→v2 file pairs processed across the 18 commits.

Verification

Check Result
git diff rewrite-v2-blame origin/master empty (0 files)
Tree hashes match 1f10331faa… on both sides
pnpm run test:vitest 186 files, 2,181 tests pass (3 files / 46 tests skipped, same as master)
Total unique blame commits across 479 v2 files 3,661 → 5,684 (+55%)
Files with improved blame 211
Files unchanged 261 (already had good blame from earlier git mvs)
Files with reduced commit count 7 (each one is a more accurate attribution — formerly misattributed to random files via similar boilerplate, now traces to the true ancestor)

Sample improvements (before → after unique blame commits)

File master this branch
ui-buttons/Button/v2/index.tsx 2 27
ui-alerts/Alert/v2/index.tsx 2 33
ui-modal/Modal/v2/index.tsx 4 28
ui-img/Img/v2/index.tsx 2 23
ui-pagination/Pagination/v2/index.tsx 3 46
ui-select/Select/v2/index.tsx 3 55
ui-checkbox/Checkbox/v2/index.tsx 6 34

Earliest blame reached on Button/v2/index.tsx: ed73df19f78 (serikjensen, Dec 2019, packages/ui-buttons/Button/index.js).

Tradeoffs

Replaces #2486

The two non-history pieces of #2486 — test migration and the create-component-version script — have already landed independently on master. #2486 will be closed in favor of this PR once review begins.

Deployment

After review/approval:

  1. Announce merge freeze on master.
  2. Push rewrite-v2-blame to master with git push --force-with-lease origin rewrite-v2-blame:master.
  3. Each contributor: git fetch && git reset --hard origin/master on local master, then rebase any in-progress branches.
  4. (Optional) Re-tag v11.7.0v11.7.3 against rewritten SHAs if you want tags to live in the new history.

Test plan

  • git diff rewrite-v2-blame origin/master produces no output
  • git rev-parse rewrite-v2-blame^{tree} matches git rev-parse origin/master^{tree}
  • pnpm run bootstrap && pnpm run test:vitest passes
  • git blame packages/ui-buttons/src/Button/v2/index.tsx shows ≥20 unique commits and traces back to 2019 ui-buttons/Button/index.js
  • git blame packages/ui-modal/src/Modal/v2/index.tsx shows ≥20 unique commits and traces back to the original Modal/index.js

🤖 Generated with Claude Code

joyenjoyer and others added 30 commits December 17, 2025 13:03
For now it only parses V1 components. It also does not parse components that use the new structure
and there are several CSS errors
INSTUI-4789

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ustom/brand icon components and migration codemod
balzss and others added 15 commits May 7, 2026 11:34
…eplacing Chromatic

Capture full-page screenshots via cy.screenshot() in an afterEach hook,
record each test's visited URL via a cy.task for source-file linking,
diff against baselines stored on a visual-baselines branch using a new
`ui-scripts visual-diff` command, and publish an HTML report per PR to
gh-pages with a sticky PR comment linking to it.

The regression-test Next.js app now uses `output: 'export'` with
`trailingSlash: true`, serving a fully static site through http-server
— no SSR and no hydration so captures are byte-deterministic.

The report has a lightbox viewer with baseline/actual/diff mode toggle,
a draggable slider overlay, fit-to-window and 1:1 zoom, prev/next
navigation, a PR number link in the header, per-row source-file links
back to the GitHub blob URL, a debounced live search box, and
highlighted active filter buttons. The sticky PR comment includes a
collapsed <details> block with inline diff images for every changed row.

Documentation added at docs/testing/visual-regression.md.

Removes the Chromatic integration; CHROMATIC_APP_CODE secret is no
longer used. Baselines are seeded automatically by the new
visual-baselines workflow on every merge to master.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… definition so they can build their own components with InstUI
BREAKING CHANGE: `thumbVariant` prop removed from RangeInput

INSTUI-5016
…DateInput v1 with DateInput v2 in DateTimeInput

BREAKING CHANGE: renderWeekdayLabels` prop removed

`calendarIcon` is a new required prop

INSTUI-4791
…elected on calendar days, BREAKING CHANGE: add mandatory prop selectedLabel, change datePickerDialog prop to mandatory
The content wrapper changed from display:block to display:flex in the v2
button rewrite, which made textAlign:center ineffective on the shrunk
children span. Add justifyContent based on textAlign so text is centered
regardless of whether an icon is present.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
core-js was fixing really niche bugs in the code ze.g. map.getOrInsertComputed, map.getOrInsert and
an exotic Safari bug https://bugs.webkit.org/show_bug.cgi?id=309342 that is fixed in Webkit nightly.
Remove core-js because its no longer needed
Also use ESLint from the root package
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2551/

Built to branch gh-pages at 2026-05-12 13:30 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Visual regression report

No changes.

Status Count
Unchanged 32
Changed 0
New 0
Removed 0

📊 View full report

Baselines come from the visual-baselines branch. They refresh on every merge to master.

github-actions Bot pushed a commit that referenced this pull request May 11, 2026
@balzss balzss self-assigned this May 12, 2026
ToMESSKa and others added 4 commits May 12, 2026 10:28
…DateInput v1 with DateInput v2 in DateTimeInput

BREAKING CHANGE: renderWeekdayLabels` prop removed

`calendarIcon` is a new required prop

INSTUI-4791
…eader, descriptive nav button labels with target month, aria-modal on focused dialogs
BREAKING CHANGE: Removed FormFieldLabel component

Removed _content prop from DrawerLayout.Tray and DrawerLayout.Content

Removed _link prop from Link

Removed _node prop from Menu.Item

Removed _root prop from Pagination, TreeBrowser

Removed _select prop from SimpleSelect and TimeSelect

Removed _ref prop from TruncateText

Removed _element prop from View

Removed color="ai" from Heading

Removed variant="inline-small" and variant="standalone-small" from Link

Removed title prop from Tag

Removed focusRingBorderRadius prop from View

Removed hideActionsUserSeparator prop from TopNavBar.Layout

Removed handleFocusOutlineColor, handleFocusOutlineWidth, handleShadowColor from RangeInput

INSTUI-5025
@git-nandor git-nandor self-requested a review May 12, 2026 09:20
@balzss balzss requested a review from ToMESSKa May 12, 2026 10:05
@balzss balzss marked this pull request as ready for review May 12, 2026 10:05
github-actions Bot pushed a commit that referenced this pull request May 12, 2026
@balzss balzss force-pushed the rewrite-v2-blame branch from 780db8c to 273f147 Compare May 12, 2026 13:25
Copy link
Copy Markdown
Contributor

@ToMESSKa ToMESSKa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balzss I think this TopNavBar rework commit #2512 is missing from the table and TopNavBar v2 does not show the git history. Can you please look at this?

Copy link
Copy Markdown
Contributor

@git-nandor git-nandor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one split commit appears to have been missed — feat(many): rework TopNavBar (c1d18a6).

This commit introduced 33 new v2/* files (near-identical copies of their v1/* counterparts — the main index.tsx differs by only 2 lines) without a preceding synthetic rename, so all TopNavBar v2 files currently show only 1–2 unique blame commits.

This is likely not an oversight but an edge case in the detection heuristic.
In all 18 handled split commits (rework Img, rework Byline, etc.), both v1/* and v2/* files were added (A) in the same commit — they were created together from scratch. In the TopNavBar rework, v1/* files already existed and were only modified (M), while v2/* files were added (A). A heuristic looking for A+A pairs in the same commit would have missed this M+A case.

TopNavBar seems to be the only rework where the v1/ directory pre-existed; all others had v1/ and v2/ created together in the large add multi-version support commit.

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.

7 participants