Skip to content

42 amend calls in api and mcp and cli#78

Closed
eviltester wants to merge 9 commits into
masterfrom
42-amend-calls-in-api-and-mcp-and-cli
Closed

42 amend calls in api and mcp and cli#78
eviltester wants to merge 9 commits into
masterfrom
42-amend-calls-in-api-and-mcp-and-cli

Conversation

@eviltester

@eviltester eviltester commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Tests
    • Improved browser tests and helpers to assert top active column values (first N active rows), wait for grid stability after sort/filter actions, and enhanced clear-filters behavior with expected-row checks, retries, and diagnostics — boosting test stability and reliability.
  • Documentation
    • Published blog post and updated REST API, CLI, and MCP docs with the Import + Amend flow, examples, and updated defaults/behavior notes.

Review Change Stack

Copilot AI review requested due to automatic review settings May 9, 2026 23:14
@qa-tech-integration

Copy link
Copy Markdown

👀 QA.tech will run a exploratory tests to review this PR as soon as a deployment is available for this PR. Alternatively, you can comment @qa.tech to manually trigger a review.

Learn more about configuring preview deployments.

What happens next

  1. ⏳ Waiting for your preview deployment or a comment mentioning @qa.tech
  2. 🔍 Running full end-to-end tests to validate your changes
  3. 📝 Delivering detailed results and actionable feedback

🤖 AI end-to-end testing powered by QA.tech
For organization eviltester project Web app (iK6q). You can customize integration settings for this project.
💡 Comment @qa.tech to re-run testing. Add instructions for a focused review, e.g. @qa.tech test the checkout flow.

@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds top‑N visible/active column text helpers and a grid-settle poller to GridRendererComponent, wires renderer into GridHeader/GridEditor (extending clearFilters), updates Playwright tests to assert top‑N active values, and publishes amend docs plus a blog post for REST/CLI/MCP.

Changes

Grid Renderer Top Helpers & Test Updates

Layer / File(s) Summary
Grid Renderer Helpers
apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js
Add getTopVisibleColumnTextsByName, getTopActiveColumnTextsByName, getActiveRowCount, getActiveColumnTextsByName, getActiveTableSnapshot, and waitForGridSettle to return top‑N texts, counts, snapshots, and poll for settle.
Header & Editor integration
apps/web/src/tests/browser/abstractions/components/grid-header.component.js, apps/web/src/tests/browser/abstractions/components/grid-editor.component.js
Pass renderer into GridHeaderComponent; make sortAsc/sortDesc wait for waitForGridSettle; update GridEditor constructor usage and extend clearFilters({ expectedActiveRowCount } = {}) with retries and diagnostics.
Test Assertion Updates
apps/web/src/tests/browser/abstraction-smoke-tests/grid-header-controls.spec.js, apps/web/src/tests/browser/app-coverage/filtering-sorting/filtering-sorting.spec.js, apps/web/src/tests/browser/planned-functional/filtering-sorting/column-sorting.spec.js, apps/web/src/tests/browser/planned-functional/grid-operations/clear-sort-before-add-rows-below.spec.js, apps/web/src/tests/browser/app-coverage/helpers/test-helpers.js
Replace getColumnTextsByName(...).slice(0,N) with getTopActiveColumnTextsByName(columnName, N) and wait for grid settle after seeding rows.

Amend Feature Documentation Across Interfaces

Layer / File(s) Summary
Blog Post Overview
docs-src/blog/2026-05-10-import-and-amend-across-interfaces.md
New blog post describing the "Import + Amend via Schema" flow across REST API, CLI, and MCP with links to interface docs.
REST API Documentation
docs-src/docs/070-interfaces-and-deployment/030-rest-api.md
Add note that inputFormat is normalized (trim/lowercase), include an amend example payload, and clarify stream is ignored while responseFormat: "all" returns the full amended dataset.
MCP Documentation
docs-src/docs/070-interfaces-and-deployment/040-mcp.md
Add amend_data_from_spec behavior section describing required arguments, rowCount default/limits, full-dataset return, and example tools/call payload.
CLI Documentation
docs-src/docs/070-interfaces-and-deployment/050-cli-node-and-bun.md
Document --numberOfLines defaulting to all imported rows and truncation semantics; add three CLI examples demonstrating CSV↔DSV/JSON conversions and partial-row amendment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped through grids at break of day,

I fetched the top rows so assertions stay,
I taught the header to wait and settle true,
I seeded docs and a blog for amend‑through,
Carrots for CI — the tests pass anew.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'amend calls in api and mcp and cli' but the changeset includes significant unrelated test refactoring for grid renderer and sorting assertions. Update the title to reflect all major changes, such as: 'Add amend calls to API/MCP/CLI and refactor grid renderer test utilities' or split into multiple focused PRs.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 42-amend-calls-in-api-and-mcp-and-cli

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
docs-src/docs/070-interfaces-and-deployment/050-cli-node-and-bun.md (1)

71-72: ⚡ Quick win

Consider rewording for better readability.

The documentation is clear and accurate, but the repetitive sentence structure could be improved for better flow.

✨ Suggested rewording to reduce repetition
-- For `amend`, if `-n/--numberOfLines` is omitted, all imported rows are amended.
-- For `amend`, if `-n/--numberOfLines` is smaller than imported rows, only the first `N` rows are amended and full output is still returned.
+- For `amend`, `-n/--numberOfLines` defaults to all imported rows when omitted. If provided and smaller than the imported count, only the first `N` rows are amended while the full output is still returned.

As per coding guidelines: Static analysis tool LanguageTool flagged repetitive sentence beginnings with "For".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs-src/docs/070-interfaces-and-deployment/050-cli-node-and-bun.md` around
lines 71 - 72, The two bullets for the `amend` flag start repetitively with "For
`amend`"; reword them to improve flow by combining related behavior and varying
sentence starts: e.g., state default behavior when `-n/--numberOfLines` is
omitted (all imported rows are amended) and then describe the truncated behavior
when `-n/--numberOfLines` is smaller than the number of imported rows (only the
first N rows are amended but full output is returned), making sure to reference
`amend` and `-n/--numberOfLines` in the same concise sentences to avoid
repetition.
docs-src/blog/2026-05-10-import-and-amend-across-interfaces.md (1)

37-41: ⚡ Quick win

Consider rewording for variety.

The content is accurate and valuable, but the repetitive sentence structure could be improved for better readability.

✨ Suggested rewording to reduce repetition
 ## Why This Matters
 
-- You can automate the same amend workflow previously available in UI.
-- You can update existing datasets without rebuilding them from scratch.
-- You can keep the same schema-driven logic across UI, REST, CLI, and MCP.
+- Automates the same amend workflow previously available in UI.
+- Updates existing datasets without rebuilding them from scratch.
+- Keeps the same schema-driven logic across UI, REST, CLI, and MCP.

As per coding guidelines: Static analysis tool LanguageTool flagged repetitive sentence beginnings with "You can".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs-src/blog/2026-05-10-import-and-amend-across-interfaces.md` around lines
37 - 41, The three bullets under the "## Why This Matters" section use
repetitive sentence starts ("You can"); edit the three list items to vary
phrasing and improve flow by using different sentence structures and subjects
(e.g., change one to an imperative like "Automate the amend workflow previously
available in the UI", another to passive/feature-focused like "Existing datasets
can be updated without rebuilding from scratch", and the third to emphasize
continuity like "Maintain the same schema-driven logic across UI, REST, CLI, and
MCP"); update the bullet text directly in that section to preserve meaning while
eliminating the repeated "You can" lead-in.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js`:
- Around line 73-85: The current getTopVisibleColumnTextsByName uses raw row
indexes and can return texts from hidden rows; change it to collect the first
desiredCount visible rows by scanning row indices and checking visibility (use
existing helpers like countVisibleRows and any row-visibility predicate such as
isRowVisible/getRowVisibility or a getRowElement check) and only call
getCellTextByColumnName(columnName, visibleRowIndex) for rows confirmed visible;
stop when you’ve gathered desiredCount or reached the total row count to avoid
infinite loops.

---

Nitpick comments:
In `@docs-src/blog/2026-05-10-import-and-amend-across-interfaces.md`:
- Around line 37-41: The three bullets under the "## Why This Matters" section
use repetitive sentence starts ("You can"); edit the three list items to vary
phrasing and improve flow by using different sentence structures and subjects
(e.g., change one to an imperative like "Automate the amend workflow previously
available in the UI", another to passive/feature-focused like "Existing datasets
can be updated without rebuilding from scratch", and the third to emphasize
continuity like "Maintain the same schema-driven logic across UI, REST, CLI, and
MCP"); update the bullet text directly in that section to preserve meaning while
eliminating the repeated "You can" lead-in.

In `@docs-src/docs/070-interfaces-and-deployment/050-cli-node-and-bun.md`:
- Around line 71-72: The two bullets for the `amend` flag start repetitively
with "For `amend`"; reword them to improve flow by combining related behavior
and varying sentence starts: e.g., state default behavior when
`-n/--numberOfLines` is omitted (all imported rows are amended) and then
describe the truncated behavior when `-n/--numberOfLines` is smaller than the
number of imported rows (only the first N rows are amended but full output is
returned), making sure to reference `amend` and `-n/--numberOfLines` in the same
concise sentences to avoid repetition.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c225f3e2-f6e0-4e5d-b770-dd3f584037f0

📥 Commits

Reviewing files that changed from the base of the PR and between 393e932 and fa579bc.

📒 Files selected for processing (9)
  • apps/web/src/tests/browser/abstraction-smoke-tests/grid-header-controls.spec.js
  • apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js
  • apps/web/src/tests/browser/app-coverage/filtering-sorting/filtering-sorting.spec.js
  • apps/web/src/tests/browser/planned-functional/filtering-sorting/column-sorting.spec.js
  • apps/web/src/tests/browser/planned-functional/grid-operations/clear-sort-before-add-rows-below.spec.js
  • docs-src/blog/2026-05-10-import-and-amend-across-interfaces.md
  • docs-src/docs/070-interfaces-and-deployment/030-rest-api.md
  • docs-src/docs/070-interfaces-and-deployment/040-mcp.md
  • docs-src/docs/070-interfaces-and-deployment/050-cli-node-and-bun.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa579bc9e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js (1)

73-85: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Visible-row helper still indexes raw rows

Line 83 and Line 84 still use raw indices, so hidden rows can be read even when countVisibleRows() is sufficient. That breaks the “top visible rows” contract and can make assertions flaky.

Suggested fix
   async getTopVisibleColumnTextsByName(columnName, count) {
-    const desiredCount = Number(count) || 0;
-    if (desiredCount <= 0) {
+    const desiredCount = Math.trunc(Number(count));
+    if (!Number.isFinite(desiredCount) || desiredCount <= 0) {
       return [];
     }
-    const visibleRows = await this.countVisibleRows();
-    if (visibleRows < desiredCount) {
-      return [];
-    }
-    const values = [];
-    for (let rowIndex = 0; rowIndex < desiredCount; rowIndex += 1) {
-      values.push(await this.getCellTextByColumnName(columnName, rowIndex));
-    }
-    return values;
+    const columnIndex = await this._columnIndexByName(columnName);
+    return this.rows.evaluateAll((rowEls, { desiredCount, columnIndex }) => {
+      const visibleRows = rowEls.filter((row) => row.offsetParent !== null).slice(0, desiredCount);
+      if (visibleRows.length < desiredCount) return [];
+      return visibleRows.map((row) => {
+        const cell = row.querySelectorAll('.tabulator-cell')[columnIndex];
+        return (cell?.innerText || '').trim();
+      });
+    }, { desiredCount, columnIndex });
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js`
around lines 73 - 85, getTopVisibleColumnTextsByName currently uses raw row
indices (rowIndex) to call getCellTextByColumnName, so hidden rows can be read;
change the loop to map the desired visible-row ordinal to the actual DOM row
index before calling getCellTextByColumnName. In practice, for each visible
ordinal (0..desiredCount-1) obtain the corresponding actual row index (e.g. via
an existing helper like countVisibleRows/getVisibleRowIndex or by querying
visible row elements and using their index) and pass that actual index into
getCellTextByColumnName(columnName, actualRowIndex) so only visible rows are
read.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In
`@apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js`:
- Around line 73-85: getTopVisibleColumnTextsByName currently uses raw row
indices (rowIndex) to call getCellTextByColumnName, so hidden rows can be read;
change the loop to map the desired visible-row ordinal to the actual DOM row
index before calling getCellTextByColumnName. In practice, for each visible
ordinal (0..desiredCount-1) obtain the corresponding actual row index (e.g. via
an existing helper like countVisibleRows/getVisibleRowIndex or by querying
visible row elements and using their index) and pass that actual index into
getCellTextByColumnName(columnName, actualRowIndex) so only visible rows are
read.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ae62e2d-cd5c-417f-828e-e7a6b0f4a3d8

📥 Commits

Reviewing files that changed from the base of the PR and between fa579bc and 845c40e.

📒 Files selected for processing (5)
  • apps/web/src/tests/browser/abstraction-smoke-tests/grid-header-controls.spec.js
  • apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js
  • apps/web/src/tests/browser/app-coverage/filtering-sorting/filtering-sorting.spec.js
  • apps/web/src/tests/browser/planned-functional/filtering-sorting/column-sorting.spec.js
  • apps/web/src/tests/browser/planned-functional/grid-operations/clear-sort-before-add-rows-below.spec.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/web/src/tests/browser/app-coverage/filtering-sorting/filtering-sorting.spec.js
  • apps/web/src/tests/browser/planned-functional/grid-operations/clear-sort-before-add-rows-below.spec.js
  • apps/web/src/tests/browser/abstraction-smoke-tests/grid-header-controls.spec.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/tests/browser/abstractions/components/grid-editor.component.js`:
- Around line 102-104: The recovery check for default mode uses a strict
greater-than which can false-fail when filters clear but the row count stays the
same; in the calculation that sets rowCountRecovered (and the similar check
around lines 116-118) update the condition from activeRowCount >
initialActiveRowCount to activeRowCount >= initialActiveRowCount so that
unchanged-but-cleared results are treated as recovered; locate the expression
using expectedActiveRowCount, activeRowCount, and initialActiveRowCount and
change the operator accordingly.
- Around line 107-108: The call to await this.renderer.waitForGridSettle({
columnName: diagnosticColumn, stableForMs: 2000, timeoutMs: 7000 }) can throw
and currently escapes the surrounding retry loop and final diagnostic/error
block; wrap that await in a try/catch inside the retry loop (in the same
function where retries are performed) so timeout errors are caught,
logged/ignored for the current attempt, and the loop continues to the next
retry, and only after all retries are exhausted rethrow or let the existing
final error handling run (detect the timeout by checking the thrown
error/message and avoid swallowing non-timeout unexpected errors). Ensure you
reference the existing retry loop and the final diagnostic/error block so the
catch does not bypass those.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 370418be-493b-46cf-8039-da4ef5948423

📥 Commits

Reviewing files that changed from the base of the PR and between 20f97ba and f3fca86.

📒 Files selected for processing (5)
  • apps/web/src/tests/browser/abstractions/components/grid-editor.component.js
  • apps/web/src/tests/browser/abstractions/components/grid-header.component.js
  • apps/web/src/tests/browser/abstractions/components/grid-renderer.component.js
  • apps/web/src/tests/browser/app-coverage/filtering-sorting/filtering-sorting.spec.js
  • apps/web/src/tests/browser/app-coverage/helpers/test-helpers.js

Comment thread apps/web/src/tests/browser/abstractions/components/grid-editor.component.js Outdated
Comment thread apps/web/src/tests/browser/abstractions/components/grid-editor.component.js Outdated
@eviltester eviltester closed this May 10, 2026
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