Skip to content

hidane 0.6.0

Choose a tag to compare

@github-actions github-actions released this 15 Oct 22:09
· 165 commits to main since this release
Immutable release. Only release title and notes can be modified.
c0615a0

hidane 0.6.0 answers like the official emulator in more places, and checks more clients against both emulators. On a database started with --database-edition enterprise, queries and aggregations now follow the enterprise edition's semantics. Requests for project IDs the official emulator refuses are refused, and single project mode warns like the official emulator. Six more batches of differences found by the differential fuzzer are fixed.

Verified against the official Cloud Firestore emulator v1.22.0, as firebase-tools 15.33.0 downloads it. Per-client versions are in docs/sdk-certification.md. The tests replay 26,556 recorded answers of the official emulator, from 57 recordings.

Changes that may affect your tests

These are compatibility fixes (docs/versioning.md): each makes hidane answer as the official emulator does. A test written against hidane's earlier answer can start failing.

  • Project IDs (#335). The official emulator accepts only Cloud project IDs, and so does hidane now:

    • lowercase letters, digits and hyphens, not starting with a hyphen, at most 100 characters;
    • optionally after a domain and a colon, such as example.com:my-project.

    Any other project ID gets 400 Invalid project ID(P) or database ID(D), for example one with uppercase letters (MyProject), an underscore or a leading hyphen. This holds wherever a name appears: in a request's path, in the documents of writes and reads, and in references stored in documents or compared in filters and cursors. . and .. are refused as project and database IDs.

  • Single project mode (#336, #14). firebase-tools starts the emulator with --project_id <p> --single_project_mode true unless emulators.singleProjectMode is false. In that mode, a request for another project prints the official warning on standard output, twice: Multiple projectIds are not recommended in single project mode. …. With --single_project_mode_error true, such a request fails with INVALID_ARGUMENT and that message. The project that counts is:

    • a REST path's;
    • for gRPC: the google-cloud-resource-prefix header, else the database of x-goog-request-params, else the name;
    • a WebChannel URL's database;
    • an export's or import's body.
  • Enterprise edition (#338). On the official emulator, a database started with --database-edition enterprise runs queries as pipelines. firebase-tools passes that flag for firestore.edition: "enterprise".

    • RunQuery (#341). Null equals null and NaN equals NaN. != and not-in include documents without the field. The standard edition's restrictions do not apply, such as several negations, two array-contains or descending key scans. array-contains on a value that is not an array is an error. Array offsets such as a[0] read elements. Results follow the query's own orders only.
    • RunAggregationQuery (#342). Integers are summed as 64-bit integers, and an overflow is an error. Doubles are summed as decimals, so 0.1 + 0.2 is 0.3. count counts every document, and count with up_to is an error.
    • Listeners (#343). They match null and NaN as values.
    • Not done yet: a listener on an enterprise database still refuses 34 recorded queries otherwise (D091), and pipelines (ExecutePipeline) are not implemented (#80).
  • Security Rules (#299, #305). A decision stops after 1,000 evaluated expressions, counted as the official emulator counts them, ternary operators included.

  • Differential fuzzing (#262: #280, #303, #306, #311, #312, #323, #326, #327, #330). These batches fix the differences the fuzzer found on several seeds. Among them:

    • the order of a query's checks, and how disjunctions and terms are counted;
    • a commit's own errors end its transaction;
    • read_time precision and age checks;
    • Security Rules on lists without a collection ID;
    • field order after masked writes;
    • doubles printed with Java's tie-break.
  • Listen (#343). A query target of more than one collection now ends the stream, as on the official emulator. hidane answers INVALID_ARGUMENT with RunQuery's message where the official emulator answers UNKNOWN without one (D006).

New

  • POST /emulator/v1/projects/{p}[/databases/{d}]:bulkDelete (#337, part of #36). It deletes the documents of every collection with one of collection_ids, at any depth, as Datastore's bulk delete does.
  • Verified clients:
    • the iOS SDK (FirebaseFirestore 13.0.1 on macOS, #332) and the Android SDK (firebase-firestore 27.0.0 in an Android emulator, #333): documents, queries, aggregations, transactions and listeners, including a listener idle for 95 seconds;
    • nodejs-firestore's own system tests, over gRPC (#331) and REST (preferRest, #340): hidane passes all 328 that pass on the official emulator, and @google-cloud/firestore with preferRest is now verified;
    • the requests of googleapis/conformance-tests (#334): all 185 answer as on the official emulator.
  • Benchmark scenarios: owner_writes, writes with the credential the Admin SDKs send (#290); listen_limit_writes, writes with a limit(50) listener attached (#296). A run that fails is run again once, in a fresh process (#300). A limited query now stops at its documents instead of the end of the collection (#297), which speeds up listeners with a limit.
  • Parity records: every intentional difference names the tests that pin it (#309), and ADR 0008 describes the recording and replay method (#298). hidane doctor no longer reports single project mode.

Breaking changes

None to a stable surface. The changes above are compatibility fixes.

Install

curl -fsSL https://hidane.dev/install.sh | sh
brew install hidane-dev/tap/hidane
npm install --save-dev hidane
cargo binstall hidane   # or cargo install hidane
dart pub global activate hidane
docker run --rm -p 8080:8080 ghcr.io/hidane-dev/hidane:0.6.0

Full changelog: v0.5.1...v0.6.0