Skip to content

test(table): pin the row-write behavior the suite could not fail on - #6811

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/table-row-write-test-coverage
Aug 18, 2026
Merged

test(table): pin the row-write behavior the suite could not fail on#6811
waleedlatif1 merged 2 commits into
stagingfrom
fix/table-row-write-test-coverage

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #6808/#6809. A mutation-testing pass over that work found four changes that could be reverted with the whole suite green, plus two comments asserting something untrue. This pins them.

  • Copilot row writes now assert the translated storage keys rather than the keying flag. The shared table fixture uses legacy columns with no id, where name-to-id mapping is the identity, so the wrong keying was unobservable; columns whose id differs from name make it fail. Copilot is the one row-write surface whose column keys come from a model, and under id keying the lax write path stores those keys verbatim and reports success — a silent row corruption.
  • The three provenance transport helpers get direct cover. The route tests only reach mapInput and present, so each helper could be replaced by a constant, and a constant envelope reader silently downgrades every executor write from a stamped bundle to untracked.
  • The domain provenance fixtures run against the real envelope guard instead of a stub that always accepted them. None of the old fixtures was a shape the guard admits, so the happy path had never been exercised.
  • The attribution allowlist keys on the client-id reader rather than the field name, so it no longer misses a surface that names the acting tab positionally — one of the two real suppliers was already invisible to it.
  • Restores the selectedValues narrowing on the migrated row routes, so a stale sidecar entry for a dropped column no longer rides along in the provenance envelope. Matches what the unmigrated rows/query routes have always done.
  • Adds a compile-time tie between the shared table fixture and TableDefinition. tsconfig excludes test files, so an assertion placed in one is never checked — a new required field was a production type error and a silent no-op across every route test. The probe is type-only so the @sim/testing devDependency never becomes a runtime import.
  • Corrects the getRowSummaryById TSDoc, which claimed the Copilot row tool never put executions on the wire. It did; that narrowing is a deliberate wire change rather than a pure saving.

Type of Change

  • Test coverage
  • Bug fix (provenance envelope narrowing)

Testing

1,975 tests pass across lib/table, app/api/table, lib/copilot/tools/server/table, app/api/v2/tables and lib/api/server/routes. type-check clean, all 29 audits pass.

Every new test is mutation-verified — the behavior was reverted and the covering test confirmed to go red. The keying mutation reproduces the corruption exactly: { name: 'Grace' } stored where { col_name: 'Grace' } was meant.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Mutation testing across the branch found four changes that could be reverted
with the whole suite green, plus two comments asserting something untrue.

- Copilot row writes now assert the translated storage keys, not the literal
  keying flag. The shared table fixture uses legacy columns with no id, where
  name-to-id mapping is the identity, so the wrong keying was unobservable;
  columns whose id differs from name make it fail. Copilot is the one row-write
  surface whose keys come from a model, and under id keying the lax write path
  stores those keys verbatim and reports success.
- The three provenance transport helpers get direct cover. The route tests only
  reach mapInput and present, so each could be replaced by a constant, and a
  constant envelope reader silently downgrades every executor write to
  untracked.
- The domain provenance fixtures run against the real envelope guard instead of
  a stub that always accepted them; none of the old fixtures was a shape the
  guard admits.
- The attribution allowlist keys on the client-id reader rather than the field
  name, so it no longer misses a surface that names the acting tab positionally
  -- one of the two real suppliers was already invisible to it.

Also restores the selectedValues narrowing on the migrated row routes, so a
stale sidecar entry for a dropped column no longer rides along in the envelope,
matching what the unmigrated rows and query routes have always done.

Adds a compile-time tie between the shared table fixture and TableDefinition.
tsconfig excludes test files, so an assertion placed in one is never checked; a
new required field was a production type error and a silent no-op across every
route test.

Corrects the getRowSummaryById TSDoc, which claimed the Copilot row tool never
put executions on the wire. It did, and that narrowing is a deliberate wire
change rather than a pure saving.
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 18, 2026 2:41pm

Request Review

@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Mostly tests and a narrow provenance-loading fix; no auth or broad API contract changes beyond documented Copilot row read narrowing.

Overview
Follow-up hardening after mutation testing found regressions that left the full suite green. Copilot insert_row / update_row tests now assert storage column ids when idname, so wrong dataKeying cannot silently store LLM keys verbatim.

Provenance transport (readTableRowProvenanceEnvelope, negotiateTableRowsProvenance, finalizeTableRowsProvenance) gets direct tests so route-only coverage cannot be satisfied by stub constants. Domain provenance tests use real bundle/trace shapes instead of mocks that always accepted invalid envelopes.

Production fix: loadAuthorizedRowsProvenance passes selectedValues: row.data into the provenance loader so dropped-column sidecar entries do not leak into envelopes (aligned with unmigrated rows/query routes).

Attribution audit detects actor suppliers via actorClientId: and positional signalTableRowsChangedByActor args, adding the bulk rows route to the allowlist. A type-only fixture-contract probe ties createTableDefinition to TableDefinition. getRowSummaryById docs are corrected to note Copilot get_row no longer exposes executions on the wire.

Reviewed by Cursor Bugbot for commit a03e471. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR strengthens mutation-sensitive coverage around table row key translation, provenance transport, fixture contracts, and attribution auditing while narrowing loaded provenance to values still present in each row.

  • Adds direct tests for provenance envelope reading, negotiation, and finalization.
  • Verifies Copilot row writes translate model-provided column names to storage IDs.
  • Exercises provenance resolution against the real envelope guard.
  • Narrows sidecar provenance loading to current row values.
  • Reworks actor-supplier discovery around actual attribution forms.
  • Adds a compile-time table-fixture compatibility probe and corrects row-summary documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/table/application/rows.ts Narrows provenance sidecar loading to the values currently present in each row, consistent with exact-cell boundary filtering.
apps/sim/lib/table/events.attribution.test.ts Replaces client-ID-reader discovery with checks for the two actual actor-attribution forms and covers both current supplying routes.
apps/sim/app/api/table/row-secret-provenance.test.ts Adds direct coverage for the three provenance transport helpers and their rejection paths.
apps/sim/lib/copilot/tools/server/table/user-table.test.ts Verifies insert and update operations translate model-supplied column names to stable storage IDs.
apps/sim/lib/table/application/row-secret-provenance.test.ts Replaces an always-accepting bundle mock with valid fixtures exercised against the production envelope guard.
apps/sim/lib/table/fixture-contract.ts Adds a type-only compile-time assertion that the shared table fixture remains assignable to the production table definition.

Reviews (2): Last reviewed commit: "test(table): key the attribution audit o..." | Re-trigger Greptile

Comment thread apps/sim/lib/table/events.attribution.test.ts Outdated
…ader

The allowlist matched the `readClientId` call site. That reader is a
general-purpose helper any surface may call for unrelated reasons, so an
innocent caller elsewhere in the app would be classified as naming a tab, and
aliasing or wrapping the reader would slip past it.

Match the two forms that actually attribute a write instead -- setting
`actorClientId`, or passing a second argument to the signal -- which hold
however the id was obtained and say nothing about unrelated readers.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a03e471. Configure here.

@waleedlatif1
waleedlatif1 merged commit 34aac38 into staging Aug 18, 2026
49 of 51 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/table-row-write-test-coverage branch August 18, 2026 15:00
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