Uh oh!
There was an error while loading. Please reload this page.
refactor(plugin-sharing): put the shared logger contract on the precise signature - #11236
Conversation
…se signature Spell OptionalSharingLogger's members as a string message plus an optional Record of string keys to any values, and absorb sharing-rule-provenance.ts onto the shared type instead of a seventh local MinimalLogger. The shared shape shipped with the loose (msg: any, ...rest: any[]) spelling inherited from the two byte-identical declarations it replaced. That spelling documents nothing and catches nothing -- the same complaint this card levels at bare Function -- so the third module was unified onto the strict spelling it already declared, rather than the reverse. Caller cost is zero: every caller passes ctx.logger as any, or undefined. All 12 in-module call sites already pass exactly (string, object?). check:optional-error-sink membership is unchanged: 37 / 12 / 23 / 2, still 2 baselined. record-orphan-cleanup.ts's bare-Function members stay untouched -- tightening them moves that gate's population and remains open on #10692. Part of #10692 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01APWX2AwT3a4xDcjPCe8bk4
📓 Docs Drift Check2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ✅ What this run could not see
Coarse fallback — 8 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin af6c48ecfed30cf3aa1bbd714ffb1045a48e5344 && git checkout af6c48ecfed30cf3aa1bbd714ffb1045a48e5344
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 38cf397ea9b1b5aea338805e7559f70576b88fb1 8a680a46ae4a037e40fc7b9e018f38aa77791a53 && git checkout -B drift-repro 38cf397ea9b1b5aea338805e7559f70576b88fb1 && git merge --no-ff 8a680a46ae4a037e40fc7b9e018f38aa77791a53
node scripts/docs-audit/affected-docs.mjs --json 38cf397ea9b1b5aea338805e7559f70576b88fb1 |
Uh oh!
There was an error while loading. Please reload this page.
Part of #10692
Implements option B, the remainder ruled in comment
5381088451after PR #11068 landed the first half of this card.Recordparameterised with string keys and any values was truncated to a bareRecord, in table cells, in inline backticks and inside a fenced code block. Because this change is a change of member signatures, each one below is stated in words as well as in code.What changed
OptionalSharingLoggerinlogger-shapes.tsshipped with the loose spelling, inherited from the two byte-identical declarations PR #11068 collapsed into it. Its two members are now spelled precisely.msgtyped asany, followed by a rest parameterrestofanyarray, returning void.msgtyped asstring, plus an optional second parametermetatyped as a Record ofstringkeys toanyvalues, returning void.In code (expect the type arguments to be eaten on publish):
sharing-rule-provenance.ts— which already declared exactly that stricter signature under its own localMinimalLogger— now imports the shared type instead of declaring a seventh copy. Its local interface is deleted.Why the precise spelling, and not the loose one
Unifying on the loose spelling was the cheaper diff and was rejected. It would have deleted the checking
sharing-rule-provenance.tsalready had. A message typedanywith ananyrest parameter documents nothing and catches nothing — which is the identical complaint this card levels at bareFunction. Adopting it to buy uniformity would be the card fixing itself by becoming the thing it filed against.Taking the strict spelling instead tightens the two modules already on the shared type, and buys real arity and type checking at all 12 in-module call sites (7
warn, 5info) — every one of which already passes exactly a string message plus an optional object literal.Caller cost: zero, re-verified rather than inherited
Every caller of the affected binders passes
ctx.logger as anyorundefined, so no caller constrains the signature:sharing-plugin.ts:565bindPrimaryBuHooksctx.logger as anysharing-plugin.ts:566backfillPrimaryBuctx.logger as anysharing-plugin.ts:722bindBusinessUnitTreeRecomputectx.logger as anysharing-plugin.ts:732bindRuleProvenanceStampctx.logger as anybu-tree-recompute.test.ts(4 sites)undefinedsharing-rule-provenance.test.ts:172The object literals at
bu-tree-recompute.test.ts:442and:460are the rules service (2nd parameter), not the logger.⭐ The load-bearing check: gate membership is unchanged
check:optional-error-sink(#9754) came back with its population and verdict lines byte-identical, exit 0 both sides:The gate computes its own population and scores
silentfor every card, sodispatch-gates.mjsis structurally incapable of naming it. It was run by hand, before and after.One informational line moved, diagnosed rather than papered over. The narrowings tally
pure sink(s) declare no error at allwent 59 → 58. Predicted in writing beforehand as exactly −1, and the cause verified by positive control:errorfollowed by an optional?and then a colon or open-paren;sharing-rule-provenance.tspasses that prefilter (its warn call site spells anerrorkey), so its deleted local interface was one of the 59 → −1;logger-shapes.tsfails the prefilter and so contributes 0 — verified by injecting a comment that trips the prefilter, which moved the tally to 59 while population and verdict stayed identical, then restoring byte-identically.Proof the compiler was actually watching
A green typecheck that would have been green anyway is not a measurement. Ablation, with the diagnostic predicted in writing first: mutate the shared
warnmember's second parameter to a requirednumber.Predicted: 7 errors, all TS2345, exit 2 — 3 in
bu-tree-recompute.ts, 3 inprimary-bu-projection.ts, 1 insharing-rule-provenance.ts.Observed: exactly that.
The load-bearing part is that
sharing-rule-provenance.tsis among them: that is what proves it now consumes the shared declaration rather than a local copy, i.e. that option B actually landed.Rebuild note, stated rather than boilerplated: this ablation needs no
distrebuild and none was done — the mutated file and all three consumers sit in one package compiled by a singletsc --noEmitprogram from source, so nothing resolves throughdist/. The 7 diagnostics are themselves the proof the mutation reached the compiler. The dependency closure was built beforehand, so the TS2307 cascade trap does not apply. The mutation was confirmed on disk by anchored grep (an editor exit code proves nothing), and both mutation scripts carried atrap ... EXIT INT TERMrestore.Restore proved byte-identical by
git hash-object(beb0ac13…both sides) and re-run to a real verdict: typecheck exit 0, 0 errors, tree clean.⛔ Deliberately untouched
record-orphan-cleanup.ts's bare-Functionmembers stay as they are. Tightening them requires first tightening two publicly exported option types,SharingServiceOptionsandShareLinkServiceOptionsloggers — measured to move this gate from 37/2-red to 39/4-red and fail it. That is question 2 on #10692, sequenced behind #11069 and then a maintainer breaking-change call. #10692 stays open for it, which is why this PR saysPart of.Verification
All exit codes captured before any pipe; every verdict below is the gate's own printed line. Run on the final commit
8a680a46ae, clean tree.pnpm --filter @objectstack/plugin-sharing typecheck— exit 0, 0 errors, before and after (one echoed script line, so not a zero-match filter)pnpm --filter @objectstack/plugin-sharing test—Test Files 25 passed (25),Tests 624 passed (624), exit 0pnpm check:optional-error-sink— exit 0 both sides, population and verdict byte-identicalnode scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack, no hand-supplied paths, on the final commit: 12 families + 1 convention-triggered, all green.check:i18nfirst returnedPREREQUISITE NOT MET … Nothing was checkedat exit 1. Treated as NOT MEASURED, never a pass: built the CLI and re-ran to the real verdict —check-i18n-bundles: OK (9 package(s) …),plugins/plugin-sharing in sync (4 bundle(s)), exit 0.--format json, 0 errors / 0 warnings, neither ignored; the repo runs oneeslint.config.mjswhich never enables type-aware linting for any file (its own comment records the positive control), so this diff cannot move the verdict of any untouched file. The repo-wide sweep remains CI's run.pnpm check:nul-bytesgreen, plus a manual control-character grep over the changed files and this body.Generated by Claude Code
Generated by Claude Code