435 Commits

Author SHA1 Message Date
Klaas van Schelven
354af7ea0a Fix issues as reported by bandit or mark as nosec
Nothing worrying, but good to have checked this regardless
and important to have a green pipeline.

Fix #175
2025-07-30 12:16:40 +02:00
Klaas van Schelven
9b8409d8b2 Global trailing whitespace cleanup 2025-07-29 12:53:10 +02:00
Klaas van Schelven
ceca12940b Breadcrumb timestamps: display harmonized w/ rest of application
in the correct timezone, with smaller milis

According to the spec, this should work because:

> The timestamp of the breadcrumb. Recommended. A timestamp representing when
> the breadcrumb occurred. The format is either a string as defined in [RFC
> 3339](https://tools.ietf.org/html/rfc3339) or a numeric (integer or float)
> value representing the number of seconds that have elapsed since the [Unix
> epoch](https://en.wikipedia.org/wiki/Unix_time). Breadcrumbs are most useful
> when they include a timestamp, as it creates a timeline leading up to an
> event.
2025-07-28 10:24:48 +02:00
Klaas van Schelven
6b8d912e1a Store remote_addr on the event
Fix #165
2025-07-25 21:54:32 +02:00
Klaas van Schelven
c4fe1c1292 Debug IDs for missing sourcemaps: show them right in the stacktrace
See #158
2025-07-23 10:57:30 +02:00
Klaas van Schelven
1983633b38 Sourcemap Images IDs: show those in event_details
See #158
2025-07-23 10:38:45 +02:00
Klaas van Schelven
fd80eff7ca Migration fix: delete TurningPoints w/ project=None
Fix #155
2025-07-17 14:41:27 +02:00
Klaas van Schelven
45ad2aceec Dark mode: use monokai style from pygments
Fix #152
2025-07-17 09:45:22 +02:00
Klaas van Schelven
421ac91dc5 Fix overflow issue when function-names are very long
As per the "little red box on" #120
2025-07-15 10:35:16 +02:00
Klaas van Schelven
ae2bc56c04 Text-overflow for issue pages (date and '1 of 1 total')
> that "10 july ... event 1 of 1 total" should get overflow properties just like the exception.type below it.

See #120
2025-07-15 10:23:55 +02:00
Klaas van Schelven
89accddc2f Fix wasted space at certain width in stacktrace UI
* The "collapse" etc. buttons get shown below the search box and < << >> > from
  a certain width downwards.

* similar stacking for the date/type/value and the buttons at an even smaller width.

See #120
2025-07-15 09:41:35 +02:00
Klaas van Schelven
f21d9f989b Fix recently added UI elements to have dark mode too
the elements were added after the work on #125 was done but in a
branch w/o dark-mode, so they needed to still be fixed
2025-07-07 11:39:27 +02:00
Klaas van Schelven
d99f946665 Merge branch 'main' into feature/add_dark_theme 2025-07-07 11:08:00 +02:00
Klaas van Schelven
7b340fd8ff Hide in-progress deletions of Project & Issue from the UI
I've done a full grep on Issue.objects, Project.objects and get_object_or_404
equivelents, and applying some common sense. The goal: avoid having
confusing/half-broken pages in the UI.

On index-usage: I've decided not to update the indexes. The assumption is:
`is_deleted` items will be a tiny minority of items in general, making the
cost/benefit analysis not turn out favorably (just scanning them out as a final
step is more efficient).  Also: sqlite is able to use the correct index without
adding a special one, proof:

```
EXPLAIN QUERY PLAN SELECT [..] WHERE ("issues_issue"."project_id" = 1 AND "issues_issue"."is_muted" = (0) AND "issues_issue"."is_resolved" = (0)) ORDER BY "issues_issue"."last_seen" DESC LIMIT 250;
QUERY PLAN
`--SEARCH issues_issue USING INDEX issue_list_open (project_id=? AND is_resolved=? AND is_muted=?)

EXPLAIN QUERY PLAN SELECT [..] WHERE ("issues_issue"."project_id" = 1 AND "issues_issue"."is_muted" = (0) AND "issues_issue"."is_resolved" = (0) AND "issues_issue"."is_deleted" = 0) ORDER BY "issues_issue"."last_seen" DESC LIMIT 250;
QUERY PLAN
`--SEARCH issues_issue USING INDEX issue_list_open (project_id=? AND is_resolved=? AND is_muted=?)
```

See #139 for the 0/1 notation in the above.

(Project-indexes: not an issue, the scale is "below relevance for indexes")
2025-07-07 10:27:36 +02:00
Klaas van Schelven
308034aadd Issue-delete from the UI (in the list-view)
See #50
2025-07-04 21:25:57 +02:00
Klaas van Schelven
3e2bc290fd Fix typo in 'breadcrumbs' first/last urls.py 2025-07-04 17:33:02 +02:00
Klaas van Schelven
4900f0447e Project-deletion: slight optimization
Removes the following 2 redundant queries from the deletion process:

```
SELECT "tags_tagkey"."id" FROM "tags_tagkey" WHERE "tags_tagkey"."project_id" IN (1) ORDER BY "tags_tagkey"."project_id" ASC, "tags_tagkey"."id" ASC LIMIT 498
UPDATE "projects_project" SET "stored_event_count" = ("projects_project"."stored_event_count" - 1) WHERE "projects_project"."id" = 1
```
2025-07-03 22:04:51 +02:00
Klaas van Schelven
28b2ce0eaf Various models: .project SET_NULL => DO_NOTHING
Like e45c61d6f0, but for .project.

I originally thought `SET_NULL` would be a good way to "do stuff later", but
that's only so the degree that [1] updates are cheaper than deletes and [2]
2nd-order effects (further deletes in the dep-tree) are avoided.

Now that we have explicit Project-deletion (deps-first, delayed, properly batched)
the SET_NULL behavior is always a no-op (but with cost in queries).

As a result, in the test for project deletion (which has deletes for many
of the altered models), the following 12 queries are no longer done:

```
SELECT "projects_project"."id", [..many fields..] FROM "projects_project" WHERE "projects_project"."id" = 1
DELETE FROM "projects_projectmembership" WHERE "projects_projectmembership"."project_id" IN (1)
DELETE FROM "alerts_messagingserviceconfig" WHERE "alerts_messagingserviceconfig"."project_id" IN (1)
UPDATE "releases_release" SET "project_id" = NULL WHERE "releases_release"."project_id" IN (1)
UPDATE "issues_issue" SET "project_id" = NULL WHERE "issues_issue"."project_id" IN (1)
UPDATE "issues_grouping" SET "project_id" = NULL WHERE "issues_grouping"."project_id" IN (1)
UPDATE "events_event" SET "project_id" = NULL WHERE "events_event"."project_id" IN (1)
UPDATE "tags_tagkey" SET "project_id" = NULL WHERE "tags_tagkey"."project_id" IN (1)
UPDATE "tags_tagvalue" SET "project_id" = NULL WHERE "tags_tagvalue"."project_id" IN (1)
UPDATE "tags_eventtag" SET "project_id" = NULL WHERE "tags_eventtag"."project_id" IN (1)
UPDATE "tags_issuetag" SET "project_id" = NULL WHERE "tags_issuetag"."project_id" IN (1)
```
2025-07-03 21:49:49 +02:00
Klaas van Schelven
6b9e4d8011 Project.delete_deferred(): first version (WIP)
Implemented using a batch-wise dependency-scanner in delayed
(snappea) style.

* no real point-of-entry in the (regular, non-admin) UI yet.
* no hiding of Projects which are delete-in-progress from the UI

* lack of DRY
* some unnessary work (needed in the Issue-context, but not here)
  is still being done.

See #50
2025-07-03 21:01:28 +02:00
Klaas van Schelven
99f71b8a47 Fix the tests (query-counting across DBs) 2025-07-03 14:48:51 +02:00
Klaas van Schelven
eb5e2d2a48 Fix 'delay_on_commit' calls for project-id passing-around 2025-07-03 13:46:40 +02:00
Klaas van Schelven
6a75216c8f Document issue-deletion batch size budget 2025-07-03 13:46:16 +02:00
Klaas van Schelven
2baa4446fd Issue deletion: event pre-deletes (storage, project-counts) 2025-07-03 13:18:28 +02:00
Klaas van Schelven
3b3ce782c5 Fix the tests for prev. commit
tests were broken b/c not respecting constraints / not properly using the factories.
2025-07-03 11:33:58 +02:00
Klaas van Schelven
e45c61d6f0 Various models: .issue and .grouping; SET_NULL => DO_NOTHING
I originally thought `SET_NULL` would be a good way to "do stuff later", but
that's only so the degree that [1] updates are cheaper than deletes and [2]
2nd-order effects (further deletes in the dep-tree) are avoided.

Now that we have explicit Issue-deletion (deps-first, delayed, properly batched)
the SET_NULL behavior is always a no-op (but with cost in queries).

As a result, in the test for issue deletion (which has deletes for many
of the altered models), the following 8 queries are no longer done:

```
SELECT "issues_grouping"."id", [..many fields..] FROM "issues_grouping" WHERE "issues_grouping"."id" IN (1)
UPDATE "events_event" SET "grouping_id" = NULL WHERE "events_event"."grouping_id" IN (1)

[.. a few moments later..]

SELECT "issues_issue"."id", [..many fields..] FROM "issues_issue" WHERE "issues_issue"."id" = 'uuid'
UPDATE "issues_grouping" SET "issue_id" = NULL WHERE "issues_grouping"."issue_id" IN ('uuid')
UPDATE "issues_turningpoint" SET "issue_id" = NULL WHERE "issues_turningpoint"."issue_id" IN ('uuid')
UPDATE "events_event" SET "issue_id" = NULL WHERE "events_event"."issue_id" IN ('uuid')
UPDATE "tags_eventtag" SET "issue_id" = NULL WHERE "tags_eventtag"."issue_id" IN ('uuid')
UPDATE "tags_issuetag" SET "issue_id" = NULL WHERE "tags_issuetag"."issue_id" IN ('uuid')
```

(breaks the tests b/c of constraints and not always using factories; will fix next)
2025-07-03 11:33:58 +02:00
Klaas van Schelven
e58be0018f Tag models: no CASCADE
CASCADE was defined for keys & values, but in practice those are never directly
deleted except in the very case in which it has been established that they are
'orphaned', i.e. no longer being referrred to. That's exactly the case in which
CASCADE is superfluous.

As a result, in the test for issue deletion (which contains a prune of
tagvalue), the following 3 queries are no longer done:

```
SELECT "tags_tagvalue"."id", "tags_tagvalue"."project_id", "tags_tagvalue"."key_id", "tags_tagvalue"."value" FROM "tags_tagvalue" WHERE "tags_tagvalue"."id" IN (1)
DELETE FROM "tags_eventtag" WHERE "tags_eventtag"."value_id" IN (1)
DELETE FROM "tags_issuetag" WHERE "tags_issuetag"."value_id" IN (1)
```
2025-07-03 11:33:58 +02:00
Klaas van Schelven
428011ff9b Prune orphans (TagValue, via IssueTag) inline
See #135
2025-07-03 11:33:53 +02:00
Klaas van Schelven
29238ece43 Test for model-topo overrides 2025-07-02 23:48:10 +02:00
Klaas van Schelven
f1878da154 Fix the test
tests were green but IssueTag was missing from the assertions (and some others doubled)
2025-07-02 23:35:23 +02:00
Klaas van Schelven
ebd9cceb6d Issue cleanup: hardcode order of visited models 2025-07-02 23:32:31 +02:00
Klaas van Schelven
ee9add5e5f Vacuum Tags command
See #135
2025-07-02 21:43:51 +02:00
Klaas van Schelven
aed19e70d3 Issue deletion test: actually test the Issue itself 2025-07-02 16:41:42 +02:00
Klaas van Schelven
6e9defedb4 Simple IntegrationTest for issue deletion 2025-06-27 12:57:51 +02:00
Klaas van Schelven
e5dbeae514 Issue.delete_deferred(): first version (WIP)
Implemented using a batch-wise dependency-scanner in delayed
(snappea) style.

* no tests yet.
* no real point-of-entry in the (regular, non-admin) UI yet.
* no hiding of Issues which are delete-in-progress from the UI
* file storage not yet cleaned up
* project issue counts not yet updated
* dangling tag values: no cleanup mechanism yet.

See #50
2025-06-27 12:52:59 +02:00
Fabien LEFEBVRE (d1ceward)
9cec248ad8 Add dark theme 2025-06-16 15:37:37 +02:00
Klaas van Schelven
33d5865579 Clarifying comments on logmessage display 2025-06-03 15:47:46 +02:00
Klaas van Schelven
5d316332d0 Display formatted log message when available
Fix #111
2025-06-03 15:44:36 +02:00
Klaas van Schelven
430b130a94 Fingerprint: convert to string before concatenating
Fixes #102; as discussed in that issue: although such fingerprints are not
up-to-spec the sentry docs directly recommend them, and it would be nice
to not crash on them
2025-05-12 15:54:29 +02:00
Klaas van Schelven
3f43981475 Fix (obj not found) when visiting project as a superuser
project of which you're not a member
2025-05-09 16:47:21 +02:00
Klaas van Schelven
0dfd01db9b Performance: don't evaluate all project issues to show/hide checkbox
Doing so is expensive (to the point of timeout) for largish numbers
of issues.
2025-05-06 23:01:09 +02:00
Klaas van Schelven
aad0f624f9 Fix: issue-list indexes must have project first
because we always filter by project before ordering;

the now-removed first_seen index was simply unused
2025-05-06 22:19:31 +02:00
Klaas van Schelven
49e6700d4a Grouping.grouping_key: hash it for the index 2025-05-06 11:32:19 +02:00
Klaas van Schelven
3783661054 Issue Paginator: don't attempt to count the Issues
Counting incurs looking at all records which is too expensive if you have e.g.
1_000_000 issues.

Note that we take a different approach than the one for Events (where we
count-with-timeout). Reason for switching:
https://sqlite.org/forum/forumpost/fa65709226

For Events we have a known count for the non-query case (denormalized/counted
value), so we preserve what we had there. For Issues the trouble of keeping
counts right for muted/etc. is not (currently) worth it.
2025-05-06 10:13:06 +02:00
Klaas van Schelven
392f5a30be Add index for Grouping.grouping_key (and project) 2025-05-05 22:45:33 +02:00
Klaas van Schelven
cddd4f2c02 Fix Header/Grouper for Log Messages using deprecated SDKs
Fix #85
2025-04-24 20:59:54 +02:00
Klaas van Schelven
1084796763 When not dogfooding, just print a regular stacktrace in the logs
This will hopefully help when getting issue-reports for those that
have not set up dogfooding.

See [Dogfooding Bugsink](https://www.bugsink.com/docs/dogfooding/)
2025-04-11 13:22:37 +02:00
Klaas van Schelven
0c11bf0787 Add trivial viewtest 2025-04-11 11:19:03 +02:00
Klaas van Schelven
5d01214752 Sourcemaps: a test
See #19
2025-04-11 10:32:13 +02:00
Klaas van Schelven
87130043e3 PoC of using sourcemaps in the UI
See #19
2025-04-10 15:52:34 +02:00
Klaas van Schelven
a097e25310 issue.stored_event_count: consequences for 'irrelevance'
document & assert
2025-03-31 15:25:59 +02:00