profile
viewpoint

gbrik/expert-iteration 6

Modular reimplementation of the expert iteration method described in the AlphaGo Zero paper.

gbrik/about 0

Sourcegraph blog, feature announcements, and website (about.sourcegraph.com)

gbrik/crisis 0

Web app to track and display troop movements in an artificial military conflict, written in Go, JS and Postgres.

gbrik/gogs 0

Gogs is a painless self-hosted Git service

gbrik/haskell-compiler 0

A very WIP Haskell to LLVM compiler.

gbrik/helm 0

The Kubernetes Package Manager

gbrik/linux-config 0

Scripts and such for installing my typical Linux set up.

gbrik/llvm-project 0

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.

create barnchsourcegraph/sourcegraph

branch : garo-eroc/incremental-indexing-mvp

created branch time in 3 days

issue commentsourcegraph/sourcegraph

Code Intelligence 3.19 Tracking issue

Completed 2020/07/31

Spent my heads down time on lsif-clang. Debugged Beyang's issue running the indexer on Ubuntu 18.04, but was unable to repro. Debugged user issue running the indexer in their dev environment. Narrowed down the cause, but can't attempt to directly repro so going to have to guess at the issue and try out fixes that way. Also can't directly repro the macos issue eric and mimi are hitting on my partner's mac, but it's a really old macbook air, so waiting on Aida to set up an old mac I can ssh into to test.

Other time was spent in meetings/code review. More than half my time was spent on this, which is not necessarily bad, just want to track it since I think balancing this has been the hardest part of working part time.

Planned 2020/08/03

Make as much progress as possible on lsif-clang: poke beyang, research user issue, debug in the macos ssh env when it's set up.

Make code intel survey releasable (even if we don't actually push it through any channels yet): create a draft google survey, get a round of feedback on it, make a final survey.

Start the incremental indexing prototype with eric: schedule a time to pair on this.

efritz

comment created time in 4 days

push eventsourcegraph/lsif-clang

Garo Brik

commit sha 961cb978cc31deda5aff43a5583e32ceb7eb5c12

add debug flag

view details

push time in 7 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Update store to target new nearest upload tables

 func (api *codeIntelAPI) FindClosestDumps(ctx context.Context, repositoryID int, 	return dumps, nil } -// updateCommits updates the lsif_commits table with the current data known to gitserver, then updates the-// visibility of all dumps for the given repository.-func (api *codeIntelAPI) updateCommitsAndVisibility(ctx context.Context, repositoryID int, commit string) error {+// updateCommitGraph will perform an update of the given repository's commit graph if it appears to be out+// of date. If we know already know about this commit, we do not perform an update. Otherwise, it is likely+// that a user is browsing a commit that was pushed after commit that owns the last index we processed. If+// the repository has no index data at all, we skip the update and return false as there would be no useful+// information available in the commit graph.+func (api *codeIntelAPI) updateCommitGraph(ctx context.Context, repositoryID int, commit string) (bool, error) { 	commitExists, err := api.store.HasCommit(ctx, repositoryID, commit) 	if err != nil {-		return errors.Wrap(err, "store.HasCommit")+		return false, errors.Wrap(err, "store.HasCommit") 	} 	if commitExists {-		return nil+		return true, nil 	} -	newCommits, err := api.gitserverClient.CommitsNear(ctx, api.store, repositoryID, commit)+	repositoryExists, err := api.store.HasRepository(ctx, repositoryID) 	if err != nil {-		return errors.Wrap(err, "gitserverClient.CommitsNear")+		return false, errors.Wrap(err, "store.HasRepository") 	}-	if err := api.store.UpdateCommits(ctx, repositoryID, newCommits); err != nil {-		return errors.Wrap(err, "store.UpdateCommits")+	if !repositoryExists {+		return false, nil 	} -	tipCommit, err := api.gitserverClient.Head(ctx, api.store, repositoryID)-	if err != nil {-		return errors.Wrap(err, "gitserverClient.Head")-	}-	if err := api.store.UpdateDumpsVisibleFromTip(ctx, repositoryID, tipCommit); err != nil {-		return errors.Wrap(err, "store.UpdateDumpsVisibleFromTip")+	// If we are not aware of this commit, we need to update our commits table and the+	// visibility of the dumps in this repository.+	if err := api.commitUpdater.Update(ctx, repositoryID, func(ctx context.Context) (bool, error) {+		return api.store.HasCommit(ctx, repositoryID, commit)+	}); err != nil {

i'm confrazzled: my understanding of what these lines do is that we acquire a lock on the commits table, and once that lock is acquired check if the given commit is in the table, and if it's not in the table do nothing. but if it's not in the table don't we need to update? i feel like this boolean should be negated but am not entirely sure what's going on

efritz

comment created time in 9 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Add commit updater utility

+package commits++import (+	"context"++	"github.com/pkg/errors"+	"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/gitserver"+	"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/store"+)++// Updater calculates, denormalizes, and stores the set of uploads visible from every commit+// for a given repository. A repository's commit graph is updated when we receive code intel+// queries for a commit we are unaware of (a commit newer than our latest LSIF upload), and+// after processing an upload for a repository.+type Updater interface {+	// Update pulls the commit graph for the given repository from gitserver, pulls the set of+	// LSIF upload objects for the given repository from Postgres, and correlates them into a+	// visibility graph. This graph is then upserted back into Postgres for use by find closest+	// dumps queries.+	//+	// This method will block until an advisory lock can be acquired to give exclusive access+	// to the update procedure for this repository. If a check function is supplied, it is called+	// after acquiring the lock but before updating the commit graph. This can be used to check+	// that an update is still necessary depending on the triggering conditions. Returning false+	// from this function will cause the function to return without updating. A null function can+	// be passed to skip this check.+	Update(ctx context.Context, repositoryID int, check CheckFunc) error++	// Update pulls the commit graph for the given repository from gitserver, pulls the set of

typo: Update -> TryUpdate

efritz

comment created time in 9 days

issue openedsourcegraph/sourcegraph

update lsif.dev

created time in 11 days

issue commentsourcegraph/sourcegraph

Bazel support roadmap

hey @iangudger, garo from the intel team again! Specifically for C++, there is an existing tool (https://github.com/grailbio/bazel-compilation-database) which can be used to generate compilation databases for Bazel-based projects. These compilation databases can be consumed by our newly released tool lsif-clang tool to produce LSIF indexes.

I haven't yet tested this integration, but based on your comment I scheduled some time in the next month to investigate a little, and I'll get back to you then to let you know what I learned! You're of course welcome to tinker with the two tools in the meantime, I suspect they may work well together out of the box due to Bazel's inclination towards sandboxing.

sqs

comment created time in 21 days

push eventsourcegraph/code-intel-extensions

garo (they/them)

commit sha f4c51a953d64f67cf98ab639a269180f3eea9e20

hover source code intel tooltips (#423) * dummy * add code intelligence source alerts to the code intel extensions * make code intelligence source alerts language aware * improve structure * style fixes * bump sg version * bump extension-api-stubs * yarn deduplicate * yarn update-graphql-schema * hover text -> hover data

view details

push time in 22 days

delete branch sourcegraph/code-intel-extensions

delete branch : garo/code-intel-tooltips

delete time in 22 days

PR merged sourcegraph/code-intel-extensions

hover source code intel tooltips team/code-intelligence

TODO: update package.json to point to new sourcegraph extension API when it's published.

product: see the new hoverAlerts.ts file if all you're interested in is the text. you can see what the alert will actually look like on https://github.com/sourcegraph/sourcegraph/pull/12123. I want to make the alerts for search and lsp-based results not dismissible when a robust LSIF indexer is available for the languages, but open to pushback if you think that's too obnoxious.

+243 -93

0 comment

11 changed files

gbrik

pr closed time in 22 days

push eventsourcegraph/code-intel-extensions

Garo Brik

commit sha 875714cd1685bef2db2f55583bac659179bbc417

hover text -> hover data

view details

push time in 22 days

Pull request review commentsourcegraph/code-intel-extensions

hover source code intel tooltips

+import * as sourcegraph from 'sourcegraph'++export const HoverAlerts = {+    LSIF: <sourcegraph.Badged<sourcegraph.HoverAlert>[]>[+        {+            summary: {+                kind: sourcegraph.MarkupKind.Markdown,+                value:+                    'Semantic result. [Learn more.](https://docs.sourcegraph.com/user/code_intelligence/lsif)',+            },+            badge: {+                kind: 'info',+                hoverMessage:+                    "This hover text comes from a pre-computed semantic index of this project's source. Click to learn how to add this capability to all of your projects!",

I went with 'hover data', symbol information is too specific, and the hovers in general could contain content other than text.

gbrik

comment created time in 22 days

push eventsourcegraph/code-intel-extensions

Eric Fritz

commit sha baadec694cc705b5b32665f38e891ce47e37211e

Fix undefined property in introspection query (#424)

view details

Eric Fritz

commit sha eb940b336857052c8a990a5ec23ebab6b34625a3

Fallback on empty hover (#425)

view details

Garo Brik

commit sha c8700b4ef60608c0c1c6bb1a6bdd87e577748ae5

Merge branch 'master' into garo/code-intel-tooltips

view details

Garo Brik

commit sha 57366b869a8fb850dcde0add767edfe6ea9bd637

yarn update-graphql-schema

view details

push time in 22 days

push eventsourcegraph/code-intel-extensions

Garo Brik

commit sha 0c29f6f750fffd5ff492aa2ea7ab3d092cafe6d9

yarn deduplicate

view details

push time in 22 days

push eventsourcegraph/code-intel-extensions

Garo Brik

commit sha 4b994f4c3fe3394253bb5bd3988f6f1a89ee1079

bump extension-api-stubs

view details

push time in 22 days

push eventsourcegraph/code-intel-extensions

Garo Brik

commit sha aa63937151023ab70157b30ab838002a51178f9e

bump sg version

view details

push time in 22 days

push eventsourcegraph/sourcegraph

garo (they/them)

commit sha 16bee624393a346da1aa0ac40a25425d115d1ea8

bump extension api version (#12224)

view details

push time in 22 days

delete branch sourcegraph/sourcegraph

delete branch : bump-extension-api

delete time in 22 days

PR merged sourcegraph/sourcegraph

Reviewers
bump extension api version
+1 -1

1 comment

1 changed file

gbrik

pr closed time in 22 days

PR opened sourcegraph/sourcegraph

Reviewers
bump extension api version
+1 -1

0 comment

1 changed file

pr created time in 23 days

create barnchsourcegraph/sourcegraph

branch : bump-extension-api

created branch time in 23 days

Pull request review commentsourcegraph/code-intel-extensions

hover source code intel tooltips

 export function createHoverProvider(             for await (const lsifResult of lsifProvider(textDocument, position)) {                 if (lsifResult) {                     await emitter.emitOnce('lsifHover')-                    yield lsifResult+                    if (hasPreciseResult) {+                        yield lsifResult+                    } else {+                        yield { ...lsifResult, alerts: HoverAlerts.LSIF }

The webapp does not ATM dedup alerts, so if every result has an alert on it it'll show multiple alerts. I agree there's probably a better way to do this, but not sure what it is. This is another artifact of designing through the extension API :(

gbrik

comment created time in 23 days

push eventsourcegraph/code-intel-extensions

Garo Brik

commit sha bad4f1d807c0511882de7afda58892cc4f0dc4a6

style fixes

view details

push time in 23 days

Pull request review commentsourcegraph/code-intel-extensions

hover source code intel tooltips

+import * as sourcegraph from 'sourcegraph'++export const HoverAlerts = {+    LSIF: <sourcegraph.Badged<sourcegraph.HoverAlert>[]>[

also, my style preference is to have constants start with upper case. my impression from our TS source is that types are uppercase, everything else is lowercase. is that a distinction we care about?

gbrik

comment created time in 23 days

Pull request review commentsourcegraph/code-intel-extensions

hover source code intel tooltips

+import * as sourcegraph from 'sourcegraph'++export const HoverAlerts = {+    LSIF: <sourcegraph.Badged<sourcegraph.HoverAlert>[]>[+        {+            summary: {+                kind: sourcegraph.MarkupKind.Markdown,+                value:+                    'Semantic result. [Learn more.](https://docs.sourcegraph.com/user/code_intelligence/lsif)',

There's a thread here where we were trying to brainstorm how to get this across, not much luck: https://sourcegraph.slack.com/archives/CHXHX7XAS/p1589989321162100

The text before 'Learn more.' would need to be max ~4 words for the alert to fit on one line, which I would really like.

gbrik

comment created time in 23 days

Pull request review commentsourcegraph/code-intel-extensions

hover source code intel tooltips

+import * as sourcegraph from 'sourcegraph'++export const HoverAlerts = {+    LSIF: <sourcegraph.Badged<sourcegraph.HoverAlert>[]>[+        {+            summary: {+                kind: sourcegraph.MarkupKind.Markdown,+                value:+                    'Semantic result. [Learn more.](https://docs.sourcegraph.com/user/code_intelligence/lsif)',+            },+            badge: {+                kind: 'info',+                hoverMessage:+                    "This hover text comes from a pre-computed semantic index of this project's source. Click to learn how to add this capability to all of your projects!",

other ideas:

  • 'content'/'hover content'
  • 'symbol information'

I favour 'text' because I like concision, or 'symbol information' for maximum specificity, thoughts?

gbrik

comment created time in 23 days

Pull request review commentsourcegraph/code-intel-extensions

hover source code intel tooltips

+import * as sourcegraph from 'sourcegraph'++export const HoverAlerts = {+    LSIF: <sourcegraph.Badged<sourcegraph.HoverAlert>[]>[

ahh ok, will change.

for fun: before i added the casts, i was trying to create an object with every key of type Badged<HoverAlert>[] so I didn't have to write it every time. but Record<string, Badged<HoverAlert>[]> didn't work. do you know if there's a way to do this pattern in TS? basically a Map<K, V> with compile time enforced finite Ks?

gbrik

comment created time in 23 days

Pull request review commentsourcegraph/code-intel-extensions

hover source code intel tooltips

 export function createHoverProvider(             for await (const lsifResult of lsifProvider(textDocument, position)) {                 if (lsifResult) {                     await emitter.emitOnce('lsifHover')-                    yield lsifResult+                    if (hasPreciseResult) {+                        yield lsifResult+                    } else {+                        yield { ...lsifResult, alerts: HoverAlerts.LSIF }

we're tagging only the first lsif result. is the var name confusing?

gbrik

comment created time in 23 days

push eventsourcegraph/code-intel-extensions

renovate[bot]

commit sha 0e5271dc8ed5b8305abaf9f7f74ce79ac02dfb9d

Update dependency @types/lodash to v4.14.157 (#410) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha f71b66f4b9ef2412914abbebc937b6cb7d1bf893

Update dependency eslint to ^7.3.1 (#411) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 32e3fd1251cbcb8c340b48e85b3478a5dc4ff171

Update dependency eslint to ^7.4.0 (#417) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 75d712b59ad4fe4aedcda8f7447b87931ded4eaa

Update dependency sourcegraph to ^24.6.0 (#419) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

Eric Fritz

commit sha 057464f8a4b32ed9dd9fa62c7fd11587418f5637

Add rough first-draft of document highlight provider (#409)

view details

Eric Fritz

commit sha bc26f47a607b3a4af3f93103c129a42ced92fe25

Batch LSIF queries via window resolver (#414)

view details

Eric Fritz

commit sha 29543fdc6d79da2fe4b6770c7971bb9a614092da

Update graphql schema (#420)

view details

renovate[bot]

commit sha 077d2f59de0dadf50a95a19a7f9ae1e13a6fcf99

Update dependency json-schema-to-typescript to ^9.1.1 (#418) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha b54ba382b3b84b70372552205ed8e074e5bc8d79

Update dependency yargs to ^15.4.1 (#416) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 71b61386a138a125a9c985682382e095161a87d0

Update dependency rxjs to ^6.6.0 (#415) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 614598c7a6abc261cef73bb15e015af29627dc7b

Update dependency mocha to v8 (#413) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 172ec29ba48b219d514d123817fa1361d9490755

Update dependency js-base64 to ^2.6.3 (#412) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 33387a6f7088ff06cb7c65f62561f0ab873286df

Update dependency fs-extra to ^9.0.1 (#405) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha d9dbfafef9dabc3d09dd05842381cdee32d44276

Update dependency uuid to ^8.2.0 (#403) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 7f92fb956a9b0cca197795f34597c36bcef8e4e7

Update dependency ts-node to ^8.10.2 (#402) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 2ef4afd107b26adf8da86ce839305df6ea9e7f52

Update dependency nyc to ^15.1.0 (#401) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 4acd60857c1768a197e4bd241ef8024ad9e46cdb

Update dependency codecov to ^3.7.0 (#398) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 8b306e46b0fd0fd223a39e5d23877988317779b9

Update dependency typescript to ^3.9.6 (#406) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 320d1244d7beb3b3d86eb10594872d8a474ce130

Update dependency prettier to v2 (#347) * Update dependency prettier to v2 * Run prettier. Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Eric Fritz <eric@eric-fritz.com>

view details

Eric Fritz

commit sha 71b6b763c370bb39901a83bddee98fa322860d54

Do not block on range requests (#421)

view details

push time in 23 days

push eventsourcegraph/code-intel-extensions

Garo Brik

commit sha b311e5eef1829273d4b0028afb3ee42b1705c499

improve structure

view details

push time in 23 days

PR opened sourcegraph/code-intel-extensions

Reviewers
hover source code intel tooltips team/code-intelligence

TODO: update package.json to point to new sourcegraph extension API when it's published.

product: see the new hoverAlerts.ts file if all you're interested in is the copy. you can see what the alert will actually look like on https://github.com/sourcegraph/sourcegraph/pull/12123

+193 -13

0 comment

8 changed files

pr created time in 23 days

push eventsourcegraph/code-intel-extensions

Garo Brik

commit sha 425cbfa4530131d8c1fc095932199f1e486470ec

make code intelligence source alerts language aware

view details

push time in 23 days

push eventsourcegraph/sourcegraph

garo (they/them)

commit sha 67b1c70303464e529a5ff4582f02adb47392eb15

Add extension API for hover alerts (#12123) * basic frontend structure (still need to work out styling edge cases) * fix compile errs * fix compile err * fix lint errs * styling fixes * more small styling fixes * add alert dismissals for dot-com * cleanup * fix test * respond to feedback * fix bug * respond to remaining feedback * appease linter * fix tests * fix test * small fixes * small fixes * one more small fix * fixess * update tests * add tests * fixy * make screeny be what it says * fix tests & run prettier * fix test * Import only types from sourcegraph * Preserve `<small>` style for native tooltip alert * Keep using text instead of badge * always render info badge in top right * i think this does what i want? * add comment * Simplify CSS logic * add extra check * revert check * update snapshots * Make very large alerts scroll vertically * Fix duplicate story name, add story for `<small>` text * revert null change * appease linter * prettier * Fix HTML in screenshot Co-authored-by: Felix Becker <felix.b@outlook.com>

view details

push time in 24 days

delete branch sourcegraph/sourcegraph

delete branch : garo/code-intel-tooltips

delete time in 24 days

PR merged sourcegraph/sourcegraph

Add extension API for hover alerts extensions team/code-intelligence

summary of changes:

  • expose a new 'alerts' field on hovers in sourcegraph extensions, which allows extensions to use the existing alert functionality to display non-content messages on hovers
  • render alerts using markdown instead of react fragments so they can be passed through sourcegraph extensions
  • make alerts dismissible on dot-com as well as in browser extension
  • allow badges on alerts

closes #10925 along with an upcoming code-intel-extensions PR. #10926 and #10927 require some additional backend changes which might slip.

@sourcegraph/web sorry for the late submission, but I really want to merge this before branch cut so a review today would be much appreciated! I will be adding tests later today.

image

image

image

image

+335 -155

15 comments

18 changed files

gbrik

pr closed time in 24 days

issue closedsourcegraph/sourcegraph

Create a "code intelligence source" tooltip

It should look like the Code-intel-popup-branding frame on this Figma design (which is WIP).

It should be on by default, but permanently dismissable via user-setting.

closed time in 24 days

gbrik

pull request commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

oh boy. can someone approve the screenies while I email percy's support?

gbrik

comment created time in 24 days

pull request commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

@felixfbecker I created a percy account, it told me that because percy has been acquired by browserstack, I cannot link it to my GitHub profile and must sign up through browserstack, I did that, and now the invitation link you sent me says I can't get approved onto this project if I signed up through browserstack :facepalm: :facepalm:

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 669dea664be340d3a775f6825e53c2573b56559a

prettier

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 075fed9ef24eaf174cba127ddfa28f0a5926a571

appease linter

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha afcbfc472c5054762f0ddd49034d3598ae8f0531

revert null change

view details

push time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 import { MarkupKind } from '@sourcegraph/extension-api-classes' import { Range } from '@sourcegraph/extension-api-types'-import { fromHoverMerged } from './hover'+import { fromHoverMerged, HoverMerged } from './hover'  const FIXTURE_RANGE: Range = { start: { line: 1, character: 2 }, end: { line: 3, character: 4 } }+const EMPTY_HOVER: HoverMerged = { alerts: [], contents: [] }

okie, reverting

gbrik

comment created time in 24 days

pull request commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

ok! good to go?

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 7748633c67d73f88d88af0e04f95717b3ffe60c5

update snapshots

view details

push time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 import { MarkupKind } from '@sourcegraph/extension-api-classes' import { Range } from '@sourcegraph/extension-api-types'-import { fromHoverMerged } from './hover'+import { fromHoverMerged, HoverMerged } from './hover'  const FIXTURE_RANGE: Range = { start: { line: 1, character: 2 }, end: { line: 3, character: 4 } }+const EMPTY_HOVER: HoverMerged = { alerts: [], contents: [] }

ok, apparently it can also be undefined, which is treated differently than null, but also seems to represent the empty state. for now, I'm going to leave it as is. the null case seems to never happen in practice, as I've never seen that text anywhere.

I'll update the snapshot from the css fixes you made, and then we're good to merge?

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha dc5ac8aca032268483e3be139d4c040dab4941d4

revert check

view details

push time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 import { MarkupKind } from '@sourcegraph/extension-api-classes' import { Range } from '@sourcegraph/extension-api-types'-import { fromHoverMerged } from './hover'+import { fromHoverMerged, HoverMerged } from './hover'  const FIXTURE_RANGE: Range = { start: { line: 1, character: 2 }, end: { line: 3, character: 4 } }+const EMPTY_HOVER: HoverMerged = { alerts: [], contents: [] }

I looked through again carefully, there's one case this looks like it would change, but I've never seen in trigger when using Sourcegraph. I added an extra check there to be sure.

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 5717b65012425b675abb0364e22a21aa0b0dbedc

add extra check

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 61a77c0473a66b5964eb05afda104122aa837a71

add comment

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Felix Becker

commit sha 29f8decfd36534d1a2a59f5638624ef8a3b6f74c

Import only types from sourcegraph

view details

Felix Becker

commit sha 7a85e4a6d74ce3789f1bda03150f296465377777

Preserve `<small>` style for native tooltip alert

view details

Felix Becker

commit sha f4eae0f13c88d7bc4ebc91ef19871fe925b1be4e

Keep using text instead of badge

view details

Garo Brik

commit sha 9e99e382d41c31f0711a1ae21f3331e38b07eb1a

always render info badge in top right

view details

Garo Brik

commit sha 9f8aa468bf5e839f38f78f5d063c4f14a7e21867

i think this does what i want?

view details

Garo Brik

commit sha 61a77c0473a66b5964eb05afda104122aa837a71

add comment

view details

push time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

         // stylelint-enable selector-max-compound-selectors     } +    &__alerts {+        display: flex;+        flex-direction: column;+    }     &__alert {-        padding: 0.5rem;+        padding: 0.25rem 0.5rem;         margin: 0;         border-radius: 0;         border: none;         border-bottom: 1px solid var(--border-color);++        p {

Will do.

gbrik

comment created time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 import { MarkupKind } from '@sourcegraph/extension-api-classes' import { Range } from '@sourcegraph/extension-api-types'-import { fromHoverMerged } from './hover'+import { fromHoverMerged, HoverMerged } from './hover'  const FIXTURE_RANGE: Range = { start: { line: 1, character: 2 }, end: { line: 3, character: 4 } }+const EMPTY_HOVER: HoverMerged = { alerts: [], contents: [] }

I intentionally changed it to not return null on empty, it required extra code and checks in a bunch of places and meant there were multiple ways of representing the same state.

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 9f8aa468bf5e839f38f78f5d063c4f14a7e21867

i think this does what i want?

view details

push time in 24 days

pull request commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

hrmm yeah ok let me try do it quickly

gbrik

comment created time in 24 days

pull request commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

actually I'll go with your suggestion to have the badge in the top right, dismiss in the bottom right

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 9e99e382d41c31f0711a1ae21f3331e38b07eb1a

always render info badge in top right

view details

push time in 24 days

pull request commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

oof no, I guess one starts wrapping before the other. I have an idea to fix

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 22e934d14cd9492e504cb6abda555555a8452ea1

fix test

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 22e934d14cd9492e504cb6abda555555a8452ea1

fix test

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha fec89a2d211329c185b72851d285a1a972d16907

fix tests & run prettier

view details

push time in 24 days

create barnchsourcegraph/sourcegraph

branch : garo/code-intel-tooltipss

created branch time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 9332bfb55354a07677b5b7442b93d2fdbcf43791

make screeny be what it says

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Christina Forney

commit sha 750c90ffcf65fe1bf80555ccefe8987f1c94f8b5

Fixes #12057 search example page copy edits (#12084)

view details

Felix Becker

commit sha 58124b94ad83ab3121eca9450f5fedda537bec3a

Serve mock index.html and window.context (#12091)

view details

Felix Becker

commit sha 7889886f2cd906deccc14f88f5afa18fb3c28b39

Add integration tests to CI (#12096)

view details

Simon

commit sha 4623f8c9a52da3e4d393666f6f725a9bf224f1fa

typesafe stubbing of graphQL requests for integration tests (#11983) * WIP first iteration of type generation of all queries * WIP: fixed nested list in the parser + gave operations unique names * WIP: partially migrated search tests to have typesafe responses, operations in shared is the last standing issue * refactored tests to use typechecked graphql stubbing * fixed eslint issues * runt prettier on generated sources * changed override to be a function + PR comments Co-authored-by: Marek <marekz@gmail.com> * rebased * make process fail if we have an error during extraction * added site admin activation status

view details

ᴜɴᴋɴᴡᴏɴ

commit sha 985c423d2de6eac234f2aabd6ad1b5ecfb2dbea3

gqltest: add search integration tests (#12085)

view details

Erik Seliger

commit sha f02940d197e58d0aaefdfcea7098017bb113adbd

Don't use goacc on master branch to fix coverage reporting (#12112)

view details

renovate[bot]

commit sha bccd65c0c9764f89ab5b1a871c4c5e01cba008ac

Update dependency graphql to ^14.7.0 (#11975) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

renovate[bot]

commit sha 8f01e217cdd08a5a2fc327bce53ff0c86579ba65

Update dependency json-schema-to-typescript to v9 (#12115) Co-authored-by: Renovate Bot <bot@renovateapp.com>

view details

Erik Seliger

commit sha f7abecdfb7d9d0533f1c5e2903fb291f0ce57d94

Revert original go-acc PR (#12122) * Revert "Don't use goacc on master branch to fix coverage reporting (#12112)" This reverts commit f02940d197e58d0aaefdfcea7098017bb113adbd. * Revert "ci: enable go-acc on default branch (#11887)" This reverts commit 49d50f4236e7589e7c1de9eb4a3086284d00229e.

view details

Eric Fritz

commit sha 5ba8bfa1739f364cf59a17264edaf1d18bb9f520

Bump recommended src-cli version to 3.16.0. (#12059)

view details

Asdine El Hrychy

commit sha 314584824f9bcd0def4d4d903e5f8a2eaf26a402

Revert "Delete cloning tab from the site-admin repositories page (#12043)" (#12127) This reverts commit c9224061da6a614e0e15d04c5aa057dccda45dd1.

view details

Eric Fritz

commit sha 55b594439ec50b704e934d158b111a2f47375e97

db: Add generic interoperable base store (#12056)

view details

Asdine El Hrychy

commit sha 52130ea0e92d3e653f09b5b212dae0d2ae114220

Revert "cloud: use the cloned column to filter by clone status (#11932)" (#12128) This reverts commit cab1a64cfdbe0c930cccdc9fd550e60913972b60.

view details

Felix Becker

commit sha 82f8b6d1d2e6425d2a0ae36f342dae092f139ddd

Integration test updates (#12121)

view details

Felix Becker

commit sha a1d87dc56f3a95fb8c5a1d5e895544c3b69b2d77

Use mocha directly for integration tests and move to shared/ (#12130)

view details

Keegan Carruthers-Smith

commit sha c6269100f1ca422ebc552d57800dce598aeafb2a

search: return branches to index to Zoekt (#12089) If we have version contexts enabled we will tell Zoekt to index the branches in the version context. There is a related Zoekt change to pass in the repository as well as understand the Branches field being set. Previously Zoekt was responsible for resolving HEAD. Now that we will do more than HEAD, it was easier to implement the resolving logic in Sourcegraph. This will both simplify the responsiblilities of zoekt-sourcegraph-indexserver as well as allow us to optimize patterns around resolving version context revisions. We additionally update Zoekt to tell us the repo as well as support indexing multiple branches.

view details

Robert Lin

commit sha c7b3a445962ec699571c1d4c747d16b24316e886

monitoring: improved notification timings, resolved templates (#12046)

view details

Simon

commit sha 5bff6676c09f6f37f434b55e0455686d4d6fab69

added gql response helpers for integration tests and started blob-viewer integration tests (#12135) * added gql response helpers for integration tests and started blob-viewer tests * removed "only" from test

view details

Farhan Attamimi

commit sha 1a546c86b9c10afb2627c0e1d7deea863d798126

Fix: add missing repogroup query to repogroup page search bar (#12120)

view details

Robert Lin

commit sha 63ebff7d5688868d76eff9e229b048f87b2229de

monitoring: aggregate long-term usage over 7d (#12015)

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha d36227c93a2a66ff43136e67afcc3779cb72d3e2

fixy

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha bc86bab03e109bcfbcc55a2093979cb0335ef740

add tests

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 6d11f8be90ef5c6d72ce73b22800f8ab252178af

update tests

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 5998efe37b871ba6ff7f8e2883cf5a24a038fa74

one more small fix

view details

Garo Brik

commit sha 4fb975ceee4c0c55c9fdc34e4e3d2ccd06929ee6

fixess

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 41e8dc2ebc79707046924eb7cff5e4c840aa897a

small fixes

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha b5a53a4d876db93aa12f99315b576663584d0950

small fixes

view details

push time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 add('With alert', () => (                     alerts: [                         {                             type: 'info',-                            content: (-                                <>-                                    This is a test alert. Enim esse quis commodo ex. Pariatur tempor laborum officia-                                    irure est do est laborum nostrud cillum. Cupidatat id consectetur et eiusmod Lorem-                                    proident cupidatat ullamco dolor nostrud. Cupidatat sit do dolor aliqua labore ad-                                    laboris cillum deserunt dolor. Sunt labore veniam Lorem reprehenderit quis occaecat-                                    sint do mollit aliquip. Consectetur mollit mollit magna eiusmod duis ex. Sint nisi-                                    labore labore nulla laboris.-                                </>-                            ),-                        },+                            summary: {+                                kind: MarkupKind.PlainText,+                                value:+                                    'This is a test alert. Enim esse quis commodo ex. Pariatur tempor laborum officiairure est do est laborum nostrud cillum. Cupidatat id consectetur et eiusmod Loremproident cupidatat ullamco dolor nostrud. Cupidatat sit do dolor aliqua labore adlaboris cillum deserunt dolor. Sunt labore veniam Lorem reprehenderit quis occaecatsint do mollit aliquip. Consectetur mollit mollit magna eiusmod duis ex. Sint nisilabore labore nulla laboris.',+                            },+                            dismissalType: 'test-alert-dismissalType',

yup! just getting around to comprehensive testing now. if you're happy with the code you can approve and i'll merge when i'm done. btw, how do i build and install a local version of the browser extension?

I just saw the comment on percy about small (which i apparently can't respond to on percy?). I was originally planning on using small text for everything, but feedback from design was that it was too cramped.

For entire paragraphs, small does seem more desirable. What do you think of changing the native tooltip text to something like 'GitHub native hovers hidden. dismiss (i)', and the badge can show the full text that was there before?

I guess these are conflicting use cases, one being 'tell the user this information once and disappear forever', the other a small annotation that is attached to all hovers.

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 1855f73521e43f39f5990019f1e796326bca0916

fix test

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha bd8bc487290e9e09f69d7532396cfb34a6652f82

fix tests

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha a1637ab16ba30ad4be9f732e82c3fea8a1fbde16

appease linter

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 83f333dc9be67956e1d39d8e2088f684db159b20

respond to remaining feedback

view details

push time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

         // stylelint-enable selector-max-compound-selectors     } +    &__alert-container {+        display: flex;+    }

found i can just put this on the parent element. i feel like 90% of my css woes can be solved by writing 'flex' everywhere

gbrik

comment created time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

         // Descendant selectors are needed here to style rendered markdown         // stylelint-disable selector-max-compound-selectors +        p {+            display: inline;+        }

So if I don't include this, and try to have the dismiss button float in the bottom right, then it will always appear on a second line, preventing the alert from ever being a single line. I added a comment to packages/sourcegraph-extension-api/src/sourcegraph.d.ts, does that resolve the concern?

gbrik

comment created time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha fbbcd7b83e66f729f3b1a232e02af27ac9a65652

fix bug

view details

push time in 24 days

push eventsourcegraph/sourcegraph

Garo Brik

commit sha 354ab08d3a737dc34ce363f8cf14d73393d4757b

respond to feedback

view details

push time in 24 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 export class HoverOverlay<A extends string> extends React.PureComponent<HoverOve                         // and communicate to the user we couldn't find a hover.                         <em>No hover information available.</em>                     ) : (-                        hoverOrError?.contents.map((content, index) => {-                            if (content.kind === 'markdown') {-                                try {-                                    return (-                                        <React.Fragment key={index}>-                                            {index !== 0 && <hr />}+                                    hoverOrError?.contents.map((content, index) => {+                                        if (content.kind === 'markdown') {+                                            try {+                                                return (+                                                    <React.Fragment key={index}>+                                                        {index !== 0 && <hr />} -                                            {content.badge && this.state.showBadges && (-                                                <BadgeAttachment-                                                    className="hover-overlay__badge e2e-hover-badge"-                                                    iconClassName={this.props.iconClassName}-                                                    iconButtonClassName={this.props.iconButtonClassName}-                                                    attachment={content.badge}-                                                    isLightTheme={this.props.isLightTheme}-                                                />-                                            )}+                                                        {content.badge && this.state.showBadges && (+                                                            <BadgeAttachment+                                                                className="hover-overlay__badge e2e-hover-badge"+                                                                iconClassName={this.props.iconClassName}+                                                                iconButtonClassName={this.props.iconButtonClassName}+                                                                attachment={content.badge}+                                                                isLightTheme={this.props.isLightTheme}+                                                            />+                                                        )} -                                            <span-                                                className="hover-overlay__content e2e-tooltip-content"-                                                dangerouslySetInnerHTML={{-                                                    __html: renderMarkdown(content.value),-                                                }}-                                            />-                                        </React.Fragment>-                                    )-                                } catch (error) {-                                    return (-                                        <div className={classNames(this.props.errorAlertClassName)} key={index}>-                                            {upperFirst(asError(error).message)}-                                        </div>-                                    )-                                }-                            }-                            return (-                                <span className="hover-overlay__content" key={index}>-                                    {content.value}-                                </span>-                            )-                        })-                    )}+                                                        <span+                                                            className="hover-overlay__content e2e-tooltip-content"+                                                            dangerouslySetInnerHTML={{+                                                                __html: renderMarkdown(content.value),+                                                            }}+                                                        />+                                                    </React.Fragment>+                                                )+                                            } catch (error) {+                                                return (+                                                    <div className={classNames(this.props.errorAlertClassName)} key={index}>+                                                        {upperFirst(asError(error).message)}+                                                    </div>+                                                )+                                            }+                                        }+                                        return (+                                            <span className="hover-overlay__content" key={index}>+                                                {content.value}+                                            </span>+                                        )+                                    })+                                )}                 </div>                 {hoverOrError && hoverOrError !== LOADING && !isErrorLike(hoverOrError) && hoverOrError.alerts && (                     <div className="hover-overlay__alerts">-                        {hoverOrError.alerts.map(({ content, type }) => (-                            <div-                                className={classNames('hover-overlay__alert', this.props.infoAlertClassName)}-                                key={type}-                            >-                                <div className="hover-overlay__alert-content">-                                    <small>{content}</small>-                                    <a-                                        className="hover-overlay__alert-close"-                                        href=""-                                        onClick={this.onAlertDismissedCallback(type)}-                                    >-                                        <small>Dismiss</small>-                                    </a>+                        {hoverOrError.alerts.map(({ summary, badge, dismissalType }, index) => (+                            <div className="hover-overlay__alert-container" key={index}>+                                <div+                                    className={classNames('hover-overlay__alert', this.props.infoAlertClassName)}+                                >+                                    {badge && !dismissalType &&+                                        <BadgeAttachment+                                            className="hover-overlay__badge e2e-hover-badge"+                                            iconClassName={this.props.iconClassName}+                                            iconButtonClassName={this.props.iconButtonClassName}+                                            attachment={badge}+                                            isLightTheme={this.props.isLightTheme}+                                        />+                                    }++                                    <span+                                        className="hover-overlay__content"+                                        dangerouslySetInnerHTML={{ __html: summary.kind === 'plaintext' ? summary.value : renderMarkdown(summary.value) }}+                                    />++                                    {badge && dismissalType &&+                                        <BadgeAttachment+                                            className="hover-overlay__badge e2e-hover-badge"+                                            iconClassName={this.props.iconClassName}+                                            iconButtonClassName={this.props.iconButtonClassName}+                                            attachment={badge}+                                            isLightTheme={this.props.isLightTheme}+                                        />+                                    }

I like that better in general, but think it performs worse for the specific cases of short alert messages.

  • if the alert is one line (my intention is for this to be true 99% of the time), this forces it to be two lines.
  • if the alert is two or fewer lines, dismiss is still next to the info box, but definitely disambiguated some
  • if the alert is more than two lines, it's better

The first point on its own makes me not want to do it, as it makes the alert take up twice as much visual real estate. The ambiguity can be resolved easily by hovering briefly over the info icon. Also now that I think about it, it couldn't hurt to include text explaining what the dismiss button does as well, so both impressions could be correct.

gbrik

comment created time in 24 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Batch range requests in bundle manager database

 func (db *databaseImpl) getRangeByPosition(ctx context.Context, path string, lin 	return documentData, findRanges(documentData.Ranges, line, character), true, nil } -// getResultByID fetches and unmarshals a definition or reference result by identifier.-// This method caches result chunk data by a unique key prefixed by the database filename.-func (db *databaseImpl) getResultByID(ctx context.Context, id types.ID) ([]DocumentPathRangeID, error) {-	resultChunkData, exists, err := db.getResultChunkByResultID(ctx, id)+// locations returns the locations for the given definition or reference identifiers.+func (db *databaseImpl) locations(ctx context.Context, id []types.ID) (map[types.ID][]bundles.Location, error) {+	results, err := db.getResultsByIDs(ctx, id) 	if err != nil {-		return nil, pkgerrors.Wrap(err, "db.getResultChunkByResultID")+		return nil, pkgerrors.Wrap(err, "db.getResultByID") 	}-	if !exists {-		return nil, ErrMalformedBundle{-			Filename: db.filename,-			Name:     "result chunk",-			Key:      string(id),-		}++	locationWrapper, err := db.convertRangesToLocations(ctx, results)+	if err != nil {+		return nil, pkgerrors.Wrap(err, "db.convertRangesToLocations") 	} -	documentIDRangeIDs, exists := resultChunkData.DocumentIDRangeIDs[id]-	if !exists {-		return nil, ErrMalformedBundle{-			Filename: db.filename,-			Name:     "result",-			Key:      string(id),-			// TODO(efritz) - add result chunk context+	return locationWrapper, nil+}++// getResultsByIDs fetches and unmarshals a definition or reference results for the given identifiers.+func (db *databaseImpl) getResultsByIDs(ctx context.Context, ids []types.ID) (map[types.ID][]DocumentPathRangeID, error) {+	xids := map[int]struct{}{}+	for _, id := range ids {+		xids[db.resultChunkID(id)] = struct{}{}+	}++	resultChunks := map[int]types.ResultChunkData{}+	for index := range xids {+		resultChunkData, exists, err := db.getResultChunkByID(ctx, index)+		if err != nil {+			return nil, pkgerrors.Wrap(err, "db.getResultChunkByID")+		}+		if !exists {+			return nil, ErrMalformedBundle{+				Filename: db.filename,+				Name:     "result chunk",+				Key:      fmt.Sprintf("%d", index),+			} 		}++		resultChunks[index] = resultChunkData 	} -	var resultData []DocumentPathRangeID-	for _, documentIDRangeID := range documentIDRangeIDs {-		path, ok := resultChunkData.DocumentPaths[documentIDRangeID.DocumentID]-		if !ok {+	data := map[types.ID][]DocumentPathRangeID{}++	for _, id := range ids {+		index := db.resultChunkID(id)+		resultChunkData := resultChunks[index]++		documentIDRangeIDs, exists := resultChunkData.DocumentIDRangeIDs[id]+		if !exists { 			return nil, ErrMalformedBundle{ 				Filename: db.filename,-				Name:     "documentPath",-				Key:      string(documentIDRangeID.DocumentID),+				Name:     "result",+				Key:      string(id), 				// TODO(efritz) - add result chunk context 			} 		} -		resultData = append(resultData, DocumentPathRangeID{-			Path:    path,-			RangeID: documentIDRangeID.RangeID,-		})+		var resultData []DocumentPathRangeID+		for _, documentIDRangeID := range documentIDRangeIDs {+			path, ok := resultChunkData.DocumentPaths[documentIDRangeID.DocumentID]+			if !ok {+				return nil, ErrMalformedBundle{+					Filename: db.filename,+					Name:     "documentPath",+					Key:      string(documentIDRangeID.DocumentID),+					// TODO(efritz) - add result chunk context+				}+			}++			resultData = append(resultData, DocumentPathRangeID{+				Path:    path,+				RangeID: documentIDRangeID.RangeID,+			})+		}++		data[id] = resultData 	} -	return resultData, nil+	return data, nil } -// getResultChunkByResultID fetches and unmarshals the result chunk data with the given identifier.-// This method caches result chunk data by a unique key prefixed by the database filename.+// getResultChunkByResultID fetches and unmarshals the result chunk data containing the given identifier. func (db *databaseImpl) getResultChunkByResultID(ctx context.Context, id types.ID) (_ types.ResultChunkData, _ bool, err error) {

unused according to linter

efritz

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Batch range requests in bundle manager database

 func (db *databaseImpl) getRangeByPosition(ctx context.Context, path string, lin 	return documentData, findRanges(documentData.Ranges, line, character), true, nil } -// getResultByID fetches and unmarshals a definition or reference result by identifier.-// This method caches result chunk data by a unique key prefixed by the database filename.-func (db *databaseImpl) getResultByID(ctx context.Context, id types.ID) ([]DocumentPathRangeID, error) {-	resultChunkData, exists, err := db.getResultChunkByResultID(ctx, id)+// locations returns the locations for the given definition or reference identifiers.+func (db *databaseImpl) locations(ctx context.Context, id []types.ID) (map[types.ID][]bundles.Location, error) {

nit: ids

efritz

comment created time in 25 days

push eventsourcegraph/lsif-clang

Garo Brik

commit sha 833b78cb5b2ef773dd74725f1bae9af625849a59

remove atomic lib

view details

push time in 25 days

push eventsourcegraph/lsif-clang

Garo Brik

commit sha 1378fdffb03327af004e3413837f1fa137192f8b

more manual tree-shaking

view details

push time in 25 days

push eventsourcegraph/lsif-clang

Garo Brik

commit sha e33049783127d8e1e680aa725c9bfd7e8b6612bd

remove links to clang-tidy

view details

push time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Run workers concurrently

 func (w *Worker) dequeueAndProcess(ctx context.Context) (_ bool, err error) {  	log15.Info("Dequeued upload for processing", "id", upload.ID) -	// TODO - same for janitors/resetters-	if requeued, processErr := w.processor.Process(ctx, store, upload); processErr == nil {-		if requeued {-			log15.Info("Requeueing upload", "id", upload.ID)-		} else {-			log15.Info("Processed upload", "id", upload.ID)-		}-	} else {-		// TODO(efritz) - distinguish between correlation and system errors+	requeued, processErr := w.processor.Process(ctx, store, upload)+	if processErr != nil { 		log15.Warn("Failed to process upload", "id", upload.ID, "err", processErr)  		if markErr := store.MarkErrored(ctx, upload.ID, processErr.Error()); markErr != nil {-			return true, errors.Wrap(markErr, "store.MarkErrored")+			return errors.Wrap(markErr, "store.MarkErrored") 		}++		return nil 	} -	return true, nil+	if requeued {+		log15.Info("Requeueing upload", "id", upload.ID)+	} else {+		log15.Info("Processed upload", "id", upload.ID)+	}++	return nil+}++// reserveProcessorRoutine blocks until there is room for another processor routine+// to start. This method returns false if the context is canceled before a blocking+// processor has finished. If this method returns true, releaseProcessorRoutine must+// be called at the end of the processor function, or the worker will leak capacity.+func (w *Worker) reserveProcessorRoutine(ctx context.Context) bool {

mmm I see. fine for now then.

efritz

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Run workers concurrently

 func (w *Worker) Stop() { 	}) } -// TODO(efritz) - use cancellable context+// dequeueAndProcess selects a queued upload record to process. This method returns false+// if no such method can be dequeued and returns an error only on failure to dequeue a new+// record (no processor errors are bubbled up past this point).+func (w *Worker) dequeueAndProcess(ctx context.Context) (dequeued bool, err error) {+	if !w.reserveProcessorRoutine(ctx) {+		return false, nil+	}+	defer func() {+		if !dequeued {+			// Ensure we release the processor routine back to the+			// pool if we did not start a new one.+			w.releaseProcessorRoutine()+		}+	}()++	maxSize := 0+	if w.budgetMax > 0 {+		if w.budgetRemaining <= 0 {+			return false, nil+		} -// dequeueAndProcess pulls a job from the queue and processes it. If there-// were no jobs ready to process, this method returns a false-valued flag.-func (w *Worker) dequeueAndProcess(ctx context.Context) (_ bool, err error) {-	upload, store, ok, err := w.store.Dequeue(ctx)-	if err != nil || !ok {+		maxSize = w.budgetRemaining+	}++	// Select a queued upload to process and the transaction that holds it+	upload, store, ok, err := w.store.Dequeue(ctx, maxSize)+	if err != nil { 		return false, errors.Wrap(err, "store.Dequeue") 	}+	if !ok {+		return false, nil+	}++	size := 0+	if upload.UploadSize != nil {+		size = *upload.UploadSize+	}++	w.budgetRemaining -= size

SGTM

efritz

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Run workers concurrently

 func (w *Worker) dequeueAndProcess(ctx context.Context) (_ bool, err error) {  	log15.Info("Dequeued upload for processing", "id", upload.ID) -	// TODO - same for janitors/resetters-	if requeued, processErr := w.processor.Process(ctx, store, upload); processErr == nil {-		if requeued {-			log15.Info("Requeueing upload", "id", upload.ID)-		} else {-			log15.Info("Processed upload", "id", upload.ID)-		}-	} else {-		// TODO(efritz) - distinguish between correlation and system errors+	requeued, processErr := w.processor.Process(ctx, store, upload)+	if processErr != nil { 		log15.Warn("Failed to process upload", "id", upload.ID, "err", processErr)  		if markErr := store.MarkErrored(ctx, upload.ID, processErr.Error()); markErr != nil {-			return true, errors.Wrap(markErr, "store.MarkErrored")+			return errors.Wrap(markErr, "store.MarkErrored") 		}++		return nil 	} -	return true, nil+	if requeued {+		log15.Info("Requeueing upload", "id", upload.ID)+	} else {+		log15.Info("Processed upload", "id", upload.ID)+	}++	return nil+}++// reserveProcessorRoutine blocks until there is room for another processor routine+// to start. This method returns false if the context is canceled before a blocking+// processor has finished. If this method returns true, releaseProcessorRoutine must+// be called at the end of the processor function, or the worker will leak capacity.+func (w *Worker) reserveProcessorRoutine(ctx context.Context) bool {+	select {+	case <-w.semaphore:+		return true+	case <-ctx.Done():+		return false+	}+}++// releaseProcessOrRoutine signals that a processor routine has finished.+func (w *Worker) releaseProcessorRoutine() {+	w.semaphore <- struct{}{}+}++// makeContext returns an internal context and a write-only channel. The context will+// be closed when the user closes the channel.+func makeContext() (context.Context, chan<- struct{}) {+	ctx, cancel := context.WithCancel(actor.WithActor(context.Background(), &actor.Actor{Internal: true}))++	done := make(chan struct{})+	go func() {+		<-done+		defer cancel()+	}()++	return ctx, done }

questions: why not return the cancel function? what does defer at the end of a func do?

efritz

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Run workers concurrently

 func (w *Worker) Stop() { 	}) } -// TODO(efritz) - use cancellable context+// dequeueAndProcess selects a queued upload record to process. This method returns false+// if no such method can be dequeued and returns an error only on failure to dequeue a new+// record (no processor errors are bubbled up past this point).+func (w *Worker) dequeueAndProcess(ctx context.Context) (dequeued bool, err error) {+	if !w.reserveProcessorRoutine(ctx) {+		return false, nil+	}+	defer func() {+		if !dequeued {+			// Ensure we release the processor routine back to the+			// pool if we did not start a new one.+			w.releaseProcessorRoutine()+		}+	}()++	maxSize := 0+	if w.budgetMax > 0 {+		if w.budgetRemaining <= 0 {+			return false, nil+		} -// dequeueAndProcess pulls a job from the queue and processes it. If there-// were no jobs ready to process, this method returns a false-valued flag.-func (w *Worker) dequeueAndProcess(ctx context.Context) (_ bool, err error) {-	upload, store, ok, err := w.store.Dequeue(ctx)-	if err != nil || !ok {+		maxSize = w.budgetRemaining+	}++	// Select a queued upload to process and the transaction that holds it+	upload, store, ok, err := w.store.Dequeue(ctx, maxSize)+	if err != nil { 		return false, errors.Wrap(err, "store.Dequeue") 	}+	if !ok {+		return false, nil+	}++	size := 0+	if upload.UploadSize != nil {+		size = *upload.UploadSize+	}++	w.budgetRemaining -= size

discussion: should we error if size == 0? is this going to OOM?

efritz

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Run workers concurrently

 func (w *Worker) dequeueAndProcess(ctx context.Context) (_ bool, err error) {  	log15.Info("Dequeued upload for processing", "id", upload.ID) -	// TODO - same for janitors/resetters-	if requeued, processErr := w.processor.Process(ctx, store, upload); processErr == nil {-		if requeued {-			log15.Info("Requeueing upload", "id", upload.ID)-		} else {-			log15.Info("Processed upload", "id", upload.ID)-		}-	} else {-		// TODO(efritz) - distinguish between correlation and system errors+	requeued, processErr := w.processor.Process(ctx, store, upload)+	if processErr != nil { 		log15.Warn("Failed to process upload", "id", upload.ID, "err", processErr)  		if markErr := store.MarkErrored(ctx, upload.ID, processErr.Error()); markErr != nil {-			return true, errors.Wrap(markErr, "store.MarkErrored")+			return errors.Wrap(markErr, "store.MarkErrored") 		}++		return nil 	} -	return true, nil+	if requeued {+		log15.Info("Requeueing upload", "id", upload.ID)+	} else {+		log15.Info("Processed upload", "id", upload.ID)+	}++	return nil+}++// reserveProcessorRoutine blocks until there is room for another processor routine+// to start. This method returns false if the context is canceled before a blocking+// processor has finished. If this method returns true, releaseProcessorRoutine must+// be called at the end of the processor function, or the worker will leak capacity.+func (w *Worker) reserveProcessorRoutine(ctx context.Context) bool {

suggestion: i feel the same way about these funcs as i do about starting db txs: it should take a func as an argument and guarantee we release the routine. way less dangerous here though.

efritz

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Run workers concurrently

 func (w *Worker) Stop() { 	}) } -// TODO(efritz) - use cancellable context+// dequeueAndProcess selects a queued upload record to process. This method returns false+// if no such method can be dequeued and returns an error only on failure to dequeue a new+// record (no processor errors are bubbled up past this point).+func (w *Worker) dequeueAndProcess(ctx context.Context) (dequeued bool, err error) {+	if !w.reserveProcessorRoutine(ctx) {+		return false, nil+	}+	defer func() {+		if !dequeued {

error: I can't see where we set this var?

efritz

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

codeintel: Run workers concurrently

 func (w *Worker) Stop() { 	}) } -// TODO(efritz) - use cancellable context+// dequeueAndProcess selects a queued upload record to process. This method returns false+// if no such method can be dequeued and returns an error only on failure to dequeue a new+// record (no processor errors are bubbled up past this point).+func (w *Worker) dequeueAndProcess(ctx context.Context) (dequeued bool, err error) {+	if !w.reserveProcessorRoutine(ctx) {+		return false, nil+	}+	defer func() {+		if !dequeued {+			// Ensure we release the processor routine back to the+			// pool if we did not start a new one.+			w.releaseProcessorRoutine()+		}+	}() -// dequeueAndProcess pulls a job from the queue and processes it. If there-// were no jobs ready to process, this method returns a false-valued flag.-func (w *Worker) dequeueAndProcess(ctx context.Context) (_ bool, err error) {-	upload, store, ok, err := w.store.Dequeue(ctx)-	if err != nil || !ok {+	// Select a queued upload to process and the transaction that holds it+	upload, store, ok, err := w.store.Dequeue(ctx, w.budget)+	if err != nil { 		return false, errors.Wrap(err, "store.Dequeue") 	}+	if !ok {+		return false, nil+	} +	size := 0+	if upload.UploadSize != nil {+		size = *upload.UploadSize+	}++	w.budget -= size

discussion: should we err if size == 0? this seems like a recipe for OOM

efritz

comment created time in 25 days

push eventsourcegraph/lsif-clang

garo (they/them)

commit sha 56d02fa5b955d12dfeabe4db62424f67548998a6

Update README.md

view details

push time in 25 days

push eventsourcegraph/lsif-clang

garo (they/them)

commit sha 3b6b9b1633783e5ce0fe802e605741d8eb598749

Update README.md

view details

push time in 25 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 declare module 'sourcegraph' {          * position or the current position itself.          */         range?: Range++        /**+         * Alerts related to this hover.+         */+        alerts?: Badged<HoverAlert>[]

images in the OP. hovered symbols randomly but managed to hit the exact same ones as my first screen grab :ghost:

gbrik

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 import { HoverOverlay, HoverOverlayProps } from '../../../shared/src/hover/Hover  // Components from shared with web-styling class names applied -export const WebHoverOverlay: React.FunctionComponent<HoverOverlayProps<never>> = props => (-    <HoverOverlay-        {...props}-        className="card"-        iconClassName="icon-inline"-        iconButtonClassName="btn btn-icon"-        actionItemClassName="btn btn-secondary"-        infoAlertClassName="alert alert-info"-        errorAlertClassName="alert alert-danger"-    />-)+export class WebHoverOverlay extends React.PureComponent<HoverOverlayProps, {}> {

oooh I looked around but couldn't find any way to access local storage reactively, ty!

incidentally, is forceUpdate equivalent to this.setState(this.state) or is the diff that the latter passes through componentShouldUpdate

gbrik

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 export class HoverOverlay<A extends string> extends React.PureComponent<HoverOve                         // and communicate to the user we couldn't find a hover.                         <em>No hover information available.</em>                     ) : (-                        hoverOrError?.contents.map((content, index) => {-                            if (content.kind === 'markdown') {-                                try {-                                    return (-                                        <React.Fragment key={index}>-                                            {index !== 0 && <hr />}+                                    hoverOrError?.contents.map((content, index) => {+                                        if (content.kind === 'markdown') {+                                            try {+                                                return (+                                                    <React.Fragment key={index}>+                                                        {index !== 0 && <hr />} -                                            {content.badge && this.state.showBadges && (-                                                <BadgeAttachment-                                                    className="hover-overlay__badge e2e-hover-badge"-                                                    iconClassName={this.props.iconClassName}-                                                    iconButtonClassName={this.props.iconButtonClassName}-                                                    attachment={content.badge}-                                                    isLightTheme={this.props.isLightTheme}-                                                />-                                            )}+                                                        {content.badge && this.state.showBadges && (+                                                            <BadgeAttachment+                                                                className="hover-overlay__badge e2e-hover-badge"+                                                                iconClassName={this.props.iconClassName}+                                                                iconButtonClassName={this.props.iconButtonClassName}+                                                                attachment={content.badge}+                                                                isLightTheme={this.props.isLightTheme}+                                                            />+                                                        )} -                                            <span-                                                className="hover-overlay__content e2e-tooltip-content"-                                                dangerouslySetInnerHTML={{-                                                    __html: renderMarkdown(content.value),-                                                }}-                                            />-                                        </React.Fragment>-                                    )-                                } catch (error) {-                                    return (-                                        <div className={classNames(this.props.errorAlertClassName)} key={index}>-                                            {upperFirst(asError(error).message)}-                                        </div>-                                    )-                                }-                            }-                            return (-                                <span className="hover-overlay__content" key={index}>-                                    {content.value}-                                </span>-                            )-                        })-                    )}+                                                        <span+                                                            className="hover-overlay__content e2e-tooltip-content"+                                                            dangerouslySetInnerHTML={{+                                                                __html: renderMarkdown(content.value),+                                                            }}+                                                        />+                                                    </React.Fragment>+                                                )+                                            } catch (error) {+                                                return (+                                                    <div className={classNames(this.props.errorAlertClassName)} key={index}>+                                                        {upperFirst(asError(error).message)}+                                                    </div>+                                                )+                                            }+                                        }+                                        return (+                                            <span className="hover-overlay__content" key={index}>+                                                {content.value}+                                            </span>+                                        )+                                    })+                                )}                 </div>                 {hoverOrError && hoverOrError !== LOADING && !isErrorLike(hoverOrError) && hoverOrError.alerts && (                     <div className="hover-overlay__alerts">-                        {hoverOrError.alerts.map(({ content, type }) => (-                            <div-                                className={classNames('hover-overlay__alert', this.props.infoAlertClassName)}-                                key={type}-                            >-                                <div className="hover-overlay__alert-content">-                                    <small>{content}</small>-                                    <a-                                        className="hover-overlay__alert-close"-                                        href=""-                                        onClick={this.onAlertDismissedCallback(type)}-                                    >-                                        <small>Dismiss</small>-                                    </a>+                        {hoverOrError.alerts.map(({ summary, badge, dismissalType }, index) => (+                            <div className="hover-overlay__alert-container" key={index}>+                                <div+                                    className={classNames('hover-overlay__alert', this.props.infoAlertClassName)}+                                >+                                    {badge && !dismissalType &&+                                        <BadgeAttachment+                                            className="hover-overlay__badge e2e-hover-badge"+                                            iconClassName={this.props.iconClassName}+                                            iconButtonClassName={this.props.iconButtonClassName}+                                            attachment={badge}+                                            isLightTheme={this.props.isLightTheme}+                                        />+                                    }++                                    <span+                                        className="hover-overlay__content"+                                        dangerouslySetInnerHTML={{ __html: summary.kind === 'plaintext' ? summary.value : renderMarkdown(summary.value) }}+                                    />++                                    {badge && dismissalType &&+                                        <BadgeAttachment+                                            className="hover-overlay__badge e2e-hover-badge"+                                            iconClassName={this.props.iconClassName}+                                            iconButtonClassName={this.props.iconButtonClassName}+                                            attachment={badge}+                                            isLightTheme={this.props.isLightTheme}+                                        />+                                    }

by putting them after, they appear in the bottom right with text wrapping. this was the former behaviour and I agree it looks better. when there's no dismiss button, the icon looks better in the top right and so gets rendered before the content.

gbrik

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

         // Descendant selectors are needed here to style rendered markdown         // stylelint-disable selector-max-compound-selectors +        p {+            display: inline;+        }

actually I'm now realizing this might be unnecessary due to the flex fix I found later, I'll get back to you on this (in general, I don't actually want to have p elements at all but the markdown renderer supplies them, which I have to use to avoid embedding a tiny markup language in the extension API)

gbrik

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

         // stylelint-enable selector-max-compound-selectors     } +    &__alert-container {+        display: flex;+    }

otherwise floating elements could end up outside the alert's rendering box, and there would be a white strip where the background didn't cover things

gbrik

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 add('With alert', () => (                     alerts: [                         {                             type: 'info',-                            content: (-                                <>-                                    This is a test alert. Enim esse quis commodo ex. Pariatur tempor laborum officia-                                    irure est do est laborum nostrud cillum. Cupidatat id consectetur et eiusmod Lorem-                                    proident cupidatat ullamco dolor nostrud. Cupidatat sit do dolor aliqua labore ad-                                    laboris cillum deserunt dolor. Sunt labore veniam Lorem reprehenderit quis occaecat-                                    sint do mollit aliquip. Consectetur mollit mollit magna eiusmod duis ex. Sint nisi-                                    labore labore nulla laboris.-                                </>-                            ),-                        },+                            summary: {+                                kind: MarkupKind.PlainText,+                                value:+                                    'This is a test alert. Enim esse quis commodo ex. Pariatur tempor laborum officiairure est do est laborum nostrud cillum. Cupidatat id consectetur et eiusmod Loremproident cupidatat ullamco dolor nostrud. Cupidatat sit do dolor aliqua labore adlaboris cillum deserunt dolor. Sunt labore veniam Lorem reprehenderit quis occaecatsint do mollit aliquip. Consectetur mollit mollit magna eiusmod duis ex. Sint nisilabore labore nulla laboris.',+                            },+                            dismissalType: 'test-alert-dismissalType',

all the CSS changes were me flailing around til everything worked, I confirmed that every combination of {badge, dismiss} renders responsively at any size of hover, and am planning to add stories for everything. I'll respond to each styling weirdness with what it fixed

gbrik

comment created time in 25 days

Pull request review commentsourcegraph/sourcegraph

web: make the 'alerts' on hovers first class and expose through extensions

 declare module 'sourcegraph' {          * position or the current position itself.          */         range?: Range++        /**+         * Alerts related to this hover.+         */+        alerts?: Badged<HoverAlert>[]

afk with my doge, will show when I get back. Putting the full text in the hover would be quite obnoxious, especially since I want to try making some of the alerts not dismissible at first.

gbrik

comment created time in 25 days

more