Skip to content

fix(backup): reject --keep 0 - #139

Merged
BaaRai merged 1 commit into
mainfrom
fix/backup-keep-zero
Nov 3, 2026
Merged

BaaRai merged 1 commit into
mainfrom
fix/backup-keep-zero

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Bug

scripts/backup.sh --keep 0 passed validation (the check only rejected non-digits), then prune ran tail -n +1 over the newest-first listing and deleted every dump, including the one written seconds earlier, and still printed backup complete.

Fix

The --keep check now also rejects values starting with 0. That covers 0 and also leading zeros such as 08, which $((KEEP + 1)) would read as octal and abort on after the dump was already written.

Verification

  • bash -n scripts/backup.sh: OK.
  • scripts/backup.sh --keep <v> for 0, 00, 07, -1, abc: exit 2 with the usage message, before any docker command runs.
  • The new case pattern run on its own: 1, 14, 100 are accepted; 0, 08 are rejected.

Not verified:

  • A full run with a valid --keep. It needs the compose stack, and I did not run it against the live one.
  • shellcheck: not installed on this machine. The shellcheck CI step proposed in a separate PR would cover it.

With --keep 0, prune ran tail -n +1 over the newest-first listing and deleted
every dump, including the one written seconds earlier, then reported success.
The check also rejects leading zeros, which the $((KEEP + 1)) arithmetic would
parse as octal (08 and 09 abort the script after the dump).
@BaaRai
BaaRai merged commit 5e872cc into main Nov 3, 2026
3 checks passed
@BaaRai BaaRai mentioned this pull request Nov 4, 2026
usinfosec pushed a commit to usinfosec/ARTEX that referenced this pull request Nov 17, 2026
合并 codex/approval-record-filters,解决与 BaaRai#133 在
web/src/components/approval-records.tsx 的冲突:

- 导入同时保留 InterceptApprovalFilter 与 InterceptPending。
- load() 采用 BaaRai#133 的独立待审批队列(Promise.allSettled 拉取
  /intercept/pending),并把 BaaRai#139 的 filter 参数透传给历史分页调用;
  筛选只作用于历史记录,待处理队列不受 filter 影响,保证跨页/被筛
  记录仍可审批。
- decide() 保留 BaaRai#133 的乐观更新(移除 pendingRows 对应项)叠加 BaaRai#139
  决策后重新拉取以对齐筛选后的计数与行。

验证:前端 tsc 通过、Biome 仅剩预存告警;go build/vet 通过;
db TestInterceptApprovalFilters(8 子用例)与 server
TestInterceptFilterHTTP 在本地 dev 库均通过。

Closes BaaRai#139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants