32 lines
2.1 KiB
Markdown
32 lines
2.1 KiB
Markdown
# Scratchpad: t_301e4e3b pr-merge.sh Gitea empty-uid fallback
|
|
|
|
## Task
|
|
|
|
Implement a narrow hardening in `packages/mosaic/framework/tools/git/pr-merge.sh` so Gitea merges recover from the known non-interactive `tea pr merge` identity failure: `user does not exist [uid: 0, name: ]`.
|
|
|
|
## Constraints
|
|
|
|
- Preserve Mosaic policy gates: squash-only, base branch `main`, queue guard unless explicitly skipped.
|
|
- Preserve the existing authenticated Gitea API fallback when no tea login exists.
|
|
- Do not fallback on arbitrary tea failures.
|
|
- Do not expose tokens or credential-bearing remotes.
|
|
- Scope is limited to the merge wrapper plus focused test/support/scratchpad files.
|
|
|
|
## External issue
|
|
|
|
- Gitea issue #520: Harden pr-merge.sh Gitea empty-uid fallback
|
|
|
|
## Plan
|
|
|
|
1. Add a focused shell regression harness with mocked `tea` and `curl` proving the known empty uid/name failure must fall back to Gitea API.
|
|
2. Watch the harness fail on current code.
|
|
3. Implement helper functions in `pr-merge.sh` for redacted command display, known failure classification, and authenticated Gitea API merge fallback.
|
|
4. Keep unknown `tea` failures blocking by replaying stderr and exiting non-zero.
|
|
5. Run syntax, shellcheck if available, focused regression, and repo quality gates before push/PR.
|
|
|
|
## Session log
|
|
|
|
- 2026-05-22: Read Kanban context, Mosaic global/repo instructions, created isolated branch `fix/t_301e4e3b-pr-merge-gitea-empty-uid`, and opened Gitea issue #520 using the Mosaic issue wrapper/API fallback.
|
|
- 2026-05-22: Added regression harness and watched it fail on current behavior with `user does not exist [uid: 0, name: ]`; implemented narrow fallback and verified known-empty-identity fallback, arbitrary tea failure blocking, and no-tea-login API fallback paths.
|
|
- 2026-05-22: Validation passed for `bash -n`, `shellcheck -x`, focused shell harness, `pnpm typecheck`, `pnpm lint`, `pnpm format:check`, and `pnpm --filter @mosaicstack/mosaic test`. Full `pnpm test` exposed an out-of-scope gateway DB setup failure (`relation "messages" does not exist`) in `apps/gateway/src/__tests__/cross-user-isolation.test.ts`.
|