Monorepo for Tangled tangled.org

spindle/db: prevent status events from overwriting terminal states #1072

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:sshwio5obbx4zjfrn3fhsen6/sh.tangled.repo.pull/3meocxxcz4z22
+21 -109
Diff #0
+2 -15
appview/pages/templates/layouts/base.html
··· 4 4 <head> 5 5 <meta charset="UTF-8" /> 6 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"/> 7 - <meta name="description" content="The next-generation social coding platform."/> 7 + <meta name="description" content="Social coding, but for real this time!"/> 8 8 <meta name="htmx-config" content='{"includeIndicatorStyles": false}'> 9 - 10 - <!-- Open Graph defaults --> 11 - <meta property="og:site_name" content="Tangled" /> 12 - <meta property="og:type" content="website" /> 13 - <meta property="og:locale" content="en_US" /> 14 - 15 - 16 - <!-- Keywords --> 17 - <meta name="keywords" content="git, code collaboration, AT Protocol, open source, version control, social coding, code hosting" /> 18 - 19 - <!-- Author and copyright --> 20 - <meta name="author" content="Tangled" /> 21 - <meta name="robots" content="index, follow" /> 22 9 23 10 <script defer src="/static/htmx.min.js"></script> 24 11 <script defer src="/static/htmx-ext-ws.min.js"></script> ··· 39 26 <link rel="preload" href="/static/fonts/InterVariable.woff2" as="font" type="font/woff2" crossorigin /> 40 27 41 28 <link rel="stylesheet" href="/static/tw.css?{{ cssContentHash }}" type="text/css" /> 42 - <title>{{ block "title" . }}{{ end }}</title> 29 + <title>{{ block "title" . }}{{ end }} ยท tangled</title> 43 30 {{ block "extrameta" . }}{{ end }} 44 31 </head> 45 32 <body class="min-h-screen flex flex-col gap-4 bg-slate-100 dark:bg-gray-900 dark:text-white transition-colors duration-200">
+4 -16
appview/pages/templates/layouts/profilebase.html
··· 3 3 {{ define "extrameta" }} 4 4 {{ $handle := resolve .Card.UserDid }} 5 5 {{ $avatarUrl := profileAvatarUrl .Card.Profile "" }} 6 - {{ $description := or .Card.Profile.Description (printf "%s on Tangled" $handle) }} 7 - {{ $url := printf "https://tangled.org/%s" $handle }} 8 - 9 - <!-- Open Graph Meta Tags --> 10 6 <meta property="og:title" content="{{ $handle }}" /> 11 7 <meta property="og:type" content="profile" /> 12 - <meta property="og:url" content="{{ $url }}" /> 13 - <meta property="og:description" content="{{ $description }}" /> 8 + <meta property="og:url" content="https://tangled.org/{{ $handle }}?tab={{ .Active }}" /> 9 + <meta property="og:description" content="{{ or .Card.Profile.Description $handle }}" /> 14 10 <meta property="og:image" content="{{ $avatarUrl }}" /> 15 11 <meta property="og:image:width" content="512" /> 16 12 <meta property="og:image:height" content="512" /> 17 - <meta property="og:image:alt" content="{{ $handle }}'s avatar" /> 18 - <meta property="profile:username" content="{{ $handle }}" /> 19 - 20 - <!-- Twitter Card Meta Tags --> 13 + 21 14 <meta name="twitter:card" content="summary" /> 22 15 <meta name="twitter:title" content="{{ $handle }}" /> 23 - <meta name="twitter:description" content="{{ $description }}" /> 16 + <meta name="twitter:description" content="{{ or .Card.Profile.Description $handle }}" /> 24 17 <meta name="twitter:image" content="{{ $avatarUrl }}" /> 25 - <meta name="twitter:image:alt" content="{{ $handle }}'s avatar" /> 26 - 27 - <!-- Additional SEO --> 28 - <meta name="description" content="{{ $description }}" /> 29 - <link rel="canonical" href="{{ $url }}" /> 30 18 {{ end }} 31 19 32 20 {{ define "content" }}
+2 -17
appview/pages/templates/repo/fragments/og.html
··· 1 1 {{ define "repo/fragments/og" }} 2 2 {{ $title := or .Title .RepoInfo.FullName }} 3 - {{ $description := or .Description .RepoInfo.Description "A repository on Tangled" }} 3 + {{ $description := or .Description .RepoInfo.Description }} 4 4 {{ $url := or .Url (printf "https://tangled.org/%s" .RepoInfo.FullName) }} 5 5 {{ $imageUrl := printf "https://tangled.org/%s/opengraph" .RepoInfo.FullName }} 6 - {{ $ownerHandle := resolve .RepoInfo.OwnerDid }} 7 6 8 - <!-- Open Graph Meta Tags --> 9 7 <meta property="og:title" content="{{ unescapeHtml $title }}" /> 10 - <meta property="og:type" content="article" /> 8 + <meta property="og:type" content="object" /> 11 9 <meta property="og:url" content="{{ $url }}" /> 12 10 <meta property="og:description" content="{{ $description }}" /> 13 11 <meta property="og:image" content="{{ $imageUrl }}" /> 14 12 <meta property="og:image:width" content="1200" /> 15 13 <meta property="og:image:height" content="600" /> 16 - <meta property="og:image:alt" content="{{ unescapeHtml $title }}" /> 17 - <meta property="article:author" content="{{ $ownerHandle }}" /> 18 - {{ if .RepoInfo.Topics }} 19 - {{ range .RepoInfo.Topics }} 20 - <meta property="article:tag" content="{{ . }}" /> 21 - {{ end }} 22 - {{ end }} 23 14 24 - <!-- Twitter Card Meta Tags --> 25 15 <meta name="twitter:card" content="summary_large_image" /> 26 16 <meta name="twitter:title" content="{{ unescapeHtml $title }}" /> 27 17 <meta name="twitter:description" content="{{ $description }}" /> 28 18 <meta name="twitter:image" content="{{ $imageUrl }}" /> 29 - <meta name="twitter:image:alt" content="{{ unescapeHtml $title }}" /> 30 - 31 - <!-- Additional SEO --> 32 - <meta name="description" content="{{ $description }}" /> 33 - <link rel="canonical" href="{{ $url }}" /> 34 19 {{ end }}
+3 -19
appview/pages/templates/timeline/home.html
··· 1 1 {{ define "title" }}tangled &middot; tightly-knit social coding{{ end }} 2 2 3 3 {{ define "extrameta" }} 4 - <!-- Open Graph Meta Tags --> 5 - <meta property="og:title" content="tangled ยท tightly-knit social coding" /> 6 - <meta property="og:type" content="website" /> 4 + <meta property="og:title" content="timeline ยท tangled" /> 5 + <meta property="og:type" content="object" /> 7 6 <meta property="og:url" content="https://tangled.org" /> 8 - <meta property="og:description" content="The next-generation social coding platform." /> 9 - <meta property="og:image" content="https://assets.tangled.network/what-is-tangled-repo.png" /> 10 - <meta property="og:image:width" content="1200" /> 11 - <meta property="og:image:height" content="630" /> 12 - 13 - <!-- Twitter Card Meta Tags --> 14 - <meta name="twitter:card" content="summary_large_image" /> 15 - <meta name="twitter:title" content="Tangled" /> 16 - <meta name="twitter:description" content="The next-generation social coding platform." /> 17 - <meta name="twitter:image" content="https://assets.tangled.network/tangled_og.png" /> 18 - 19 - <!-- Additional SEO --> 20 - <meta name="description" content="The next-generation social coding platform. Host repos on your infrastructure with knots, use stacked pull requests, and run CI with spindles." /> 21 - <link rel="canonical" href="https://tangled.org" /> 22 - 23 - 7 + <meta property="og:description" content="tightly-knit social coding" /> 24 8 {{ end }} 25 9 26 10
+1 -33
appview/pulls/pulls.go
··· 553 553 554 554 keyword := params.Get("q") 555 555 556 - repoInfo := s.repoResolver.GetRepoInfo(r, user) 557 - 558 556 var pulls []*models.Pull 559 557 searchOpts := models.PullSearchOptions{ 560 558 Keyword: keyword, ··· 571 569 } 572 570 totalPulls = int(res.Total) 573 571 l.Debug("searched pulls with indexer", "count", len(res.Hits)) 574 - 575 - // count matching pulls in the other states to display correct counts 576 - for _, other := range []models.PullState{models.PullOpen, models.PullMerged, models.PullClosed} { 577 - if other == state { 578 - continue 579 - } 580 - countRes, err := s.indexer.Search(r.Context(), models.PullSearchOptions{ 581 - Keyword: keyword, RepoAt: f.RepoAt().String(), State: other, 582 - Page: pagination.Page{Limit: 1}, 583 - }) 584 - if err != nil { 585 - continue 586 - } 587 - switch other { 588 - case models.PullOpen: 589 - repoInfo.Stats.PullCount.Open = int(countRes.Total) 590 - case models.PullMerged: 591 - repoInfo.Stats.PullCount.Merged = int(countRes.Total) 592 - case models.PullClosed: 593 - repoInfo.Stats.PullCount.Closed = int(countRes.Total) 594 - } 595 - } 596 - switch state { 597 - case models.PullOpen: 598 - repoInfo.Stats.PullCount.Open = int(res.Total) 599 - case models.PullMerged: 600 - repoInfo.Stats.PullCount.Merged = int(res.Total) 601 - case models.PullClosed: 602 - repoInfo.Stats.PullCount.Closed = int(res.Total) 603 - } 604 572 605 573 pulls, err = db.GetPulls( 606 574 s.db, ··· 700 668 701 669 s.pages.RepoPulls(w, pages.RepoPullsParams{ 702 670 LoggedInUser: s.oauth.GetMultiAccountUser(r), 703 - RepoInfo: repoInfo, 671 + RepoInfo: s.repoResolver.GetRepoInfo(r, user), 704 672 Pulls: pulls, 705 673 LabelDefs: defs, 706 674 FilteringBy: state,
+1 -8
appview/state/state.go
··· 207 207 w.Header().Set("Content-Type", "text/plain") 208 208 w.Header().Set("Cache-Control", "public, max-age=86400") // one day 209 209 210 - robotsTxt := `# Hello, Tanglers! 211 - User-agent: * 210 + robotsTxt := `User-agent: * 212 211 Allow: / 213 - Disallow: /*/*/settings 214 - Disallow: /settings 215 - Disallow: /*/*/compare 216 - Disallow: /*/*/fork 217 - 218 - Crawl-delay: 1 219 212 ` 220 213 w.Write([]byte(robotsTxt)) 221 214 }
+7
spindle/db/events.go
··· 77 77 exitCode *int64, 78 78 n *notifier.Notifier, 79 79 ) error { 80 + // don't overwrite a terminal status 81 + if current, err := d.GetStatus(workflowId); err == nil { 82 + if models.StatusKind(current.Status).IsFinish() { 83 + return nil 84 + } 85 + } 86 + 80 87 now := time.Now() 81 88 pipelineAtUri := workflowId.PipelineId.AtUri() 82 89 s := tangled.PipelineStatus{
+1 -1
spindle/engines/nixery/setup_steps.go
··· 17 17 18 18 // dependencyStep processes dependencies defined in the workflow. 19 19 // For dependencies using a custom registry (i.e. not nixpkgs), it collects 20 - // all packages and adds a single 'nix profile install' step to the 20 + // all packages and adds a single 'nix profile add' step to the 21 21 // beginning of the workflow's step list. 22 22 func dependencyStep(deps map[string][]string) *Step { 23 23 var customPackages []string

History

1 round 2 comments
sign up or login to add to the discussion
moshyfawn.dev submitted #0
2 commits
expand
spindle/db: prevent status events from overwriting terminal states
spindle/nixery: update setup command docs
expand 2 comments

I was running an older spindle version and noticed the deprecation message hence looked at the code and saw this mismatch; just thought I outta update it

Sry got my commits messed up

closed without merging