Skip to content

Add regression assertion for notebook cell.source format consistency#175

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-source-format-check
Draft

Add regression assertion for notebook cell.source format consistency#175
Copilot wants to merge 2 commits intomainfrom
copilot/add-source-format-check

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

The regression suite compared cell content via normalized strings, which could hide mixed cell.source representations (string vs string[]) in resolved notebooks. This PR adds a targeted post-resolution check to ensure source representation is uniform across all cells.

  • What changed

    • Added assertConsistentCellSourceFormat(notebook) in src/tests/testHelpers.ts.
    • The helper infers expected source shape from the first cell and fails if any subsequent cell differs.
    • Integrated this assertion into src/tests/incomingNonConflictRegression.test.ts immediately after notebook-structure validation.
  • Why this matters

    • Preserves visibility into source-shape inconsistencies that content-only normalization can mask.
    • Strengthens regression coverage for notebook-tool compatibility expectations around cell.source formatting.
  • Example

    // src/tests/incomingNonConflictRegression.test.ts
    const resolvedNotebook = await applyResolutionAndReadNotebook(page, session.conflictFile);
    validateNotebookStructure(resolvedNotebook);
    assertConsistentCellSourceFormat(resolvedNotebook);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node out/tests/runIntegrationTest.js --test regression_incoming_nonconflict (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Test] Verify source format consistency (string vs array)</issue_title>
<issue_description>## Context
From PR #34 review discussion: #34

The integration test normalizes all cell sources to strings for comparison, which could mask format inconsistencies where some cells have source as a string and others as an array.

Problem

  • Resolved conflict cells use: source: resolvedContent.split(/(?<=\n)/) (always array)
  • Identical cells use: cellToUse = currentCell || incomingCell || baseCell (keeps original format)
  • Test's getCellSource() normalizes both, hiding potential issues

Impact

Low priority - doesn't affect core functionality but could cause issues with some notebook tools that expect consistent formatting.

Suggested Enhancement

Add a check after writing the notebook to verify all cells use the same source format (all strings or all arrays).

Backlinks:

Comments on the Issue (you are @copilot in this section)

@Avni2000 @coderabbitai is this still an issue?

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…nario

Co-authored-by: Avni2000 <77120766+Avni2000@users.noreply.github.com>
Copilot AI changed the title [WIP] Add check for source format consistency in cells Add regression assertion for notebook cell.source format consistency Mar 20, 2026
Copilot AI requested a review from Avni2000 March 20, 2026 01:44
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.

[Test] Verify source format consistency (string vs array)

2 participants