Skip to content

Feat/js surface migration e2e, session enhancements#6

Merged
PSU3D0 merged 31 commits intomainfrom
feat/js-surface-migration-e2e
Mar 4, 2026
Merged

Feat/js surface migration e2e, session enhancements#6
PSU3D0 merged 31 commits intomainfrom
feat/js-surface-migration-e2e

Conversation

@PSU3D0
Copy link
Copy Markdown
Owner

@PSU3D0 PSU3D0 commented Mar 4, 2026

No description provided.

…endering

Adds layout_page() tool that renders a spreadsheet range with layout
semantics: per-column widths, bold/italic markers, box-drawing borders,
merge detection, and optional ASCII grid render. Exposed on the CLI
(layout-page command) and MCP server (layout_page tool). Includes 14
unit tests covering column sizing, style detection, border weights,
merge handling, range capping, and render modes.
…cture-batch dry-run

Implements ticket 4101: adds --impact-report and --show-formula-delta CLI
flags to structure-batch (require --dry-run), pure planning functions that
analyse shifted row/col spans, absolute-ref risk warnings, and before/after
formula delta samples without mutating files.

- New module: tools/structure_impact.rs with compute_structure_impact()
- CLI: two new flags with actionable error when used without --dry-run
- MCP: optional impact_report/show_formula_delta params on StructureBatchParamsInput,
  additive impact_report/formula_delta_preview fields on StructureBatchResponse
- SDK: normalizeStructureBatchResult + structureBatch method on McpBackend
- Tests: 7 core unit, 4 CLI integration, 4 MCP contract, 3 SDK backend tests
…surfaces

Add define-name, update-name, delete-name as:
- CLI commands with --dry-run/--in-place/--output modes
- MCP tools (define_name, update_name, delete_name) via fork registry
- Session methods for WASM bindings (defineName, updateName, deleteName)
- SDK wrappers in McpBackend and WasmBackend with capability flag

Enhance named-ranges output with explicit scope_kind (workbook|sheet)
and scope_sheet_name fields on NamedRangeDescriptor. All new fields
use skip_serializing_if for backward compatibility.

Tests: 8 new CLI integration tests, 7 new session unit tests,
surface matrix drift check updated. All 300+ tests pass.
Implements ticket 4102: formula-only find/replace with dry-run-first workflow.

Core:
- apply_replace_in_formulas_to_file() targets only formula-bearing cells
- Supports plain text, regex, and case-insensitive modes
- Optional range scoping; defaults to used range
- Returns diff samples (address, before, after) and diagnostics

CLI:
- New replace-in-formulas command with --find/--replace/--range/--regex
- Standard write flags (--dry-run/--in-place/--output/--force)
- Formula parse policy validation on replaced formulas

MCP:
- New replace_in_formulas tool with preview/apply modes and staging
- Fork-based workflow with recalc_needed tracking

SDK:
- McpBackend.replaceInFormulas() with normalized response
- supportsReplaceInFormulas capability (MCP=true, WASM=false)
- WasmBackend throws explicit UNSUPPORTED error

Tests: 11 kit unit/CLI + 5 MCP fork integration + 2 SDK parity tests
Surface matrix updated with new entries.
Extend recalculate to accept --output <PATH> [--force]:
- In-place (default): existing behavior preserved, no new metadata fields
- Output mode: copies source to target, recalculates target, source unchanged
- Response includes source_path, target_path, changed in output mode
- Validates: --force requires --output, output != source, parent dir exists
- Cleans up target on recalc failure in output mode

Updates README command table. Adds 8 CLI integration tests covering
output mode, source unchanged, force/overwrite, invalid paths, and
clap parse verification.
…w workflows

Ticket 4104: Insert Rows Adjacent-SUM Expansion + Clone-Row Primitive

- Add opt-in expand_adjacent_sums field to InsertRows structure op
  (default false). When true, scans the subtotal row immediately below
  the insertion band for simple SUM(Ax:Ay) patterns and expands their
  range to include the newly inserted rows. Complex/ambiguous formulas
  are skipped with WARN_SUM_EXPANSION_SKIPPED warnings.

- Add CloneRow structure op: insert_at + count rows copied from a
  source_row template (values, formulas with row-shift, styles).
  Supports optional expand_adjacent_sums for the same post-insert
  SUM expansion behavior.

- MCP schema automatically updated via JsonSchema derive on StructureOp.

- CLI structure-batch path handles new ops through existing --ops JSON
  payload (no new subcommands needed).

- Tests: 10 new MCP unit tests (single/multi-row expansion, no-op when
  flag absent, ambiguous formula warning, clone-row with/without
  expansion, deserialization defaults). 2 new CLI integration tests
  (insert_rows expand + clone_row in-place).
- Add ReadBudget struct with max_cells, max_payload_bytes, rows_returned,
  cells_returned, total_rows_available, and continuation hint
- SheetPageResponse: add truncated flag and budget metadata; populate on
  cell/payload budget truncation with deterministic continuation cursor
- InspectCellsResponse: add budget metadata; always report detail-view
  limits (hard cap at 25 cells, respects lower config max_cells)
- Register inspect_cells as MCP tool with agent-safe description
- Update MCP server instructions with inspect_cells guidance and budget
  metadata documentation
- Update surface-capability-matrix: promote inspect_cells to ALL/mvp
- Add 8 kit-level tests (read_guardrails.rs): cell budget truncation,
  payload budget truncation, continuation determinism, inspect_cells
  limit rejection, budget metadata, lower config limit, payload truncation
- Add 4 MCP-level tests (read_guardrails_mcp.rs): inspect_cells budget
  flow, over-limit MCP error, sheet_page budget flow, empty targets error
…ent skills

Implements Phases 0-3 of OPS_ARCHITECTURE_PLAN.md:

Phase 0 - UX alignment: --format rows for range-values, inspect-cells
--budget, recalculate --changed-cells/--ignore-sheets, diff --sheets
multi-filter, check-ref-impact preflight command.

Phase 1 - Storage layer: OpEvent envelope with schema versioning,
canonical hashing, preconditions, and hash-chain integrity. Append-only
JSONL binlog with lineage/corruption detection. Persistent .asp/sessions
store with HEAD, branches, snapshots, and session locking.

Phase 2 - CLI surface: asp session subcommand tree (start, log, branches,
switch, checkout, undo, redo, fork, op, apply, materialize) with CAS
apply and snapshot-aware materialization.

Phase 3 - Agent skills: SAFE_EDITING_SKILL.md, EXPLORE_SKILL.md, and
CLI_BATCH_WRITE_SKILL.md with session-first workflows.

Includes 28 integration tests (10 session E2E + 18 Phase 0) and fixes
two bugs found during testing: session_apply OpKind inference and
session_materialize event counting.
@PSU3D0 PSU3D0 merged commit 4078204 into main Mar 4, 2026
4 checks passed
PSU3D0 added a commit that referenced this pull request Mar 4, 2026
Feat/js surface migration e2e, session enhancements
PSU3D0 added a commit that referenced this pull request Mar 4, 2026
Feat/js surface migration e2e, session enhancements
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.

1 participant