8000 Simplify wording in docs and code comments · Issue #31 · project-minigraf/minigraf-wasm · GitHub
[go: up one dir, main page]

Skip to content

Simplify wording in docs and code comments #31

Done

Description

@adityamukho

These passages are harder to read than their technical content requires. Keep API names, error codes, limits and guarantees as they are. The suggestions describe the intended edit, not a change in behavior. Nothing here is a claim about how the text was written.

Reviewed default branch at cdb0517b2b51178a29556a50a332b20f5fe251ad: first-party README and benchmark documentation, plus comments/docstrings in the tracked Rust, JS/TS, Python, test and CI sources present in this repo. Excluded license boilerplate, dependency lockfiles and generated declarations/wrappers as separate edit targets. User-facing docs come first.

Documentation (19)

  • README.md:29-34: “stores one real … OPFS starts at Tier 2 support … is transient”. openOpfs(name) stores a <name>.graph file in OPFS. OPFS has Tier 2 support. openInMemory() does not persist data.
  • README.md:36-43: “same name … names two independent databases … import staging entry … publication or recovery”. Using the same name in IndexedDB and OPFS opens separate databases. OPFS stores the database in <name>.graph and holds imports in <name>.graph-import until the import or recovery finishes. Keep the name restrictions and error codes.
  • README.md:45-54: “any call admitted … Freeing a dependent … import admits … selectable meta … publishes the complete old or new database across interruption”. Name the operations that throw [API-027] and list the cleanup calls still allowed. Describe accepted input as an empty blob, a valid v8 image with readable metadata, or a v7 image that can be fully migrated. If interrupted, reopening yields the complete old or new database. A failure while replacing the file closes the handle.
  • README.md:56-61: “a rejected write means unconfirmed … newest meta later rots”. A rejected write may still be present after reopening. If the newest metadata page becomes corrupt, OPFS can reopen the older valid page and lose an acknowledged commit.
  • README.md:129-138: “returns the JSON execute() returns … an object of slot name … a value of the wrong kind”. execute(bindings) returns the same JSON as db.execute(). query(bindings) returns a BrowserCursor. Use slot names without $ as keys and pass the supported plain or typed values. Keep each error code with its condition.
  • README.md:145-147: “the one they are called on is unchanged, and the new one keeps the database open as it does”. Each method returns a new prepared query and leaves the original unchanged. Both keep the database open.
  • README.md:163-167: “accumulator after value … number of values stepped”. step(acc, value) returns the updated accumulator. finish(acc, count) receives the number of values passed to step.
  • README.md:185-187: “carrying the error’s message … a finish whose result is not a value”. A thrown callback error, non-boolean predicate result or invalid finish result stops the query with [QRY-014]. Exceptions use e.message or, if unavailable, String(e).
  • README.md:204-207: “First in the release built on … with queries seeing what it staged”. db.beginWrite() starts a write transaction. A query in that transaction sees its staged writes and retractions. Commit to apply the changes together, or roll back to discard them. Keep the version and commit reference separately.
  • README.md:230-235: “so other asynchronous code cannot mistake the database for the transaction … A user function its queries run … in a finally”. While a write transaction is open, the listed database calls fail with [INT-001], including calls from its query callbacks. Previously opened cursors still return rows. Use finally to roll back any unfinished transaction rather than waiting for garbage collection.
  • README.md:244-248: “required finite integer numbers … Zero … is a real limit … unlimited sentinel … dead history”. Pass integer limits from 0 to 4,294,967,295. -0 is zero, and no value disables either limit. maxLinks limits live links; maxRecords also counts obsolete versions and retractions.
  • README.md:264-267: “Require complete before deleting; retry or abandon on exhausted … only commit when discovery is complete”. Look up references before staging deletions. If the result is complete, use its links; if it is exhausted, increase the limits or skip the deletion. Exhaustion does not undo earlier writes.
  • README.md:363-377: “locked Cargo graphs … tested evidence … source contract … Receipts report … limitation is checked”. Keep the browser feature and check the locked dependencies before building. Save the WASI lockfile with the build and test results. Choose the browser tests by source branch, not the package label, and record the browser engine that ran each test. Linux WebKit tests the known OPFS limitation; macOS WebKit must support OPFS.
  • README.md:411-424: “exact dependency and branch containment … Production publication/recovery failures retain … evidence request 90 days”. On retry, verify the original dependency and that the tested commit still belongs to the source branch. Keep the original tarballs and test results for 90 days if the repo allows it; losing them prevents safe retries. Mark failed production releases with release-broken.
  • README.md:429-444: “for a 3.x label … Preparation travels … exact identities … actual consumer legs … hosted rehearsal … #929 owns”. Explain the manual inputs by release line. Carry the prepared source in a Git bundle, not a temporary remote branch. Record the source, prepared and workflow commits, dependency and WASI versions/commits, hashes, and which tests ran. Point to #960 for the run records, #937 for tests after the branch move, and #929 for publication.
  • bench/README.md:11-14: “invokes each operation exactly once, checks fixed answers and reads no timer”. With --test, run each operation once and check its expected result without timing it.
  • bench/README.md:21-24: “Setup, prepare, registration and correctness checks are outside measurement; foreign result decoding … Set binding containers … this host language”. Setup, query preparation, function registration and result checks are not timed. Decoding results and closing cursors are timed. Each call makes a new set. The callbacks use the binding’s language.
  • bench/README.md:26-32: “Routing, build provenance … manual coverage dispositions … Phase B performs the serial workflow dispatch and upload/history validation”. The core guide lists runner assignments, how to verify the core commit, Bencher testbeds, per-job budgets and any manual exceptions. CI tests the selected core commit without changing this repo’s dependency. Dispatch the core workflow jobs one at a time, then check the uploaded results and benchmark history. If the old PR-order instruction still matters, keep it in the rollout plan rather than the benchmark guide.
  • wasi-pkg/README.md:29-40: “The package is the REPL, not a library … lookup is not available from this auto-commit REPL, which has no transaction handles or lookup command”. This package runs the command-line REPL and exposes no library API. It commits each successful command independently. For explicit transactions or incoming-reference lookups, use the listed Rust or JavaScript bindings.

Source comments and docstrings (2)

  • consumer-test/browser/contract.js:121: “through the packed package’s JS glue”. Test incoming reference lookup using the installed browser package.
  • consumer-test/browser/contract.js:132-133: “Inject a real … at the storage boundary … proves it is the database’s failed state”. Force an IndexedDB flush to fail. Restore the API before checking STG-046 so the test checks the database’s failed state, not a second injected error.

Activity

  1. adityamukho commented on Dec 2, 2026

    @adityamukho
    ContributorAuthor

    Addressed on both maintained lines: #32 and #34 cover main, and #33 covers v2.x. The additional benchmark and 3.x-only API and consumer-test findings do not apply to v2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0