Skip to content

CI: set Cacti fixture ownership to runner:www-data in Setup Permissions - #100

Merged
TheWitness merged 3 commits into
developfrom
ci/setup-permissions-ownership
Nov 3, 2026
Merged

TheWitness merged 3 commits into
developfrom
ci/setup-permissions-ownership

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

Aligns the Setup Permissions step of the plugin CI workflow with the fix from Cacti/plugin_evidence#63.

The step previously chowned the Cacti fixture tree to www-data:runner. Composer runs as the runner user in a later step and calls touch() while generating the fixture autoloader; utime() only succeeds for the file owner, so the runner user must own the tree. This changes ownership to runner:www-data (www-data retained as the group), with an explanatory comment.

Change

-        sudo chown -R www-data:runner ${{ github.workspace }}/cacti
+        sudo chown -R runner:www-data ${{ github.workspace }}/cacti

Fleet-wide consistency update across plugin_* repositories.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Composer runs as the runner user in a later CI step and calls touch()
while generating the fixture autoloader; utime() only succeeds for the
file owner, so the runner user must own the tree. www-data is retained
as group and ownership is handed back before polling. Mirrors the fix
in Cacti/plugin_evidence#63.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the CI fixture ownership change.

No open issues 🎉

What changed in this PR

Updates the Cacti fixture ownership in plugin CI so Composer runs as the file owner while www-data retains group access.

Changes:

  • Changes ownership from www-data:runner to runner:www-data in Setup Permissions.
  • Adds a comment explaining the ownership requirement and later handoff before polling.
File Description
.github/​workflows/​plugin-ci-workflow.yml Adjusts fixture ownership for Composer and documents the rationale.

Review effort: Balanced

@somethingwithproof somethingwithproof left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ownership change itself is consistent and fixes Composer’s utime() failure, but all PHP jobs are red on the six retention-sensitive authentication fixtures fixed in #99. #99 and #100 currently form a CI cycle. Combine or stack both changes on one head and rerun before approval.

TheWitness and others added 2 commits November 3, 2026 10:01
The AuthAuditIngestionTest fixtures used hard-coded 2026-07-25
timestamps. New-row ingestion in audit_poll_user_log() only selects
source rows newer than the retention lower bound (audit_retention,
default 90 days). Once wall-clock time advanced 90 days past the fixed
fixture date (2026-10-23), every new-row ingestion scenario selected
nothing, so six tests that expect events began failing while scenarios
that assert emptiness or use the cutoff-free pending/retry path kept
passing.

Anchor the affected fixtures to a fixed-but-recent UTC date derived from
the current time via a cached audit_auth_test_recent_datetime() helper,
so the fixtures stay inside the retention window no matter when the suite
runs. This mirrors the existing time()-relative pattern already used by
the timezone-stability test. Pending/retry fixtures that carry an
explicit source_epoch and bypass the cutoff are left unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The concurrent-poller, lost-claim, and retention-exclusion scenarios
still carried hard-coded 2026-07-25 / June dates. At the current test
clock those rows are filtered by the 90-day (and 30-day) retention
cutoff before reaching the deduplication, claim-conflict, and
admission branches they are meant to cover, so a reject-all
implementation would pass them.

Derive the fixture times from the test clock via the existing
audit_auth_test_recent_datetime() helper (and a clock-relative old
row) so the in-window rows stay inside the retention window, and add
admitted-path assertions:

- concurrent poller: positive control proves the same in-window row is
  ingested once the concurrent claim is cleared.
- lost claim: positive control proves the row is ingested once the
  claim race is won.
- retention exclusion: assert the in-window 'recent' row IS recorded
  while the pre-cutoff 'old' row is dropped.

Verified a reject-all poll fails all three scenarios. Full suite:
125 passed (596 assertions). Test-only change; no product code touched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit aee3562 into develop Nov 3, 2026
7 checks passed
@TheWitness
TheWitness deleted the ci/setup-permissions-ownership branch November 3, 2026 17:45
TheWitness pushed a commit that referenced this pull request Nov 3, 2026
Composer generates the fixture autoloader as the runner user in a later
step and calls touch(), whose utime() only succeeds for the file owner.
Give the runner user ownership of the Cacti tree during Setup Permissions
(www-data retains group access); ownership is handed back to www-data
before polling. Mirrors the already-merged workflow fix from #100 so this
branch can clear CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
somethingwithproof pushed a commit that referenced this pull request Nov 3, 2026
* Fix time-bomb in authentication audit ingestion tests

The AuthAuditIngestionTest fixtures used hard-coded 2026-07-25
timestamps. New-row ingestion in audit_poll_user_log() only selects
source rows newer than the retention lower bound (audit_retention,
default 90 days). Once wall-clock time advanced 90 days past the fixed
fixture date (2026-10-23), every new-row ingestion scenario selected
nothing, so six tests that expect events began failing while scenarios
that assert emptiness or use the cutoff-free pending/retry path kept
passing.

Anchor the affected fixtures to a fixed-but-recent UTC date derived from
the current time via a cached audit_auth_test_recent_datetime() helper,
so the fixtures stay inside the retention window no matter when the suite
runs. This mirrors the existing time()-relative pattern already used by
the timezone-stability test. Pending/retry fixtures that carry an
explicit source_epoch and bypass the cutoff are left unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review: exercise admitted ingestion paths in time-bomb fixtures

The concurrent-poller, lost-claim, and retention-exclusion scenarios
still carried hard-coded 2026-07-25 / June dates. At the current test
clock those rows are filtered by the 90-day (and 30-day) retention
cutoff before reaching the deduplication, claim-conflict, and
admission branches they are meant to cover, so a reject-all
implementation would pass them.

Derive the fixture times from the test clock via the existing
audit_auth_test_recent_datetime() helper (and a clock-relative old
row) so the in-window rows stay inside the retention window, and add
admitted-path assertions:

- concurrent poller: positive control proves the same in-window row is
  ingested once the concurrent claim is cleared.
- lost claim: positive control proves the row is ingested once the
  claim race is won.
- retention exclusion: assert the in-window 'recent' row IS recorded
  while the pre-cutoff 'old' row is dropped.

Verified a reject-all poll fails all three scenarios. Full suite:
125 passed (596 assertions). Test-only change; no product code touched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* CI: set Cacti fixture ownership to runner:www-data in Setup Permissions

Composer generates the fixture autoloader as the runner user in a later
step and calls touch(), whose utime() only succeeds for the file owner.
Give the runner user ownership of the Cacti tree during Setup Permissions
(www-data retains group access); ownership is handed back to www-data
before polling. Mirrors the already-merged workflow fix from #100 so this
branch can clear CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

4 participants