Repository navigation
fix(profiles): the last 11 envelope mismatches, and one live bug among them - #750
Merged
Merged
Conversation
Contributor
📊 Performance Benchmark Results |
…g them Clears BASELINE_MISMATCHES to empty. Nine were real and are fixed in Scaffald/sdk#30; two were this test's own false positives. **Seven declared the payload against a route that wraps** — apiKeys.update, apiKeys.getUsage, connections.accept, connections.send, engagement.track, follows.followJob, follows.followUser. They now unwrap, as 39 other methods in the SDK already do, rather than widening the signature. That is the fix that makes callers work rather than merely type-check: useUpdateApiKeyMutation already declares `UseMutationOptions<ApiKey, …>`, so the hook, the screens and the type were all right and only the runtime value was wrong. **Two declared an envelope their route does not send,** and this one was live. personalityAssessments.getStatus and getIPIPStatus declared `{ data: … }`; probed against the running api, both routes answer bare. So every consumer reading `status?.data` was reading undefined: PersonalityAssessmentWidget.tsx const assessment = assessmentData?.data usePersonalityAssessment.ts const assessment = assessmentData?.data useAssessmentStatus.ts cast through `{ data?: … }` to compile All three corrected here. A fourth, LuscherTestWizard.tsx, already carried the workaround *and the diagnosis* — "SDK type declares { data: AssessmentStatus } but API returns AssessmentStatus directly", with a `??` fallback that made that one screen work while the other three silently did not. Now that the type is right, the fallback goes too. Typecheck found that fourth site on its own once the declaration stopped lying, which is the argument for fixing the type rather than the call sites. **Two were the guard's false positives.** auth.getUserRoles and jobs.officeDuplicateJob do unwrap, through spellings the detector did not recognise: return { roles: response.data.roles } // reshapes while unwrapping .then((res) => res.data) const response = (await this.get<…>(p)) as {…} // parenthesised cast Detection is now precise about the thing that matters: find the name the response is bound to, then ask whether the body reads `.data` off it. Widening it that way first hid four real unwraps in background-checks and feedback, because the binding regex did not allow the parenthesised form — caught by the baseline's own stale check, which is what that half of the guard is for. Re-attacked after the change, since a too-permissive detector would mask the class it exists to catch: reverting engagement.track to its pre-fix form is still reported as "sdk says bare, route says wrapped", and legitimate unwrapping is still not flagged. Also runs deno fmt over three files this branch does not otherwise touch — __tests__/lib/profile-visibility.test.ts, __tests__/routes/public-profile-sections.test.ts and routes/profile-widgets.ts, all from #748. They fail `Lint REST API Code` on main, and formatting them makes that check pass rather than fail less. scf-core typecheck and its 1151 tests pass; deno fmt and lint clean; the contract directory is 9/9. Closes #744 Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
force-pushed
the
claude/744-fix-11
branch
from
September 11, 2026 21:25
9b7f78f to
ccd521f
Compare
Contributor
📊 Performance Benchmark Results |
3 tasks
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.
Closes #744.
BASELINE_MISMATCHESgoes to empty.Nine were real and are fixed in Scaffald/sdk#30 (merged); two were the guard's own false positives.
Seven declared the payload against a route that wraps
apiKeys.update,apiKeys.getUsage,connections.accept,connections.send,engagement.track,follows.followJob,follows.followUser.They unwrap now — as 39 other methods in the SDK already do — rather than widening the signature. That is the fix that makes callers work rather than merely type-check:
The hook, the screens and the declared type were all right. Only the runtime value was wrong.
Two declared an envelope their route does not send — and this one was live
personalityAssessments.getStatusandgetIPIPStatusdeclared{ data: … }. Probed against the running api, both answer bare. So every consumer readingstatus?.datahas been readingundefined:PersonalityAssessmentWidget.tsxconst assessment = assessmentData?.datausePersonalityAssessment.tsconst assessment = assessmentData?.datauseAssessmentStatus.ts{ data?: … }purely to compileAll three corrected here.
A fourth,
LuscherTestWizard.tsx, already carried the workaround and the diagnosis:That
??fallback is why one screen worked while the other three silently did not. Someone hit this, diagnosed it correctly, and patched it locally. Now that the type is right, the fallback goes too.Typecheck found that fourth site on its own once the declaration stopped lying — which is the whole argument for fixing the type rather than the call sites.
Two were the guard's false positives
auth.getUserRolesandjobs.officeDuplicateJobdo unwrap, through spellings the detector did not recognise:Detection is now precise about the thing that matters: find the name the response is bound to, then ask whether the body reads
.dataoff it.Widening it that way first hid four real unwraps in
background-checksandfeedback, because the binding regex did not allow the parenthesised form. The baseline's own stale check caught that — which is exactly what that half of the guard is for, and a good argument for enforcing baselines in both directions.Re-attacked after the change
A too-permissive unwrap detector would mask the class the guard exists to catch, so I re-ran the probes:
engagement.trackto its pre-fix formVerified
scf-coretypecheck and its 1151 tests pass;deno fmt --checkanddeno lintclean; contract directory 9/9.Closes #744