mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-08-29 02:04:30 +08:00
236d8c098f
* test(datasource): cover scoped sync deletions - deleted connector items remove the matching KB knowledge, scoped per data source via metadata datasource_id + external_id - SyncDeletions=false neither deletes nor counts - stream handler classifies deleted/failed items like the batch loop * fix(datasource): perform real sync deletions scoped per data source - applyFetchedItem now performs the KB deletion instead of only counting - lookup is scoped to datasource_id + external_id so identical external IDs from two data sources cannot collide or overwrite each other - ingestItem update-path lookup uses the same scoped query * fix(datasource): note failed deletions retry only on full sync - SyncResult.DeletionFailed tracks deletion failures (subset of Failed) - streaming partial message warns that failed deletions only retry on a full sync, since the connector cursor is checkpointed past the deleted item * fix(datasource): humanize deletion errors, keep raw detail in logs - raw lookup/delete errors go to server logs only, with full context - UI samples carry a humanized "see server logs" fallback - add datasource.syncError.* i18n keys Note: ko-KR / ru-RU syncError translations were generated without a native-speaker review. * fix(datasource): hard-delete synced rows and tighten deletion scoping Sync-internal deletions now call HardDeleteKnowledge after the soft-delete cascade so tombstones cannot block re-sync; subtree sweeps and URL metadata attach failures are handled with datasource scoping and explicit errors. * chore: add git hooks aligned with CI and PR checks Install via scripts/install-git-hooks.sh (sets core.hooksPath). Pre-commit runs whitespace/gofmt/golangci-lint on staged files; pre-push mirrors app/frontend/cli workflows on the diff since origin/main. * fix: gofmt test file; tighten pre-push to match CI app workflow Pre-push now gofmts the full PR diff and runs go vet on all app packages (like app.yml), not only Go files in the latest commit. Previous pushes skipped checks via --no-verify and because hook-only commits had no .go files. * fix(hooks): align pre-push diff with GitHub PR base via gh Use three-dot diff against the open PR baseRefOid (same as CI) instead of a two-dot merge-base range; run full go vet on every push with Go PR changes. * style: gofumpt datasource_service_test.go --------- Co-authored-by: wizardchen <wizardchen@tencent.com>
33 lines
930 B
Bash
Executable File
33 lines
930 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Install WeKnora git hooks (core.hooksPath -> scripts/git-hooks).
|
|
#
|
|
# Usage (from repo root):
|
|
# ./scripts/install-git-hooks.sh
|
|
#
|
|
# Bypass hooks for one command:
|
|
# SKIP_HOOKS=1 git commit ...
|
|
# SKIP_HOOKS=1 git push ...
|
|
#
|
|
# Skip slow go test on pre-push:
|
|
# HOOK_SKIP_TEST=1 git push ...
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
HOOKS_DIR="$ROOT/scripts/git-hooks"
|
|
|
|
if [[ ! -d "$HOOKS_DIR" ]]; then
|
|
echo "hooks directory not found: $HOOKS_DIR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
chmod +x "$HOOKS_DIR"/common.sh "$HOOKS_DIR"/pre-commit "$HOOKS_DIR"/pre-push
|
|
|
|
git -C "$ROOT" config core.hooksPath scripts/git-hooks
|
|
|
|
echo "Installed git hooks -> scripts/git-hooks"
|
|
echo " pre-commit: whitespace, gofmt (auto-fix), golangci-lint (if installed)"
|
|
echo " pre-push: PR gofmt + full go vet/build (like CI); scoped go test"
|
|
echo ""
|
|
echo "Optional: SKIP_HOOKS=1 or HOOK_SKIP_TEST=1 — see script header."
|