Skip to content

fix: report correct file count in list quota error message#93

Merged
bug-ops merged 1 commit intomainfrom
list-quota-count-off-by-one
Mar 15, 2026
Merged

fix: report correct file count in list quota error message#93
bug-ops merged 1 commit intomainfrom
list-quota-count-off-by-one

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 15, 2026

Summary

  • Fixes off-by-one in inspection/list.rs quota error message for both TAR and ZIP loops
  • The condition total_entries >= max_file_count fires before the current entry is counted, so current was incorrectly set to manifest.total_entries (equals the limit) instead of manifest.total_entries + 1 (the would-be count)
  • Result: error now correctly says 10001 > 10000 instead of the nonsensical 10000 > 10000

Changes

  • crates/exarch-core/src/inspection/list.rs: current: manifest.total_entriescurrent: manifest.total_entries + 1 at TAR (line ~165) and ZIP (line ~245) quota check sites
  • Tests added/updated to assert current == max_file_count + 1

Test plan

  • test_list_archive_quota_exceeded (TAR): asserts current == 2 when max_file_count == 1
  • test_list_zip_quota_exceeded_file_count (ZIP): same assertion
  • All 516 nextest tests pass
  • fmt + clippy clean

Closes #91

@github-actions github-actions bot added core Changes to exarch-core docs Documentation labels Mar 15, 2026
In inspection/list.rs, the quota check fires when total_entries equals
max_file_count (before the current entry is counted). The error was
reporting current: manifest.total_entries which equals max at check
time, producing nonsensical messages like "10000 > 10000".

Fix: use manifest.total_entries + 1 at both TAR and ZIP quota check
sites so the message correctly reflects the would-be count after adding
the violating entry (e.g. "10001 > 10000").

Closes #91
@bug-ops bug-ops force-pushed the list-quota-count-off-by-one branch from f9e7317 to a051483 Compare March 15, 2026 00:49
@bug-ops bug-ops enabled auto-merge (squash) March 15, 2026 00:50
@bug-ops bug-ops merged commit 7acdc66 into main Mar 15, 2026
20 checks passed
@bug-ops bug-ops deleted the list-quota-count-off-by-one branch March 15, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to exarch-core docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: list quota error message reports wrong file count (off-by-one in current field)

1 participant