Skip to content

Cover who may restore a version, and what the blocked-attempts grid shows - #727

Merged
blaipr merged 1 commit into
mainfrom
test/history-restore-and-track-grid
Aug 13, 2026
Merged

Cover who may restore a version, and what the blocked-attempts grid shows#727
blaipr merged 1 commit into
mainfrom
test/history-restore-and-track-grid

Conversation

@blaipr

@blaipr blaipr commented Aug 13, 2026

Copy link
Copy Markdown
Member

What

13 tests across the account history helper and the blocked-attempts grid, neither of which had a test file.

Who may restore a version

Restoring a historical version writes over the current account, so the test worth having is who is offered it: only a viewer who also has edit access. Both sides are asserted — the grant and the refusal — through the real actions helper rather than a stand-in, so it is the actual wiring being checked.

The history view also refuses outright without a prior grant, and refuses when the per-account ACL denies viewing.

Plus how a version is labelled in the date picker: by its editor once it has been edited, and by its creator for the first one — including when the edit date is stored as all zeroes, which is what the old schema wrote.

The blocked-attempts grid

The address as recorded, masked on a demo instance, and blank when there is none. The unlock action is offered only on rows that are still blocking.

That filter reads backwards at first glance — it filters on tracked = 0 — but the row template hides an action when the row's field matches the filter value, so it is correct. There is now an assertion saying so, which is the point of writing it down.

Two gaps left deliberately

  • Version.php's 32-bit comparison path is dead on any 64-bit runtime and cannot be reached without mocking a language constant. The 64-bit path already has boundary tests.
  • DataGridBase's remaining branches are plain accessors and a repeat of a missing-template check that is already covered on a sibling setter. One of them backs a property with no setter anywhere in the codebase.

One finding, not acted on

ErrorBase::view() is dead code: final protected, and none of its four subclasses call it — they each return ActionResponse::ok($this->view->render()) directly. Left uncovered rather than reached through an artificial subclass invented for the purpose.

…hows

Restoring a historical version writes over the current account, so the test
worth having is who is offered it: only a viewer who also has edit access. Both
sides are asserted, through the real actions helper rather than a stand-in. The
history view also refuses outright without a prior grant, and refuses when the
per-account ACL denies viewing.

Plus how a version is labelled in the date picker: by its editor once it has
been edited, and by its creator for the first one — including when the edit date
is stored as all zeroes, which is what the old schema wrote.

For the blocked-attempts grid: the address as recorded, masked on a demo
instance, and blank when there is none. The unlock action is offered only on
rows that are still blocking — the filter reads inverted at first glance, but
the row template hides an action when the field matches, so it is right; there
is now an assertion saying so.

Two gaps left deliberately: Version's 32-bit comparison path is dead on any
64-bit runtime and cannot be reached without mocking a language constant, and
the grid's remaining branches are accessors and a repeat of a template check
that is already covered.
@blaipr
blaipr merged commit 6489076 into main Aug 13, 2026
8 checks passed
@blaipr
blaipr deleted the test/history-restore-and-track-grid branch August 13, 2026 21:02
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.

1 participant