Skip to content

fix(admin/updates): match the current ctx.NotFound signature#137

Merged
rg4444 merged 1 commit into
mainfrom
fix/slice4-notfound-signature
May 23, 2026
Merged

fix(admin/updates): match the current ctx.NotFound signature#137
rg4444 merged 1 commit into
mainfrom
fix/slice4-notfound-signature

Conversation

@rg4444
Copy link
Copy Markdown
Contributor

@rg4444 rg4444 commented May 23, 2026

fix(admin/updates): match the current ctx.NotFound signature

The v0.1.1 build failed at step #9 (Build & push Docker image) with three identical compile errors in routers/web/admin/updates.go (the Slice 4 handler added in #136):

routers/web/admin/updates.go:263:3: too many arguments in call to ctx.NotFound
routers/web/admin/updates.go:269:3: too many arguments in call to ctx.NotFound
routers/web/admin/updates.go:276:3: too many arguments in call to ctx.NotFound

Root cause

I matched the older two-argument Gitea pattern (NotFound(logMsg string, logErr error)) from memory. This fork's current signature in services/context/context_response.go is single-arg:

func (ctx *Context) NotFound(logErr error)

Fix

Drop the first string argument from all three call sites:

-ctx.NotFound("UpdateJobView", errors.New("missing job id"))
+ctx.NotFound(errors.New("missing job id"))

-ctx.NotFound("UpdateJobView", errors.New("updater not configured"))
+ctx.NotFound(errors.New("updater not configured"))

-ctx.NotFound("UpdateJobView", err)
+ctx.NotFound(err)

Behaviour is unchanged — NotFound still logs the underlying error.

Pattern verified against the existing codebase

routers/web/shared/packages/packages.go:217:    ctx.NotFound(err)
routers/web/shared/actions/runners.go:248:      ctx.NotFound(util.NewPermissionDeniedErrorf(...))
routers/web/shared/actions/runners.go:355:      ctx.NotFound(errors.New("runner not found"))

How this was diagnosed without log access

The Azure blob storage that hosts GHA job logs isn't in my sandbox's outbound allowlist, so I couldn't read logs directly. Pivoted to the check-runs annotations API:

GET /repos/{owner}/{repo}/check-runs/{check_id}/annotations

That returned the three compile errors with file/line specifics, which is more than enough to fix. Adding this to my mental toolbox for future debugging — annotations are often the cleanest signal even when logs aren't reachable.

After merge

Same dance as v0.1.0 had: delete v0.1.1 ref, recreate against new main HEAD, workflow re-fires. Wall clock should be even faster than v0.1.0 because the v0.1.1 failed run still warmed the buildx cache for the build step — the failed step was the build itself, but the partial buildx layers up to the compile point are cached. Expected ~2-4 min for the retry.

Diff

 routers/web/admin/updates.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

The v0.1.1 build failed because three ctx.NotFound calls in
routers/web/admin/updates.go (added in #136) used the older two-arg
Gitea signature:

    ctx.NotFound("UpdateJobView", err)   // wrong (2 args)

This fork's current signature, in services/context/context_response.go,
is single-arg:

    func (ctx *Context) NotFound(logErr error)

The build failed with three identical compile errors:

    routers/web/admin/updates.go:263:3: too many arguments in call to ctx.NotFound
    routers/web/admin/updates.go:269:3: too many arguments in call to ctx.NotFound
    routers/web/admin/updates.go:276:3: too many arguments in call to ctx.NotFound

Fix: drop the first string argument from each call site. Behaviour is
unchanged (NotFound always logs the underlying error; the "name" tag I
was passing was previously used only as a log prefix, which the new
signature no longer needs because Gitea logs the caller location).

Verified the pattern against the actual usages in the codebase:

    routers/web/shared/packages/packages.go:217:  ctx.NotFound(err)
    routers/web/shared/actions/runners.go:248:    ctx.NotFound(util.NewPermissionDeniedErrorf(...))
    routers/web/shared/actions/runners.go:355:    ctx.NotFound(errors.New("runner not found"))

After this lands, the v0.1.1 tag retry is the same dance as v0.1.0:
delete the tag ref, recreate against new main HEAD, the workflow
re-fires with the warm buildx cache from this run.

Co-authored-by: Claude <noreply@anthropic.com>
@rg4444 rg4444 merged commit 3236814 into main May 23, 2026
13 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant