MIRS571 opened a new pull request, #991:
URL: https://github.com/apache/burr/pull/991

   SQLite's default `CURRENT_TIMESTAMP` has second-level precision. After #942, 
`list_app_ids()` lists each app once and orders by its latest timestamp, but 
apps saved within the same second still have unspecified ordering. A caller 
such as the YouTube-to-social-media notebook, which resumes 
`list_app_ids("")[0]`, can therefore pick a different app from `load("", 
None)`, whose timestamp ties were fixed in #920.
   
   ## Changes
   
   - Make synchronous and asynchronous SQLite `list_app_ids()` deterministic: 
keep each app's maximum `created_at` as the primary key, then use the greatest 
`rowid` **among rows at that timestamp**.
   - Do not let a later-inserted, backdated checkpoint override timestamp 
priority or decide a tie using an older checkpoint.
   - Preserve unique app IDs, partition isolation, and the existing `None` / 
`""` default-partition behavior. No schema migration or other backend changes.
   - Add 20 parameterized regression cases covering both app-name orders, 
repeated saves, reopening the database, same-app rows in another partition, 
default/named/whitespace partition keys, and timestamp-versus-insertion 
ordering.
   
   ## How I tested this
   
   Environment: Windows, Python 3.11.2, SQLite 3.39.4, aiosqlite 0.22.1.
   
   Before the implementation change, the 20 new cases produced **10 failures 
and 10 passes**. Afterward:
   
   ```text
   python -m pytest tests/core/test_persistence.py 
tests/integrations/persisters/test_b_aiosqlite.py -p pytest_asyncio.plugin 
--asyncio-mode=auto -q
   94 passed
   
   python -m pytest tests/core 
tests/integrations/persisters/test_b_aiosqlite.py -p pytest_asyncio.plugin 
--asyncio-mode=auto -q -k 'not test_visualize_dot_output'
   474 passed, 4 deselected
   ```
   
   Both commands used `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1`. The four 
visualization tests were excluded because Graphviz's `dot` executable is 
unavailable locally; these are not a full-repository or cross-version CI result.
   
   The applicable pre-commit checks passed for all four changed files (Black, 
isort, flake8, AST, whitespace/EOF, ASF header). The frontend-only hook was 
excluded; no frontend files changed. `git diff --check` passed.
   
   Additional local checks: 12 diagnostic cases passed, plus 100 deterministic 
randomized datasets matched an independent timestamp/rowid reference ordering, 
including nullable timestamps and partition isolation.
   
   ## Notes
   
   - This intentionally changes only previously unspecified timestamp-tie 
ordering and follows the existing SQLite `load()` tie-breaker. It does not 
promise row identity across externally rewritten databases.
   - The query first selects rows at each app's latest timestamp before 
aggregating `rowid`; independent `MAX(created_at), MAX(rowid)` aggregates can 
describe different checkpoints.
   - There is a query-cost tradeoff: on a local in-memory dataset with 100,000 
rows / 100 apps, five-run median query time was about 26 ms before and 69 ms 
after. This is a diagnostic measurement, not a production benchmark or a 
performance improvement. No new index is introduced.
   
   ## Checklist
   
   - [x] PR has an informative and human-readable title
   - [x] Changes are limited to a single goal
   - [x] Applicable pre-commit checks pass (frontend-only hook excluded as 
noted above)
   - [x] Changed functionality is tested
   - [x] Existing method docstrings describe the ordering; no new public 
functions
   - [x] No placeholder implementation or deferred TODOs
   - [x] Ordering documentation updated in both method docstrings
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to