fix(query,export,migrate): deterministic order over the HashMap-backed store (REQ-160, #415)#417
Merged
Merged
Conversation
…d store (REQ-160, #415) Follow-up to REQ-159: migrate the `store.iter().collect()` sites that produce ordered, user-facing output so they're reproducible across runs. Audited every site. Order-irrelevant ones (HashSet<id> membership) left as-is; render/externals.rs already sorted. Fixed the output sites: - `query::execute` returns results ascending by id — the shared set behind `rivet list` (whose default path did NOT sort), the MCP query tool, and `{{query:…}}` embeds, so all become deterministic at one chokepoint. - `cmd_export` (ReqIF/etc.) and `cmd_export_zola` sort by id before emitting, so exports are byte-reproducible. - `rivet schema migrate` sorts before computing the rewrite map so the generated migration is reproducible. Verified: `rivet list --format json` id order identical across runs; new `execute_returns_results_sorted_by_id` test; export_reqif_roundtrip / export_zola / migrate_integration suites still pass; rivet-core query (19) + cli_commands (112) green; rivet validate PASS, docs check PASS; clippy --all-targets + fmt clean. Implements: REQ-160 Refs: REQ-159
📐 Rivet artifact delta
Graphgraph LR
REQ_160["REQ-160"]:::added
classDef added fill:#d4edda,stroke:#28a745,color:#155724
classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Added
Posted by |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 4bfecc7 | Previous: 8e9a9d1 | Ratio |
|---|---|---|---|
query/1000 |
11314 ns/iter (± 29) |
6734 ns/iter (± 133) |
1.68 |
query/10000 |
173338 ns/iter (± 6247) |
101496 ns/iter (± 580) |
1.71 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #416 (REQ-159) — the site-migration half of #415.
What
Audited every
store.iter().collect()site. Order-irrelevant ones (HashSet<id>membership) left as-is;render/externals.rsalready sorted. Fixed the output-producing sites:query::execute→ returns results ascending byid. This is the shared set behindrivet list(whose default path did not sort → nondeterministic order), the MCP query tool, and{{query:…}}embeds — so all become deterministic at one chokepoint.cmd_export(ReqIF/etc.) +cmd_export_zola→ sort by id before emitting → byte-reproducible exports (matters for diffing/CI).rivet schema migrate→ sorts before computing the rewrite map → reproducible generated migration.Verify
rivet list --format jsonid order identical across runs.execute_returns_results_sorted_by_idunit test.export_reqif_roundtrip(2),export_zola(2),migrate_integration(11); rivet-core query (19) + cli_commands (112) green.rivet validatePASS; docs check PASS; clippy--all-targets+ fmt clean.With this, #415 is fully addressed (core + sites); the optional "back the store with an ordered map" remains as a possible future simplification but isn't needed now.
Implements: REQ-160
🤖 Generated with Claude Code