canonical / discourse-gatekeeper

Experimental GitHub Action to upload charm documentation to charmhub
Apache License 2.0
7 stars 7 forks source link

conflict change race condition resolution stage 1 #241

Closed jdkandersson closed 6 months ago

jdkandersson commented 6 months ago

Applicable spec: ISD139

Overview

Introduces a check that the content hasn't changed on discourse since the conflict check was completed before pushing content to discourse.

Rationale

This is stage 1 of addressing a race condition where a change could be made on discourse after the conflict check was completed and before the content can be pushed to discourse. This can happen on documentation with a lot of pages where the action can get rate limited during the content updating. This means that it can be on the order of hours between the conflict check and the update getting applied in extreme cases.

Module Changes

The action execution module has been updated to perform a check of whether the content on the server has changed and it abandons the updates if a change is detected.

Checklist

Version will be incremented on release

github-actions[bot] commented 6 months ago

Test coverage for bac366c1443499a475ee196b0a4a6ed8d28a9287

Name                      Stmts   Miss Branch BrPart  Cover   Missing
---------------------------------------------------------------------
src/__init__.py              97      0     42      0   100%
src/action.py               159      0     48      0   100%
src/check.py                 63      0     25      0   100%
src/clients.py               12      0      0      0   100%
src/commit.py                42      0     12      0   100%
src/constants.py              9      0      0      0   100%
src/content.py               50      0     10      0   100%
src/discourse.py            159      0     34      0   100%
src/docs_directory.py        33      0      8      0   100%
src/download.py              22      0      2      0   100%
src/exceptions.py            15      0      0      0   100%
src/index.py                142      0     56      0   100%
src/metadata.py              59      0     28      0   100%
src/migration.py            102      0     33      0   100%
src/navigation_table.py      65      0     20      0   100%
src/reconcile.py            123      0     60      0   100%
src/repository.py           293      0     88      0   100%
src/sort.py                  43      0     26      0   100%
src/types_.py               202      0     54      0   100%
---------------------------------------------------------------------
TOTAL                      1690      0    546      0   100%

Static code analysis report

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:03
Run started:2024-04-02 03:43:39.373018

Test results:
    No issues identified.

Code scanned:
    Total lines of code: 17872
    Total lines skipped (#nosec): 3
    Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
    Total issues (by severity):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
    Total issues (by confidence):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
Files skipped (0):