fix(sharing): address xhigh code-review findings on harness sharing#151
Merged
Conversation
Follow-up fixes from a recall-mode review of the harness-sharing feature (#146). Correctness: - editSharedHarness: a less-trusted editor could BLANK the owner's name/ model by saving an empty field (only an upper bound existed). Empty/ whitespace name/model are now ignored, and the Edit dialog disables Save when either is empty. - harnesses.remove: cascade-delete the harness's harnessShareGrants. Orphaned grants were un-revokable (revoke re-asserts ownership via the now-deleted harness) and a stale public token kept resolving to a dangling id. - publicHarnessProjection.hasAuth: derive from authType (!= "none") instead of Boolean(authToken) — oauth/tiger_junction servers DO require auth but keep their secret off the harness row, so the viewer wrongly showed "no auth". - share-harness viewer: guard requestClone with an in-flight ref so the manual Clone button + auto-resume effect can't create two clones; clear the pending clone intent on the owner-redirect path so it doesn't linger for its TTL. - /harnesses: wrap the synchronous sessionStorage access in the claim effect in try/catch (a sandboxed/partitioned context threw and broke the page); and don't flash EmptyState while the incoming-shares query is still in flight. Cleanup: - listMySharedHarnesses now sorts newest-first, matching the adjacent listMySharedConversations on the Manage Sharing page. - editSharedHarness: drop the unused `grantId` arg (authz is resolved via the bound grant), which falsely implied the edit was grant-scoped. Adds regression tests for the empty-field guard and the remove cascade.
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.
Follow-up fixes from an extra-high-effort (
/code-review xhigh) recall-mode review of the harness-sharing feature merged in #146. Nine finder angles → per-finding verification → sweep surfaced these; duplicates and non-triggerable/intentional-parity items were dropped.Correctness
name/modelby clearing the field and saving (only an upper bound was enforced). Empty/whitespacename/modelare now ignored server-side, and the Edit dialog disables Save when either is empty.harnessShareGrantsrows behind. They were un-revokable (revoke re-asserts ownership via the now-deleted harness) and a stale public token kept resolving to a dangling id.removenow cascade-deletes the grants.hasAuthmislabeled —publicHarnessProjection.hasAuthwasBoolean(authToken), butoauth/tiger_junctionservers DO require auth while keeping their secret off the harness row, so the public viewer showed no "requires auth" badge for them. Now derived fromauthType !== "none"(leaks nothing new —authTypeis already in the projection).isPendingpropagated, creating two "Copy of X" harnesses.requestCloneis now guarded by an in-flight ref./harnessesclaim effect read/wrotesessionStorageoutside any try/catch; a sandboxed/partitioned context (Safari private mode, embedded iframe) threw synchronously and broke the page. Now guarded.Polish
/harnessesno longer flashes the empty state while the incoming-shares query is still in flight (it often resolves afterharnesses.list).sessionStoragefor its TTL.listMySharedConversationson the Manage Sharing page.grantIdarg oneditSharedHarness(authz is resolved via the bound grant; the arg falsely implied a grant-scoped edit).Deliberately skipped (noted, not fixed)
ensureHarnessPublicLinkrefreshes owner name/avatar toundefinedwhen called without a profile — intentional parity with chat-share's documented "refresh snapshot on re-open"; not a divergence worth introducing.lastAccessedAtonly bumped on clone, not view — no UI surfaces the field today; pure naming/semantic, no wrong output.conversations.removehas the same orphaned-shareGrants omission — real, but out of scope for this harness-sharing PR (different feature).Validation
check-types✓, 218 tests ✓ (+2 regression tests: empty-field guard, remove cascade)tsc21/21 baseline (no new errors in touched files) ✓, 239 tests ✓