2.1 KiB
2.1 KiB
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
- Add a focused shell regression harness with mocked
teaandcurlproving the known empty uid/name failure must fall back to Gitea API. - Watch the harness fail on current code.
- Implement helper functions in
pr-merge.shfor redacted command display, known failure classification, and authenticated Gitea API merge fallback. - Keep unknown
teafailures blocking by replaying stderr and exiting non-zero. - 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, andpnpm --filter @mosaicstack/mosaic test. Fullpnpm testexposed an out-of-scope gateway DB setup failure (relation "messages" does not exist) inapps/gateway/src/__tests__/cross-user-isolation.test.ts.