Skip to content

feat(tasks): find the newest sequence for a template, across every anchor - #3360

Merged
rubenvdlinde merged 1 commit into
developmentfrom
feat/newest-sequence-for-a-template
Sep 3, 2026
Merged

feat(tasks): find the newest sequence for a template, across every anchor#3360
rubenvdlinde merged 1 commit into
developmentfrom
feat/newest-sequence-for-a-template

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

The mapper could answer "what happened to THIS object" three ways and "has this approval ever run" not at all. findRunning, findForAnchor and findNewestForAnchor all constrain anchor_object_uuid, so an aggregate over a template had no anchor to pass.

findNewestForTemplate($templateId) fills that gap: one row off the existing template_id index, ordered like its siblings, limited in the query rather than trimmed in PHP.

Who needs it

buildiq's automation dry-run panel. It used to report the newest ApprovalStep status on a chain; when #3302 retired that surface there was no replacement for the aggregate, and the panel degraded to reporting nothing at all — tracked as the last open item on ConductionNL/buildiq#651. This is the query that lets it come back.

Verified with a negative control

Not just a green run. Adding an anchor predicate and dropping the limit makes the new test fail:

Failed asserting that an array does not contain 'anchor_object_uuid'.
Tests: 7, Assertions: 15, Failures: 1

That is the assertion that matters here — a template-wide finder which quietly constrained the anchor would answer a different question than the caller asked, and would do it silently. The second test covers the no-run case returning null.

phpcs clean (1 pre-existing warning, unchanged), phpstan [OK] No errors, and the suite passes: Tests: 7, Assertions: 16.

🤖 Generated with Claude Code

…chor

The mapper could answer "what happened to THIS object" three ways and "has this
approval ever run" not at all. Every existing finder constrains
anchor_object_uuid, so an aggregate over a template had no anchor to pass.

buildiq is the caller that needed it. Its automation dry-run panel used to read
the newest ApprovalStep on a chain; when #3302 retired that surface there was no
replacement for the aggregate, so the panel degraded to reporting nothing at all
(buildiq#651). This restores it.

One row off the existing template_id index, ordered like its siblings and
limited in the QUERY rather than trimmed in PHP.

Tested with a negative control, not just a green run: adding an anchor predicate
and dropping the limit makes the new test fail with "Failed asserting that an
array does not contain 'anchor_object_uuid'". A finder that quietly constrained
the anchor would answer a different question than the caller asked, which is the
one thing this method must not do.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 96c6a27

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-specs
test-l10n
test-l10n-parity
format
check-schema-l10n
check-l10n-js
composer ✅ 174/174
npm ✅ 543/543
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman
Playwright ⏭️ deferred — runs on the promotion into beta/main, not on a pull request into development
Hydra gates

Quality workflow — 2026-09-03 10:52 UTC

Download the full PDF report from the workflow artifacts.

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