Skip to content

chore(recipher-js): review cleanups: no Label check, a derived Debug, plain-language docs - #1808

Closed
coderdan wants to merge 3 commits into
refactor/recipher-error-is-the-diagnosticfrom
chore/recipher-review-cleanups
Closed

coderdan wants to merge 3 commits into
refactor/recipher-error-is-the-diagnosticfrom
chore/recipher-review-cleanups

Conversation

@coderdan

Copy link
Copy Markdown
Contributor

Summary

Closes #1803. On top of #1807.

Three cleanups from review of the TypeScript SDK (@cipherstash/recipher, the package over the Stack Encrypt engine). A boundary test that guarded against nothing is removed. A hand-written Debug is now derived. The doc comments and the README are rewritten in plain language. No behaviour changes.

Changes

  • The Label check is removed from crate/tests/boundaries.rs, and from its mention in AGENTS.md. The check failed if the addon named the engine's Label or IntoLabel types. It was added while the engine planned to replace both, and that design is now settled. The two other checks stay: the addon does not link eql-bindings, and a default build cannot reach the test keys.
  • RecordPlan derives Debug. Its hand-written Debug printed only the record's name. A plan holds only declaration data: names, kinds, indexes and the engine's Plan. None of it is secret, so the rule is a derived Debug rather than vitaminc's OpaqueDebug, which prints nothing. Its Field type derives Debug too. I searched both crates (crate/ and value-napi/) for other hand-written impl Debug or impl fmt::Debug, and found none.
  • The docs are in plain language: the doc comments in crate/src/*.rs and crate/tests/boundaries.rs, the doc comments in src/*.ts, and the package README.md. Sentences are short, with one idea each and plain verbs. Each term is defined where it first appears, for example frame, sink, plan, passthrough field, field path, outcome object, context and keyset. The prose says "encrypt" and "decrypt" where it said "seal" and "open"; code names are unchanged. native.d.ts is regenerated, because napi copies the addon's doc comments into it. value-napi/ is not touched.

Verification

Run locally in the package directory, with the debug addon rebuilt:

  • cargo fmt --all --check: clean.
  • cargo test --locked --all-features: recipher-js 39 and 2 passed (the boundary tests went from 4 to 2), recipher-value-napi 33 and 1 passed.
  • cargo clippy --locked --all-targets --all-features -- -D warnings: clean.
  • napi build ... --features testing --dts native.d.ts --no-const-enum: native.d.ts regenerated and committed.
  • tsup: built. vitest run: 29 passed. vitest run --config vitest.addon.config.ts: 76 passed. tsc --noEmit -p tsconfig.json: clean.
  • From the repository root: biome check languages/typescript/packages/recipher-js: clean. vitest run --config scripts/vitest.config.mjs: 96 files, 1,598 passed, 29 skipped.
  • The doc commit changes only comments and README prose. I checked this with a diff filter that drops comment lines; it printed nothing for crate/src and src.
  • The plain-language checker on README.md: no "must fix" findings. One "consider" finding is left: it reads the / in the title @cipherstash/recipher as a slash used for "or".

Not run: the release build, and anything on Linux or Windows. CI covers those.

Review notes

  • Facts added to the docs, please check them. Most are taken from other files in the package. Two are my inference from the engine, not stated in the package before:
    • The README says what each index is for: equality finds exact matches, match finds text matches, and ore and ope compare order.
    • The README defines a context as data that a ciphertext is bound to, so that the ciphertext decrypts only under the same context. This follows the engine's help text for stack_encrypt::aead.
  • Readings I was unsure of: the note on bytes_of (crate/src/ciphertext.rs) about why napi's owned Uint8Array is not used. It now says that napi's owned Uint8Array keeps a reference to a typed array of another element type even when it refuses it. Also, "each ciphertext is the one Rust and Go write" (value.rs) now says the ciphertext has the form Rust and Go write, since encryption is randomised.
  • The README now has one sentence per line where it was hard-wrapped. GitHub renders both the same way, but the diff is larger than the change in wording.
  • Serial commas differ: the TypeScript docs and the README use them; the Rust docs keep the files' existing style without them.
  • cargo doc with -D warnings fails on one link that was already there: the crate docs in lib.rs link to the private module js. CI does not run that check. I left it.
  • The Label removal and the Debug change are separate commits from the doc rewrite, so each can be read alone.

Related

The check was added while the engine planned to replace `Label` and
`IntoLabel` with field paths, so that a crate that never named them would
need no change. The context design is settled now, and the check guards
against nothing. The two other boundary checks stay: the addon does not
link `eql-bindings`, and a default build cannot reach the test keys.

Refs #1803.
`RecordPlan` had a hand-written `Debug` that printed only the record's
name. The repository's rule is to derive vitaminc's `OpaqueDebug` for a
type whose contents must not print, and `Debug` otherwise. A plan holds
only declaration data (names, kinds, indexes and the engine's `Plan`),
which is not secret, so it derives `Debug`, as its `Field` does now.
No other hand-written `Debug` is left in the addon or the value bridge.

Refs #1803.
…language

The doc comments were dense: long sentences, several ideas each, and
terms such as frame, sink, plan, passthrough and outcome used before
anyone said what they are. They now use short sentences with one idea
each and plain verbs, and define each term where it first appears.
Napi copies the addon's doc comments into `native.d.ts`, so the
generated declarations change with them.

Only comments and the README's prose change. No code, name, message or
code example does.

Refs #1803.
@coderdan coderdan self-assigned this Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

@coderdan

Copy link
Copy Markdown
Contributor Author

Folded into the rewritten stack: the Label check is gone from #1774 on, RecordPlan derives Debug in #1776, and the plain-language docs are in each PR. #1803 is now closed by #1776. Previous head: 0df27f1. The branch is kept.

@coderdan coderdan closed this Nov 24, 2026
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