Commit f082aea
committed
Gate the existence check behind must_exist for user-facing callers
The existence check was applied unconditionally in
GenericContext.invalidate_environment, which broke
GithubController.try_invalidate_pr_environment. That method invalidates
the PR environment after a prod deploy, and the environment may never
have been created — a forward-only deploy being one case — so it relies
on a missing environment being a silent no-op. Raising there turned a
routine cleanup into a failed deploy, which is what
test_deploy_prod_forward_only caught.
Move the check behind must_exist=False and have the two user-facing
entry points, the invalidate CLI command and the %invalidate magic, opt
in. The reported behavior is unchanged; library callers keep the
lenient path. Adds a regression test pinning the no-op default.
Signed-off-by: Nishchay Mahor <nishchaymahor@gmail.com>1 parent 23bc02e commit f082aea
4 files changed
Lines changed: 32 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1870 | 1870 | | |
1871 | 1871 | | |
1872 | 1872 | | |
1873 | | - | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
1874 | 1876 | | |
1875 | 1877 | | |
1876 | 1878 | | |
1877 | 1879 | | |
1878 | 1880 | | |
1879 | 1881 | | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
1880 | 1887 | | |
1881 | 1888 | | |
1882 | | - | |
| 1889 | + | |
1883 | 1890 | | |
1884 | 1891 | | |
1885 | 1892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
983 | 983 | | |
984 | 984 | | |
985 | 985 | | |
986 | | - | |
| 986 | + | |
987 | 987 | | |
988 | 988 | | |
989 | 989 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1937 | 1937 | | |
1938 | 1938 | | |
1939 | 1939 | | |
1940 | | - | |
| 1940 | + | |
1941 | 1941 | | |
1942 | 1942 | | |
1943 | 1943 | | |
1944 | 1944 | | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
1945 | 1965 | | |
1946 | 1966 | | |
1947 | 1967 | | |
| |||
0 commit comments