Skip to content

fix(indexeddb): use 0-N revisions for local documents - #9293

Closed
superbot-helper wants to merge 1 commit into
apache:masterfrom
superbot-helper:fix/indexeddb-local-doc-revisions
Closed

superbot-helper wants to merge 1 commit into
apache:masterfrom
superbot-helper:fix/indexeddb-local-doc-revisions

Conversation

@superbot-helper

Copy link
Copy Markdown

Local documents (_local/*) written through the indexeddb adapter were given ordinary versioned revisions (1-, 2-).

The adapter defines _getLocal but not _putLocal/_removeLocal, so pouchdb-core falls through to the generic write path, and parseDoc starts new documents at generation 1. CouchDB and the leveldb-core, websql-core and idb adapters all use the 0-N local-document scheme.

Add putLocal/removeLocal to the adapter and route local documents in bulkDocs through them, so put() and bulkDocs() agree. Local revisions written by earlier releases (1-) carry their generation over on the next write, so the revision stays monotonic.

Low severity: within the adapter local documents already read back what was written; only the revision value violated the contract.

Overview

Testing recommendations

Related Issues or Pull Requests

Checklist

  • I am not a bot
  • This is my own work, I did not use AI, LLM's or similar technology for code or docs generation
  • Code is written and works correctly
  • Changes are covered by tests
  • I modified the types to reflect the changes, if necessary
  • Documentation changes were made in the docs folder

Local documents (_local/*) written through the indexeddb adapter were
given ordinary versioned revisions (1-<hash>, 2-<hash>).

The adapter defines _getLocal but not _putLocal/_removeLocal, so
pouchdb-core falls through to the generic write path, and parseDoc
starts new documents at generation 1. CouchDB and the leveldb-core,
websql-core and idb adapters all use the 0-N local-document scheme.

Add putLocal/removeLocal to the adapter and route local documents in
bulkDocs through them, so put() and bulkDocs() agree. Local revisions
written by earlier releases (1-<hash>) carry their generation over on
the next write, so the revision stays monotonic.

Low severity: within the adapter local documents already read back what
was written; only the revision value violated the contract.
@superbot-helper

Copy link
Copy Markdown
Author

Withdrawing this. CONTRIBUTING.md states that material generated by AI or LLMs is expressly forbidden in source code, documentation and commit messages, and this change is generated material. The template's "This is my own work, I did not use AI, LLM's or similar technologies" line is the project's own statement of that rule, so it should not stay open.

The defect is real, so leaving the finding on the record for whoever picks it up:

  • pouchdb-adapter-indexeddb gives _local/* documents ordinary versioned revisions (1-<hash>, then 2-<hash>), where every other adapter and CouchDB use 0-1 and 0-2.
  • The adapter defines _getLocal but no _putLocal or _removeLocal, so pouchdb-core falls through to the generic revision path.
  • pouchdb-adapter-leveldb-core and pouchdb-adapter-idb both implement the 0-N scheme, so the shape to follow is already in the tree.

Measured on 9.0.0: put gives 1-c6d7bc18... then 2-c2e36659... on indexeddb, against 0-1 then 0-2 on memory and idb.

Sorry for the noise. Closing.

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