Repository navigation
add and reorganize new mined test-fixtures - #230
Conversation
- allows for capturing expected content BEFORE clicking the bulk-resolve button
- update regex to match .spec.ts files
…format - edge case test folders are named by the tests they're used for
- renames with edge-case directory - 02_base/cur/inc => general/conflict_0/[base/cur/inc] - 03_base/cur/inc => general/conflict_1/[base/cur/inc] - 04_base/cur/inc => general/conflict_2/[base/cur/inc]
- sets up infrastructure for if we ever create a page within `apps/website` to resolve user's conflicts online.
- `takeAllButtons`: unresolved mode collects cells via collectExpectedCellsFromUI with `includeMetadata: false`, so expected metadata is always `{}``; new fixtures have id metadata on every cell causing 51 mismatches; changed to `compareMetadata: false` since metadata preservation isn't what this variant tests
- TODO: fix collectExpectedCellsFromUI? Shouldn't it grab metadata?
- handles a few renames
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 41 minutes and 26 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTest fixtures were reorganized into namespaced directories (e.g., Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as runIntegrationTest.ts
participant FS as Filesystem (test-fixtures)
participant Runner as Test Runner / TUI
participant Playwright
participant VSCodeExt as VSCode Extension Tests
User->>CLI: run with args (--manual <folder> / --playwright ...)
CLI->>FS: scan test-fixtures for folders with base/current/incoming
FS-->>CLI: return discovered folders (sorted, assigned IDs)
CLI->>Runner: present TUI / validate selection
Runner->>FS: resolve selected folder → notebook paths
CLI->>Playwright: translate compiled .spec.js → source .ts and invoke npx playwright test
Playwright->>VSCodeExt: run integration tests using resolved fixture paths
VSCodeExt->>FS: read base/current/incoming notebooks during test setup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/web/tests/settingsMatrix.spec.ts (1)
667-926: 🧹 Nitpick | 🔵 TrivialConsider extracting the repeated
edge-cases/settings-matrixtriplet into a constant.The same triplet literal is duplicated across 8 scenarios (B1, B2a, B2b, B3a, B3b, B4a, B4b, B5, B6, B7). A module-level
const SETTINGS_MATRIX_TRIPLET = { base: 'edge-cases/settings-matrix/base.ipynb', ... }would keep future fixture renames to a single site. Not blocking.Based on learnings: "Always follow DRY principles — check for duplicated type definitions or logic across packages and consolidate them into a single source of truth."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/web/tests/settingsMatrix.spec.ts` around lines 667 - 926, The duplicated triplet object passed into conflictRepo in many tests should be extracted to a single module-level constant (e.g. SETTINGS_MATRIX_TRIPLET = { base: 'edge-cases/settings-matrix/base.ipynb', current: 'edge-cases/settings-matrix/current.ipynb', incoming: 'edge-cases/settings-matrix/incoming.ipynb' }) and then replace all inline object literals in the tests (references: the conflictRepo(...) calls inside tests like 'B1', 'B2a', 'B2b', 'B3a', 'B3b', 'B4a', 'B4b', 'B5', 'B6', 'B7') with conflictRepo(SETTINGS_MATRIX_TRIPLET); keep the constant in the same test module so scope and fixtures remain unchanged.packages/web/tests/rendermimeOutputs.spec.ts (1)
137-137:⚠️ Potential issue | 🟡 MinorStale test title references old fixture naming (
05 notebooks).The test title still says
(05 notebooks)but the fixture was renamed toedge-cases/mime-output-rendering/. Please update to match the new naming for consistency with the sibling test title (line 103) and the rest of the PR rename.🔤 Proposed fix
- test('Render text/html/png/svg/json outputs and unsupported fallback (05 notebooks)', async ({ conflictRepo, conflictSession }) => { + test('Render text/html/png/svg/json outputs and unsupported fallback (mime-output-rendering fixture)', async ({ conflictRepo, conflictSession }) => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/web/tests/rendermimeOutputs.spec.ts` at line 137, Update the test title string in the test named 'Render text/html/png/svg/json outputs and unsupported fallback (05 notebooks)' to reflect the renamed fixture; replace the parenthetical "(05 notebooks)" with "(edge-cases/mime-output-rendering/)" so the test title now reads 'Render text/html/png/svg/json outputs and unsupported fallback (edge-cases/mime-output-rendering/)' — edit the test(...) call that contains that exact title to keep naming consistent with the sibling test and PR rename.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@AGENTS.md`:
- Around line 89-92: Add a final newline character to the end of AGENTS.md so
the file ends with a trailing newline; specifically ensure the last listed
bullet line (`test-fixtures/edge-cases/*/{base,current,incoming}.ipynb`) is
followed by a newline (fixes markdownlint MD047). No other content changes
required.
- Around line 89-92: Replace the glob entry
`edge-cases/*/{base,current,incoming}.ipynb` with an explicit enumeration of the
edge-case subdirectories to match the concrete listings used for
`conflict_0/1/2`; update AGENTS.md to list each subfolder name (for example
`reordered-cells`, `syntax-highlighting`, `settings-matrix`, `demo`) and
reference their notebook patterns (e.g. `{base,current,incoming}.ipynb`) so the
"Notebook Fixtures Available" section contains a concrete inventory rather than
a glob.
In `@apps/vscode-extension/tests/runIntegrationTest.ts`:
- Line 101: The module currently calls discoverManualSandboxes() at import time
via the MANUAL_SANDBOXES constant which triggers a filesystem walk eagerly;
change this to a lazy, memoized getter so the scan only runs when needed.
Replace the top-level constant with a function like getManualSandboxes() (or a
lazy getter) that caches the result on first call and returns the cached array
on subsequent calls, and update any usage sites that reference MANUAL_SANDBOXES
to call the getter instead; this ensures discoverManualSandboxes() is invoked
only for flows that actually need manual sandboxes.
- Around line 124-143: In resolveManualSandboxFromInput, avoid unconditionally
stripping leading zeros from the raw input (normalized) which corrupts
path-style inputs; instead detect whether the input is purely numeric (e.g.,
/^\d+$/) and only then compute id = normalized.replace(/^0+/, '') || normalized
and paddedId = id.padStart(2,'0'); otherwise leave id/paddedId undefined and
only match by normalizedPath/label; update the MANUAL_SANDBOXES.find predicate
to check s.id === id || s.id === paddedId only when id/paddedId were computed,
while always checking s.folderPath === normalizedPath || s.label ===
normalizedPath to keep path resolution intact.
- Around line 60-99: The recursive walker in discoverManualSandboxes (function
walk) can follow symlinks and loop indefinitely; update walk to skip Dirent
symbolic links (use entry.isSymbolicLink()) or resolve and track real paths via
fs.realpathSync in a Set to avoid revisiting, and also ignore noisy dirs like
'.git' and 'node_modules'; implement this by checking before recursing in walk
(and bail out or return when encountering a visited real path or excluded dir)
so recursion is safe and bounded.
In `@packages/web/tests/editWarningOnBlur.spec.ts`:
- Around line 36-40: Extract the repeated fixture triplet used with conflictRepo
into a single module-level constant (e.g., CONFLICT_2_FIXTURES) and replace each
inline object passed to conflictRepo in editWarningOnBlur.spec.ts with that
constant (or a shallow copy if mutation is a concern); update the calls that
currently set base/current/incoming (the ones assigning workspacePath via
conflictRepo) to pass CONFLICT_2_FIXTURES to avoid duplication and make future
renames one edit.
In `@test-fixtures/general/conflict_0/incoming.ipynb`:
- Around line 838-842: The code opens JPEG files in text mode ('w') but calls
base64.b64decode() which returns bytes (variables image_bytes and image_labels
are used), causing a TypeError; change the file open mode for the two writes
that create 'cat_in_snow_from_tfrecords.jpg' and
'williamsburg_bridge_from_tfrecords.jpg' to binary write mode ('wb') so the
decoded bytes can be written correctly.
- Around line 151-185: The TFRecord examples call bytes('test_bytes') (invalid
in Py3) and index into a single bytes blob produced by np.random.bytes, so
feature1[i] becomes an int and breaks _bytes_feature; fix by replacing
bytes('test_bytes') with a bytes literal b'test_bytes' (or
'test_string'.encode()) and ensure any random bytes sequence is a list of
per-sample bytes objects (e.g. replace feature1 =
np.random.bytes(n_observations) with feature1 = [np.random.bytes(n_bytes) for _
in range(n_observations)] or otherwise build a list/array of bytes so that
feature1[i] yields a bytes object), so all calls to _bytes_feature(...) receive
actual bytes (affects examples around _bytes_feature usage and occurrences noted
in the comment).
In `@test-fixtures/general/conflict_10/current.ipynb`:
- Around line 140-146: Update the tf.keras.utils.get_file call that currently
uses the plain HTTP URL: change the origin string to use HTTPS
(https://storage.googleapis.com/download.tensorflow.org/data/mini_speech_commands.zip)
and add a checksum parameter (file_hash) to the get_file call to verify the
download; locate the call by the data_dir variable and the
tf.keras.utils.get_file invocation and modify its origin and add file_hash and
file_hash_algorithm arguments.
In `@test-fixtures/general/conflict_11/current.ipynb`:
- Around line 416-420: The notebook cell concatenation is missing a newline
after the plt.grid(False) string, producing "plt.grid(False)plt.show()" and a
syntax error; update the cell source so each statement is a separate line by
adding a trailing newline after the "plt.grid(False)" entry (affecting the
strings containing plt.figure(), plt.imshow(train_images[0]), plt.colorbar(),
plt.grid(False), plt.show()) so that plt.show() is on its own line.
---
Outside diff comments:
In `@packages/web/tests/rendermimeOutputs.spec.ts`:
- Line 137: Update the test title string in the test named 'Render
text/html/png/svg/json outputs and unsupported fallback (05 notebooks)' to
reflect the renamed fixture; replace the parenthetical "(05 notebooks)" with
"(edge-cases/mime-output-rendering/)" so the test title now reads 'Render
text/html/png/svg/json outputs and unsupported fallback
(edge-cases/mime-output-rendering/)' — edit the test(...) call that contains
that exact title to keep naming consistent with the sibling test and PR rename.
In `@packages/web/tests/settingsMatrix.spec.ts`:
- Around line 667-926: The duplicated triplet object passed into conflictRepo in
many tests should be extracted to a single module-level constant (e.g.
SETTINGS_MATRIX_TRIPLET = { base: 'edge-cases/settings-matrix/base.ipynb',
current: 'edge-cases/settings-matrix/current.ipynb', incoming:
'edge-cases/settings-matrix/incoming.ipynb' }) and then replace all inline
object literals in the tests (references: the conflictRepo(...) calls inside
tests like 'B1', 'B2a', 'B2b', 'B3a', 'B3b', 'B4a', 'B4b', 'B5', 'B6', 'B7')
with conflictRepo(SETTINGS_MATRIX_TRIPLET); keep the constant in the same test
module so scope and fixtures remain unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 56bbb3f1-0d66-4738-afa0-fdaa70e8aa02
⛔ Files ignored due to path filters (1)
test-fixtures/edge-cases/mime-output-rendering/logo.svgis excluded by!**/*.svg
📒 Files selected for processing (87)
AGENTS.mdapps/vscode-extension/tests/runIntegrationTest.tsapps/vscode-extension/tests/runNbdimeGuardTest.tspackages/web/tests/editWarningOnBlur.spec.tspackages/web/tests/fixtures.tspackages/web/tests/incomingNonConflictRegression.spec.tspackages/web/tests/perCellResolution.spec.tspackages/web/tests/rendermimeOutputs.spec.tspackages/web/tests/reorderUnmatch.spec.tspackages/web/tests/reorderUnmatchApplyDisk.spec.tspackages/web/tests/settingsMatrix.spec.tspackages/web/tests/syntaxHighlighting.spec.tspackages/web/tests/takeAllButtons.spec.tspackages/web/tests/undoRedoActions.spec.tspackages/web/tests/unmatchGuardNoReorder.spec.tstest-fixtures/02_Spectral_Hashing_and_OMS.ipynbtest-fixtures/02_base.ipynbtest-fixtures/02_current.ipynbtest-fixtures/02_incoming.ipynbtest-fixtures/03_base.ipynbtest-fixtures/03_current.ipynbtest-fixtures/03_incoming.ipynbtest-fixtures/04_base.ipynbtest-fixtures/04_current.ipynbtest-fixtures/04_incoming.ipynbtest-fixtures/demo/base.ipynbtest-fixtures/demo/current.ipynbtest-fixtures/demo/incoming.ipynbtest-fixtures/edge-cases/mime-output-rendering/base.ipynbtest-fixtures/edge-cases/mime-output-rendering/current.ipynbtest-fixtures/edge-cases/mime-output-rendering/incoming.ipynbtest-fixtures/edge-cases/reordered-cells/base.ipynbtest-fixtures/edge-cases/reordered-cells/current.ipynbtest-fixtures/edge-cases/reordered-cells/incoming.ipynbtest-fixtures/edge-cases/settings-matrix/base.ipynbtest-fixtures/edge-cases/settings-matrix/current.ipynbtest-fixtures/edge-cases/settings-matrix/incoming.ipynbtest-fixtures/edge-cases/single-conflict/base.ipynbtest-fixtures/edge-cases/single-conflict/current.ipynbtest-fixtures/edge-cases/single-conflict/incoming.ipynbtest-fixtures/edge-cases/syntax-highlighting/base.ipynbtest-fixtures/edge-cases/syntax-highlighting/current.ipynbtest-fixtures/edge-cases/syntax-highlighting/incoming.ipynbtest-fixtures/general/conflict_0/base.ipynbtest-fixtures/general/conflict_0/current.ipynbtest-fixtures/general/conflict_0/incoming.ipynbtest-fixtures/general/conflict_1/base.ipynbtest-fixtures/general/conflict_1/current.ipynbtest-fixtures/general/conflict_1/incoming.ipynbtest-fixtures/general/conflict_10/base.ipynbtest-fixtures/general/conflict_10/current.ipynbtest-fixtures/general/conflict_10/incoming.ipynbtest-fixtures/general/conflict_11/base.ipynbtest-fixtures/general/conflict_11/current.ipynbtest-fixtures/general/conflict_11/incoming.ipynbtest-fixtures/general/conflict_12/base.ipynbtest-fixtures/general/conflict_12/current.ipynbtest-fixtures/general/conflict_12/incoming.ipynbtest-fixtures/general/conflict_13/base.ipynbtest-fixtures/general/conflict_13/current.ipynbtest-fixtures/general/conflict_13/incoming.ipynbtest-fixtures/general/conflict_2/base.ipynbtest-fixtures/general/conflict_2/current.ipynbtest-fixtures/general/conflict_2/incoming.ipynbtest-fixtures/general/conflict_3/base.ipynbtest-fixtures/general/conflict_3/current.ipynbtest-fixtures/general/conflict_3/incoming.ipynbtest-fixtures/general/conflict_4/base.ipynbtest-fixtures/general/conflict_4/current.ipynbtest-fixtures/general/conflict_4/incoming.ipynbtest-fixtures/general/conflict_5/base.ipynbtest-fixtures/general/conflict_5/current.ipynbtest-fixtures/general/conflict_5/incoming.ipynbtest-fixtures/general/conflict_6/base.ipynbtest-fixtures/general/conflict_6/current.ipynbtest-fixtures/general/conflict_6/incoming.ipynbtest-fixtures/general/conflict_7/base.ipynbtest-fixtures/general/conflict_7/current.ipynbtest-fixtures/general/conflict_7/incoming.ipynbtest-fixtures/general/conflict_8/base.ipynbtest-fixtures/general/conflict_8/current.ipynbtest-fixtures/general/conflict_8/incoming.ipynbtest-fixtures/general/conflict_9/base.ipynbtest-fixtures/general/conflict_9/current.ipynbtest-fixtures/general/conflict_9/incoming.ipynbtest-fixtures/shared/integrationUtils.tstest-fixtures/shared/repoSetup.ts
💤 Files with no reviewable changes (7)
- test-fixtures/04_incoming.ipynb
- test-fixtures/04_current.ipynb
- test-fixtures/04_base.ipynb
- test-fixtures/02_incoming.ipynb
- test-fixtures/03_incoming.ipynb
- test-fixtures/03_base.ipynb
- test-fixtures/02_base.ipynb
- don't repeat base/cur/incoming file locations - update test description for rendermime
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@AGENTS.md`:
- Line 57: The bullet "for all `conflict_0` to `conflict_13`" in AGENTS.md is
ambiguous and not a valid fixture path; replace that prose with a concrete
fixture pattern or explicit list. Edit the line containing the literal text 'for
all `conflict_0` to `conflict_13`' and change it to a clear matcher such as a
glob-style pattern (e.g., fixtures matching conflict_{0..13}) or an explicit
comma-separated list of fixture names, and make sure the pattern is wrapped in
inline code formatting to signal it is a path/pattern.
- Around line 6-21: Add a blank line immediately after each Markdown heading
that currently lacks one (for example the "## Rules" heading and the other
headings flagged at lines 53 and 59) so the document satisfies MD022; locate the
heading strings in AGENTS.md (e.g., "## Rules" and the two other flagged heading
texts) and insert a single empty line below each heading to make the file
lint-green.
In `@apps/vscode-extension/tests/runIntegrationTest.ts`:
- Around line 178-180: The path translation of compiled test paths in
sourceSpecFiles fails on Windows because it only strips 'out/' with a
forward-slash and the comment is misleading; update the replacement to remove an
"out" prefix with either slash or backslash (e.g. use a regex like /^out[\/\\]/)
and keep the .js→.ts replacement, and change the inline comment to accurately
say it rewrites compiled out/.../*.js test paths back to their source .ts paths
so Playwright's testDir matches; this fixes arguments passed to runPlaywright
(which are built via path.join) on Windows.
- Around line 465-468: sourceChoice is already a selected sandbox folderPath
from the TUI, so calling resolveManualSandboxFromInput again is redundant and
risky; replace that call by directly finding the matching sandbox in the
previously-discovered list used to populate the chooser (e.g., the array
variable that produced the menu entries) by comparing each entry's
sandbox.folderPath to String(sourceChoice) (or by index if the chooser returns
an index), then use that matched sandbox's folderPath in the c.outro call; keep
the c.isCancel/c.cancel handling but remove resolveManualSandboxFromInput usage
to avoid double-resolution.
In `@packages/web/tests/rendermimeOutputs.spec.ts`:
- Around line 114-118: Extract the duplicated fixture triplet passed to
conflictRepo into a shared constant (e.g., MIME_OUTPUT_RENDER_TRIPLET or
CONFLICT_MIME_OUTPUT_TRIPLET) at the top of the test module, then replace both
in-test calls that assign workspacePath via conflictRepo({ base:
'edge-cases/mime-output-rendering/base.ipynb', current:
'edge-cases/mime-output-rendering/current.ipynb', incoming:
'edge-cases/mime-output-rendering/incoming.ipynb' }) with a single call using
that constant (conflictRepo(MIME_OUTPUT_RENDER_TRIPLET)); update both
occurrences in rendermimeOutputs.spec.ts so the two tests reuse the shared
constant similar to SETTINGS_MATRIX_TRIPLET and CONFLICT_2_FIXTURES.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9d546bae-db80-4a7d-bbc7-5a0c9ab53f06
📒 Files selected for processing (5)
AGENTS.mdapps/vscode-extension/tests/runIntegrationTest.tspackages/web/tests/editWarningOnBlur.spec.tspackages/web/tests/rendermimeOutputs.spec.tspackages/web/tests/settingsMatrix.spec.ts
Motivation
I fixed most of the logical errors within
resolver.tsinpackages/core, and the old02_base/cur/inc.ipynbfiles had like 1 real conflict at the end. This caused "happy path" results in lots of tests that used it. I had an idea quite a while ago (#79) that we should just mine a repo for conflicts and use that for testing.Solution
Did exactly that. Created a script to mine TensorFlow docs for conflicts, got quite a few good ones with real-world reorderings, HTML rendering, new metadata, and overall just really complex conflicts which serve as fantastic testing fixtures.
Side benefits:
generalin a manual sandbox.fixes #200
fixes #219
closes #79
Summary by CodeRabbit
Tests
Chores
Documentation