---
title: "Keep tied table rows in the documented secondary order"
description: "Verify a table with equal primary values uses its specified secondary key so pagination and repeated sorting do not shuffle tied records."
canonical_url: "https://vostride.com/agent-library/data-tables/stable-tie-order.md"
md_url: "https://vostride.com/agent-library/data-tables/stable-tie-order.md"
content_kind: "recipe"
topic: "data-tables"
---

# Keep tied table rows in the documented secondary order

Verify a table with equal primary values uses its specified secondary key so pagination and repeated sorting do not shuffle tied records.

## Risk

Unstable tie ordering can duplicate or skip rows when the user pages through a sorted table. The expected secondary sort must be a product requirement, not an arbitrary order inferred from one run.

## Fixtures

- A test queue contains five rows with identical priority and ascending creation keys QA-101 through QA-105.
- The contract sorts equal priority by ascending immutable key, and the page size is three.
- A sixth lower-priority control row verifies the primary comparator independently from the tie breaker.

## Steps

1. Open the queue, select priority descending, and verify the first page starts QA-101, QA-102, QA-103.
2. Go to page two and verify QA-104 and QA-105 precede the lower-priority control row.
3. Return to page one and verify the same three tied identifiers remain in their original order.
4. Switch away from priority sort and back, then verify the documented tie order is restored.
5. Reload and compare the union of both pages with the six-record fixture manifest to confirm no duplication or omission.

## Expected results

- The five tied records follow the declared ascending secondary key.
- The lower-priority row remains after every tied high-priority record.
- Repeated navigation and reapplication of sort preserve page boundaries for the static fixture set.

## False-pass traps

- Any consistent-looking order is insufficient unless it matches the specified tie breaker.
- A count of six across pages can still hide one duplicate and one omission; compare the identifier union.

## Cleanup

- Remove the six queue fixtures and reset table pagination and sorting.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa first test](/docs/agent-qa/guides/first-test.md)
- [agent-qa web testing](/docs/agent-qa/guides/web-testing.md)

- [Data table QA recipes](/agent-library/data-tables.md)
- [Software factory QA library](/agent-library.md)
