Skip to content

Fixed: The HTTP cache's role tests hold what happens without APCu (file-store and S1 legs) - #5

Open
se7enxweb wants to merge 1 commit into
cjw-network:mainfrom
se7enxweb:rs-pr-role-tests-without-apcu
Open

se7enxweb wants to merge 1 commit into
cjw-network:mainfrom
se7enxweb:rs-pr-role-tests-without-apcu

Conversation

@se7enxweb

@se7enxweb se7enxweb commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What fails

Since the HTTP cache's roles were merged (8f94bd1, Merge branch 'wip/g4-cache'),
the Tests workflow on main has failed on every leg without APCu: the six
file-store legs (PHP 8.0 … PHP 8.5 (file store)) and PHP 8.0, minimal hosting (S1).

Each of these legs fails the same two tests:

FAIL  CacheTest > RSF04-03 end to end, a page per role (0039): ...
      a session the shield does not know yet: the application runs
FAIL  ShowcaseTest > RSF04-03 showcase, the tab "Cache": ...
      member B: the members' page member A made --
FAIL - 518 passed, 2 failed, 13 skipped (PHP 8.3.35)

The legs with APCu pass.

Why

Roles are remembered in APCu only (0039). Without APCu they stay off, as the
proposal says: a session's page is the visitor's own, made by the application
each time, and nothing is kept for it. The library does exactly that. The two
tests, however, expect a member's page from the cache on every leg. Without
APCu, the first test never sees the X-RS-Cache: miss it waits for, and the
showcase test never sees member A's page served to member B.

So the code is right and the tests ask for something the proposal rules out
without APCu.

The fix

Tests only, no change in src/:

  • tests/helpers.php: serverApcu() says whether the servers a test starts
    (php -S, PHP-FPM) have APCu: the extension is loaded (they do not need
    apc.enable_cli) and TESTS_HOSTING is not minimal.
  • tests/CacheTest.php, "a page per role": with APCu, unchanged. Without it,
    the test holds what 0039 promises: a session's page comes from the
    application each time (the run counter goes up by two for two requests),
    nothing is kept for it (no X-RS-Cache: miss that a later request could
    hit), and anonymous visitors still get their kept page, never a session's.
  • tests/ShowcaseTest.php, the tab "Cache": with APCu, unchanged. Without it,
    member B gets the members' page from the application, not from the cache,
    and not the second time either.

Tested

…- roles stay off (0039), a session's page comes from the application each time and nothing is kept for it -- instead of failing on every leg without APCu

The end-to-end test "a page per role" and the showcase's tab "Cache" expected
a member's page from the cache on every leg, but roles are remembered in APCu
only: the file-store legs and the minimal-hosting leg (S1) failed on them
since the roles were merged. tests/helpers.php has serverApcu() (the servers a
test starts have APCu: the extension loaded, not TESTS_HOSTING=minimal); with
it the tests check the roles as before, without it they check that a
session's page is never kept or given from the cache and that anonymous
visitors still get their kept page.

This branch has not been deployed

No deployments
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