test(core): pin the secret-redaction escape hatch (and compact) to the root barrel - #747
Open
rejifald wants to merge 1 commit into
Open
test(core): pin the secret-redaction escape hatch (and compact) to the root barrel#747rejifald wants to merge 1 commit into
compact) to the root barrel#747rejifald wants to merge 1 commit into
Conversation
rejifald
force-pushed
the
claude/exciting-lovelace-662ab5
branch
2 times, most recently
from
August 16, 2026 14:50
6e8b112 to
0b927b5
Compare
…the root barrel `public-api-surface.spec.ts` exists so an accidental removal or rename of a documented value export can't slip past the suite, but four exports it was supposed to cover were never in `FUNCTIONS`: - `registerSecretKey` / `isSecretKey` / `redactSecretsDeep` — the trace-redaction escape hatch. ADR 0021's export table deliberately keeps all three on the ROOT when the auth surface moved to `stitchapi/auth`, and `@stitchapi/query-core` imports `isSecretKey` from this barrel to extend the denylist with header names rather than fork a parallel list that would drift. The pin is load-bearing today, not hypothetical. - `compact` — found by sweeping the same defect class (a public value export on the barrel with nothing pinning it) across every export of `src/index.ts`. The `compact` hits in the stream specs are the unrelated internal stream-buffer compaction, so nothing covered it. Each entry carries a comment explaining why the symbol is public, mirroring what's already written above the `duration`/`size`/`rate` token grammars. Diffed all root value exports against `FUNCTIONS`, the `systemClock` shape test, the error-class test and the surface-id test: those four were the only gaps, and everything on the barrel is now covered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
rejifald
force-pushed
the
claude/exciting-lovelace-662ab5
branch
from
August 16, 2026 15:10
0b927b5 to
ab46848
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
public-api-surface.spec.tsexists for one reason, stated in its own header:smoke.spec.tsexercises
stitchend-to-end, but nothing pins the export surface itself, so an accidentalremoval or rename of a public symbol slips past the suite and is caught only by attw/build, late.
Four documented value exports of the root barrel were never in
FUNCTIONS, so the guard did notcover them.
What this does
Adds them, each with a comment in the file's existing style explaining why the symbol is public —
mirroring what is already written above
parseDuration/parseBytes/parseRate.registerSecretKeystart.url, OTLPurl.full,input.query). The escape hatch for a credential the built-in set/stems don't catch.isSecretKeyredactSecretsDeep.inspect({ redact })hands the caller.compactexactOptionalPropertyTypescompanion — config authoring under that flag otherwise needs the...(key !== undefined ? { key } : {})spread dance at every call site.The trio is placed after the OTLP block and
compactafter the parsers, matchingsrc/index.tsordering.
Why the secret-redaction trio in particular
Two things make this pin load-bearing rather than hypothetical:
as
stitchapi→stitchapi. Keeping them on the root was an explicit decision when the authsurface moved to
stitchapi/auth, even thoughapiKey({ in: 'query', name })— which lives onthe subpath now — is what registers into them automatically.
@stitchapi/query-coreimportsisSecretKeyfrom thisbarrel (
packages/query-core/src/index.ts:19) to extendthe denylist with header names, rather than fork a parallel list that would drift. That is the
same peer-package argument the parsers' comment already makes.
The fourth one — a sweep, not the original ask
The task named three. The defect class is "a public value export on the root barrel with nothing
pinning it", so I diffed every value export of
src/index.tsagainst everything the speccovers:
FUNCTIONS, thesystemClockshape test, the error-class test, and thehttpSurface/graphqlSurfaceid test.compact(src/index.ts:82) was the fourth gap and had nodedicated spec either — the
compacthits instream.spec.ts/json-stream-buffer.spec.tsarethe unrelated internal stream-buffer compaction, not this export. Fixed here rather than left
as follow-up work.
Those four were the only gaps; everything on the barrel is now covered.
Reviewer notes
bundle-advertised-sizetether is unaffected.expect(typeof api[name]).toBe('function')fails onundefinedthe moment an export is removed or renamed, which is exactly the event this fileguards.
apps/docs/content/docs/reference/helpers.mdxhas no "Secret redaction" section (its headings runTransport / Tracing & OTLP / Store), and the names appear nowhere under
apps/docs/. They arepublic API on ADR 0021's authority and query-core's import, not on the docs site's. That is the
known root-barrel-exports-without-a-reference-page gap and belongs in its own docs PR.
Verification
pnpm testinpackages/core: 169 files / 1578 tests passed.--reporter=verbose), not silently skip.check:lintclean across 37 packages,check:typesacross all 39 workspace projects.
🤖 Generated with Claude Code