Skip to content

hotfix/code_update_after_fix: The code is properly updated after fixing the code#31

Open
Maths-A wants to merge 1 commit intodevelopfrom
hotfix/code_update_after_fix
Open

hotfix/code_update_after_fix: The code is properly updated after fixing the code#31
Maths-A wants to merge 1 commit intodevelopfrom
hotfix/code_update_after_fix

Conversation

@Maths-A
Copy link
Copy Markdown
Collaborator

@Maths-A Maths-A commented Apr 15, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds client-side normalization and a shared helper to consistently apply AI-generated/edited code updates to notebook cells in the Plainbook web UI.

Changes:

  • Introduces normalizeSource() to coerce cell source content into a consistent string format.
  • Adds applyGeneratedCode() to centralize updating a cell’s source, clearing outputs, and clearing validation state.
  • Uses these helpers across code generation, test-code generation, and code-save flows to keep client state consistent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plainbook/js/nb.js
} else {
test.cells[role].source = r.code;
test.cells[role].source = normalizeSource(r.code);
test.cells[role].outputs = [];
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

When regenerating unit test sub-cell code for roles other than target, the code and outputs are replaced but any existing metadata.validation for that sub-cell is left intact. This can show stale validation results for code that no longer matches the cell content. Consider clearing test.cells[role].metadata.validation (and any related timestamp field, if present) at the same time you reset source/outputs (mirroring applyGeneratedCode).

Suggested change
test.cells[role].outputs = [];
test.cells[role].outputs = [];
if (test.cells[role].metadata) {
delete test.cells[role].metadata.validation;
delete test.cells[role].metadata.validation_timestamp;
delete test.cells[role].metadata.validationTimestamp;
}

Copilot uses AI. Check for mistakes.
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.

2 participants