Category: Field Notes

  • PHP Security Update: Check and Patch Your WordPress Server

    On October 22, 2026, a message from our cloud provider flagged the latest PHP security issues. We went to check what our own WordPress server was actually running.

    It was still on PHP 8.3.35. We pulled the updated Docker image and checked again: 8.3.36. Good. Except the website itself was still using 8.3.35. The patched image was on disk, but we hadn't replaced the running container yet. That's the step worth checking before you close the terminal.

    Here's how we checked and updated our site on October 22. We use Docker Compose, with Apache inside the WordPress container and Nginx in front. If your setup is similar, you can follow the same checks using your own service names. This was routine patching and verification; we didn't send exploit traffic to the site.

    What the PHP announcement says

    PHP published fixes for CVE-2026-109618 and CVE-2026-109619 on October 21. Both can lead to unauthenticated remote code execution. The fixed releases in supported branches were 8.2.35, 8.3.36, 8.4.27, and 8.5.12. The announcement covers web-serving installations, including PHP-FPM and Apache with mod_php; it identifies mod_php as the highest-risk configuration. Updating PHP is the complete fix. Temporary mitigations address particular paths and do not make an installation safe. See the PHP security announcement.

    Reading this later? Check for newer security releases before choosing a version. These were the release-day fixes for these two issues. If your Linux vendor backports patches, check its advisory too: a package can contain a fix without adopting the upstream release number.

    Updating WordPress and updating PHP are different jobs

    It's tempting to head straight for the WordPress Updates screen. That takes care of the application, but PHP lives underneath it. A successful dashboard update doesn't tell you whether the server's PHP package or container changed.

    On our site, WordPress files live in a persistent volume and MySQL runs as a separate service. We could replace the web container while keeping those files and the database. The catch: updating PHP on the host wouldn't update PHP inside that container.

    So first, find out where your site's PHP comes from:

    • On managed hosting, ask the provider for the patched PHP release or the package advisory confirming a backport.
    • On a server with PHP-FPM, identify the pool and service handling the site's requests.
    • With Docker, identify the web service, its image, and the container currently using it.

    If you're starting in the WordPress dashboard, look under Tools → Site Health → Info → Server. Keep a note of the version so you can compare it after the update.

    Start with the container that's running now

    Our Compose service is called wordpress. From the directory containing the Compose file, you can identify the running container and check its PHP binary with:

    docker compose ps wordpress
    docker compose exec -T wordpress php -v
    docker inspect --format '{{.Image}}' \
      "$(docker compose ps -q wordpress)"

    Before the update, the container reported:

    PHP 8.3.35 (cli)

    That gave us a useful starting point: the CLI binary inside the web container was on 8.3.35. We still wanted to check a request through Apache after the update. We'll come back to that below.

    We saved the running image ID too. The tag wordpress:php8.3-apache is a moving label. It may point to a newer image tomorrow, while your existing container keeps running the one it started with.

    Pull the new image—and check what's in it

    We were already using the official wordpress:php8.3-apache image, so we stayed on PHP 8.3 for this update:

    docker pull wordpress:php8.3-apache
    docker run --rm --entrypoint php \
      wordpress:php8.3-apache -v

    The downloaded candidate reported:

    PHP 8.3.36 (cli)

    This was the important pause. The downloaded image had 8.3.36, but the live container still had 8.3.35. A pull puts an image on the server. The running container needs to be replaced before the website can use it.

    If that second command still shows an affected version on your server, stop and check whether a patched image is available. The download can succeed even when it hasn't brought you the version you need.

    Save the site before replacing the container

    Before touching the running service, we saved a consistent MySQL dump, an archive of the WordPress file volume, and a copy of the Compose configuration in a private backup directory. We checked that both archives contained data and kept the previous image under a local recovery tag.

    Each piece has a job. Posts and settings are in the database. Uploads, themes, plugins, and configuration are in the file volume. PHP and its packaged components come from the image. Saving the image alone won't save your articles or uploads.

    We kept the old image for recovery, with one obvious catch: it contained the vulnerable PHP release. If we had needed to use it again, we would also have needed to address the site's exposure while finding a working patched build.

    On a busy site, plan around incoming writes so the database and files can be recovered together. Our database dump and file archive were separate operations, rather than one atomic snapshot of the whole site.

    Recreate the web service

    After the version check and backups, we replaced only the WordPress service:

    docker compose up -d --no-deps --force-recreate wordpress
    docker compose exec -T wordpress php -v

    Now the running container reported PHP 8.3.36. Its image ID matched the one we'd downloaded. The update had reached the service handling the site.

    Here, --no-deps let us replace the web service without starting its dependencies. Review your own volume and network settings before running it. In particular, keep the persistent volumes: that's where the site data lives.

    A container recreation can briefly interrupt requests. Schedule accordingly if your site handles transactions or has availability requirements.

    Ask the web server which PHP it is using

    Seeing the right version in the terminal was encouraging. We wanted one more check through the web server, because a machine can have several PHP installations and a shell command may reach a different one from a visitor's request.

    We used a tiny, temporary PHP probe returning only PHP_VERSION and PHP_SAPI. We requested it through the local Apache listener, then removed it. Those two values answered our question without leaving a full phpinfo() page exposing configuration details.

    The response was:

    {"php":"8.3.36","sapi":"apache2handler"}

    That was the result we needed: an HTTP request through Apache was using 8.3.36. If your deployment has separate workers or other websites, check those runtimes separately.

    If you use PHP-FPM instead, verify the pool behind the relevant virtual host and restart or replace its workers as required by your deployment. If you use managed hosting, combine the web-reported version with the provider's patch confirmation.

    Take a quick walk through the site

    With PHP updated, it was time to check the site itself. We requested the homepage, an existing article, the login page, the sitemap, and ads.txt. All returned HTTP 200. We also checked the recent web-container logs for PHP fatal errors, parse errors, and warnings; none matched that check.

    For a content site, those are useful first checks. Administrative workflows and scheduled tasks need their own checks. If you run a shop, extend your list to checkout, payments, email, and background processing before calling the maintenance done.

    We also checked that the article's HTML still contained one analytics loader and one AdSense loader. If you rely on those services, check their dashboards as well; a script in the page is only one part of the setup.

    Leave yourself a useful record

    You don't need a long report to make the next update easier. We kept the old and new versions, image IDs, backup location, the web-runtime response, and the checks we'd run. That gives us something concrete to compare next time.

    Keep that record privately, with the date and the advisory you followed. If you share the experience publicly, leave out credentials, private backup paths, and full environment output—and remove temporary diagnostic files when you're finished.

    If you've just pulled the patched image, go back to the running container and check its version. That was the gap in our own update sequence: the fixed image was on disk before it was serving the site. Recreating the container and checking an HTTP request closed that gap.

    For a different example of checking what a successful-looking operation actually produced, see why a MySQL count query returns 1 instead of the real total.

  • Why Your MySQL Count Query Returns 1 Instead of the Real Total

    Your export says the total is 1, even when you know there are more rows. Start with the count SQL. If it looks like SELECT COUNT(*) FROM (SELECT COUNT(*) FROM ...) AS counted, the outer query is counting the one summary row the inner query produced. The number inside that row never gets read.

    Run the exact count statement directly before editing it. If SQL returns the right value but PHP shows 1, check the result-reading code. mysqli_result::$num_rows counts result rows, and a count query normally has just one. Read the value in its first column instead. Below, we're dealing with the other case: the SQL total itself is wrong.

    For an ungrouped detail export, you can usually use the inner count directly. With GROUP BY, though, that outer count might belong there. First decide what a row in the exported file is supposed to represent.

    Download the complete SQL examples. The file includes all eight cases with expected results. Each statement contains its own synthetic fixture and runs on MySQL 8.0+ without creating tables or changing data.

    We found this pattern while reviewing a real PHP export builder. It tried to replace the selected columns with COUNT(1), then wrapped the result in COUNT(*). There was another catch: the replacement expected spaces where the SQL template had line breaks.

    That's an awkward bug to untangle. A failed replacement can leave you with a meaningful total. Fix the replacement so it matches, and you may suddenly get 1.

    We'll use invented table names and three synthetic rows to show why. They reproduce the counting pattern, without company data. This is a code review and a worked example, rather than a report of a fix deployed to production.

    Start with three rows and two orders

    Here's a small fixture you can reason through without a large export file. It uses a MySQL 8.0+ common table expression, so there's no table to create:

    WITH items AS (
        SELECT 1 AS item_id, 10 AS order_id
        UNION ALL SELECT 2, 10
        UNION ALL SELECT 3, 20
    )
    SELECT COUNT(*) AS total
    FROM items;

    The result is 3. There are three item rows, belonging to two orders.

    For the snippets below, keep the same WITH items AS (...) fixture and swap the final SELECT. The CTE exists for one statement only. If you'd rather run each case as-is, the download includes the fixture in every statement.

    Now wrap a count inside another count:

    SELECT COUNT(*) AS total
    FROM (
        SELECT COUNT(*) AS item_count
        FROM items
    ) AS counted;

    You get 1. Start inside the query and follow what each layer receives:

    1. The inner query produces one row whose item_count value is 3.
    2. The outer query receives that one row.
    3. The outer COUNT(*) returns 1.

    The outer query doesn't read item_count. It just counts the row containing it. Swapping COUNT(*) for COUNT(1) won't help; you'll still have the extra aggregation layer.

    MySQL documents that an aggregate query without GROUP BY treats its input as one group, and that COUNT(*) counts rows. Those two rules explain this result. See the MySQL aggregate-function reference.

    The empty-result test catches it immediately

    Try a filter that matches nothing:

    SELECT COUNT(*) AS total
    FROM items
    WHERE order_id = 99;

    This correctly returns 0. But the nested version still returns 1:

    SELECT COUNT(*) AS total
    FROM (
        SELECT COUNT(*) AS item_count
        FROM items
        WHERE order_id = 99
    ) AS counted;

    Zero is still a value inside a row. The inner count produces that row, and the outer count happily counts it.

    This is why we'd include an empty filter in the regression checks. A wrong total of 1 can look perfectly reasonable if you test with one record. It's harder to miss when the answer should be zero.

    When the outer count should stay

    Now suppose you want one exported row per order. There are two orders in our fixture, so the total should be 2—even though there are three item rows.

    SELECT COUNT(*) AS total
    FROM (
        SELECT order_id
        FROM items
        GROUP BY order_id
    ) AS grouped;

    Here the inner query returns two rows, one per order. The outer query counts exactly what we want.

    Remove the wrapper and use SELECT COUNT(*) FROM items GROUP BY order_id, and you'll get two values: 2 and 1. If the export worker reads only the first, it could use the size of one group as the total for the job.

    Keep any HAVING condition that controls which groups are exported:

    SELECT COUNT(*) AS total
    FROM (
        SELECT order_id
        FROM items
        GROUP BY order_id
        HAVING COUNT(*) >= 2
    ) AS grouped;

    This returns 1, because only order 10 has at least two item rows. Dropping HAVING would count groups the export excludes.

    An outer count also works for a distinct result:

    SELECT COUNT(*) AS total
    FROM (
        SELECT DISTINCT order_id
        FROM items
    ) AS distinct_orders;

    That gives 2 as well. If your export removes duplicates across several columns, keep that same combination in the inner query. Counting distinct orders instead could give you a different answer.

    These subqueries are derived tables: the outer query operates on the rows they return. MySQL's derived-table documentation explains the syntax and alias requirement.

    Why a harmless formatting change can reveal the bug

    Back to the PHP builder. It performed two steps in a row: replace the selected columns with a count, then wrap the SQL in another count. This is a simplified version:

    $countSql = preg_replace(
        '/SELECT concat([\s\S]*) FROM returns/',
        'SELECT count(1) FROM returns',
        $exportSql
    );
    $totalSql = "SELECT COUNT(*) FROM ($countSql) AS counted";

    Notice the literal space after SELECT and before FROM. The template we reviewed had a newline after SELECT. In our synthetic PHP check, the multiline version made zero replacements; a matching single-line version made one.

    When the replacement doesn't match, the wrapper counts rows from the original detail query. When it does match, an ungrouped inner count produces one summary row. The wrapper then counts that row and gives you 1.

    So getting the regex to match is only half the job. Check the SQL it leaves behind before deciding the bug is fixed.

    For diagnosing existing regex-based builders, capture the replacement count:

    $countSql = preg_replace(
        $pattern,
        $replacement,
        $exportSql,
        -1,
        $replacements
    );
    if ($countSql === null || $replacements !== 1) {
        throw new RuntimeException('Count-query rewrite did not match once');
    }

    This catches an error or an unexpected number of replacements. It does not prove that the generated SQL counts the right thing. PHP's preg_replace documentation describes the replacement-count argument and return values.

    For an export builder we're maintaining, we'd build the data and count queries explicitly from shared filters and parameters. Asking a broad regex to understand nested queries, comments, aliases, and string literals leaves plenty of room for surprises.

    Choose the count that matches your export

    Before touching the count, finish this sentence: ‘One exported row represents…’ Then choose the shape that counts that thing.

    One exported row represents Count approach Check carefully
    One joined detail row Direct COUNT(*) over the same joins and filters A one-to-many join can multiply rows
    One order regardless of item count Count the grouped or distinct order result Detail-row count is a different total
    One group meeting an aggregate condition Count a subquery retaining GROUP BY and HAVING Removing HAVING changes eligibility
    One distinct combination of fields Count the exact distinct result Distinct on just one field can undercount

    Use the same filters and bound values in both queries. A status, date, or existence condition that's missing from the total can make an otherwise sensible count disagree with the file. Bind input values as parameters.

    For a total across all matching rows, exclude batch LIMIT and OFFSET. Keep a limit only when the product deliberately exports a capped result and the total is supposed to describe that cap. Similarly, remove ordering only when it does not affect which rows are selected.

    Wrapping the original result query is a useful starting point for checking correctness. Once the numbers agree, look at the execution plan with representative data. These three-row examples tell us about the count's meaning; they don't tell us how fast your production export will run.

    Verify the generated SQL and its consumer

    We ran the synthetic cases on MySQL 8.4. The checks covered direct and nested counts, empty results, grouped results, HAVING, and DISTINCT.

    Case Expected total
    Three detail rows 3
    Count wrapped around an ungrouped count 1
    Empty detail result, direct count 0
    Empty detail result, nested count 1
    Two grouped orders 2
    Empty grouped result 0
    Groups with at least two items 1
    Distinct order IDs 2

    Check both ends of your own count path: the SQL sent to the database and the value the worker reads back. The consumer we inspected takes the first column of the first row when a count query is supplied. For that path, the query needs to return one scalar total.

    Then compare that total with the file for a small, fixed dataset. Include no matches, several items for one order, and several orders. If records can change between counting and exporting, check snapshot consistency too; a correct count query can't hold changing data still.

    A query can run without error and still count the wrong thing. Compare its total with the rows your export actually contains.

    If your count query fails with an ambiguous-column error instead of returning the wrong number, see our related investigation of an unqualified GROUP BY column. That article follows column ownership through a generated export query; this one focuses on the shape of the total itself.

    If the total is correct but rows disappear later, follow the batch through the formatter and writer in the CSV export completeness investigation.

  • Why an Expired Payment Link Can Block a New Request

    The old payment link has expired. You try to create a new one, and the system says there's already a request in progress. How can both be true? In the code we reviewed, expiry and the stored request status had drifted apart.

    If you’ve ever had a website insist that something is still active after it stopped working, you know how maddening that feels. The link was done. The database just hadn’t gotten the memo.

    We followed this one through Git history with AI helping us compare revisions. It's a business-system example, with identifying details and real order data left out. The history shows how the code changed; it doesn't tell us whether AI helped write the original fix.

    The rule made sense—until time got involved

    The duplicate check had a sensible job: don't let staff create a second payment request while one is unfinished. When the first link still works, that's exactly the behavior you want.

    The catch was time. The duplicate check read the stored status without checking the request's age. Elsewhere, the system treated a link as expired after 48 hours. Opening that expired link could mark its record invalid. Leave it unopened, though, and the record could keep looking unfinished.

    So the two parts of the system disagreed. One said, “This link has expired.” The other said, “There’s still a payment request in progress.” The second answer won, and the new link never got created.

    What the Git history revealed

    The history filled in the sequence. The partial-payment feature came first, then a dedicated permission check a few days later. About a month after the original change, another commit addressed expired records blocking the next request.

    The permission review is a separate case from this expiration problem. They concern the same feature, but answer different engineering questions.

    We couldn't get that explanation from the messages alone. We had to read the earlier and later code, then follow both the expiry check and the path that creates a request.

    One detail was easy to get wrong: a comment mentioned 15 minutes. That check had been commented out; the active rule was 48 hours. It's worth checking the condition itself before copying a number from a comment into your own fix.

    The fix cleans up the old request before checking for duplicates

    The newer code deals with eligible expired requests for the current order first. If an unfinished request is old enough to expire, it marks it invalid. Then it runs the duplicate check again, so a genuinely active request can still block a second one.

    Both steps sit inside the same transaction. So if a later check rejects the request, or creating it fails, the cleanup rolls back too. That detail matters when you're trying to understand what remains in the database after an unsuccessful attempt.

    The cleanup happens when someone tries to create a request. There isn't a scheduled sweep here clearing every old payment record.

    What still needs testing

    Before treating this as a finished fix in your own system, we'd check a few cases:

    • An expired unfinished request should stop blocking a new one.
    • A recent unfinished request should still prevent a duplicate.
    • If another active request exists, the operation should fail and the transaction should restore any status it changed.
    • If creating the new request fails, the transaction should roll back the cleanup.
    • Simultaneous requests and delayed payment callbacks need a closer look at the surrounding locking and callback logic.

    Those are the tests we'd want to run in a safe environment. This review followed the source code; we didn't run the scenarios against production or verify the deployment date.

    A useful way to investigate “stuck” records

    If you're chasing a similar ‘still in progress’ message, put three things side by side: the status in the database, the expiry condition, and the code that updates the status. Time can run out on a link without anything having written that fact back to its record.

    Then follow the sequence from the old link to the new request:

    1. Find the rule that decides whether the old link is still usable. Read the active condition, not only its comment.
    2. Find the query that blocks duplicate requests. Check whether it reads status, creation time, or both.
    3. List every path that changes the stored status. Ask what happens if the expired link is never opened again.
    4. Inspect the creation transaction. If it marks an old request invalid and a later step fails, determine whether that change rolls back.
    5. Test an expired request, a recent request, and two competing requests in a safe environment. Record the observed result rather than assuming the code covers every timing case.

    AI was useful for finding related commits and following the two paths together. The important part was checking the conditions it found. To find out what users actually experienced after the change, we'd still need deployment records and monitoring.

    Check the stored state after a failed attempt

    For a synthetic test, give one order an expired unfinished request and another active request. The cleanup may invalidate the expired record temporarily, but the active request should reject creation. Under the transaction described above, that rejection rolls the cleanup back. Inspect the stored state after the transaction finishes; a log line from inside it is not enough.

    Starting point Expected committed result
    Expired request only; creation succeeds Old request invalid; one new request created
    Expired request plus active request Creation rejected; cleanup rolled back
    Expired request; creation fails No new request; old status restored by rollback

    These are proposed checks, not newly measured production results. Download the expiry test worksheet to record what your implementation actually does. It also leaves concurrency and delayed callbacks as separate investigations.

  • How to Investigate an Unqualified GROUP BY Column in a SQL Export

    One export fix changed a single column in a GROUP BY clause. The commit message just said ‘Fix export issue.’ Before the change, the column had no table alias. Afterward, it did. We wanted to know why that tiny edit mattered.

    There wasn't much to go on in the diff, so we followed the query around it: which tables did it join, which table owned the field, and what kind of row was the export supposed to produce?

    We used AI to help read the commit and surrounding query. The example comes from a business system, with identifying details left out. We had the code change, but no linked incident report showing the error users saw or when the fix was deployed.

    Where the line sat

    The line sat in an order export's item-detail branch. That branch grouped by an order ID and an item attribute ID. Several tables were joined, including orders and export details, so the source of each grouping field mattered.

    Before the change, the GROUP BY clause referred to the item attribute ID by its bare column name. After the change, it used the export-detail table's alias. A simplified illustration looks like this:

    -- Before
    GROUP BY orders.id, attribute_id
    
    -- After
    GROUP BY orders.id, export_items.attribute_id

    The real code used different table and field names; this example is just a way to show the difference without copying production SQL.

    Why an alias matters

    When several joined tables have a column with the same name, a bare reference can be ambiguous. Even when the database can resolve it today, the next person reading the query has to work out which table you meant. Another join can make that small omission a problem later.

    The alias made that choice explicit: use the field from the export-detail row. For an order with several items or attributes, that's a detail you want to be able to see in the query.

    There are two things to check here. An ambiguous name can make the database reject the query. A query that runs can still group the wrong rows if the key or join relationships are wrong. The alias helps identify the key; you still have to check the output.

    We didn't find a captured failing query or a linked error report in this Git review. So we could explain the change, but couldn't honestly name the exact database error that prompted it.

    The checks that turn a clue into an answer

    If this export were failing in front of us, we'd work through these checks next:

    1. Get the exact SQL generated by the failing export and the database error, if one exists.
    2. Check which joined tables contain the column and whether the unqualified reference was ambiguous in the deployed schema.
    3. Compare row counts and a few representative orders before and after the change. A query that runs can still return the wrong number of rows.
    4. Confirm that the count query used for export progress is built from compatible SQL. An export can appear stuck or show the wrong total even when the data query itself works.

    These are the next checks we'd recommend. We didn't query production data as part of this review.

    What made this worth keeping

    A small diff can be a useful doorway into a bigger query. Here, reading the joins and the item-detail branch explained why the alias belonged there. It also showed us which questions the diff couldn't settle.

    AI can help find the changed line and follow the query around it. To finish the diagnosis, get the generated SQL, any database error, and a before-and-after output comparison. That's what turns a plausible explanation into a checked one.

    If you are writing up a change like this, our Git-to-case-study workflow shows how to keep the code evidence and unanswered questions together in the draft.

    If the query runs but the export total is always 1, see why a MySQL count query returns 1 instead of the real total, with eight runnable examples covering empty results, grouping and distinct rows.

    Run a small example with two different attributes

    The SQL exercise gives the order an attribute of 7 and its two item rows attributes of 101 and 102. Both sources have a column called attribute_id. The unqualified grouping is deliberately ambiguous. Grouping by the item’s attribute produces two groups; grouping by the order’s attribute produces one group containing two rows.

    That last query is useful because it runs successfully. An alias resolves which column you mean, but it can still identify the wrong business key. For an item-level export, check that the output retains both item attributes. The fixture uses MySQL 8.0+ CTEs and only SELECT statements; it creates no tables. Run each statement separately so the deliberate error does not prevent you from trying the other two.

    This exercise illustrates two distinct failure modes. It does not reconstruct the undocumented production error behind the original commit.

  • How to Audit Permissions Across a New Payment Action

    A payment button disappears for an account without permission. Good—but can that account still open the form directly? What about the endpoint that creates the request, or the QR-code page afterward? That's the route we followed through a ‘Request partial payment’ feature.

    With AI helping us read the Git history, we found a later commit adding a dedicated permission for the feature. This is a business-system example with identifying details left out. To find out which staff actually received that permission, we'd also need the deployed role settings.

    The first version borrowed existing permissions

    The earlier version borrowed existing permissions. Opening the form and fetching the QR code required general order-view access. Creating the request needed broader order-payment access, and the button followed that payment permission too.

    Those were permission checks, but they weren't asking quite the same question. Someone who can view an order doesn't necessarily need to start a partial payment. Once the feature becomes a separate business action, its access rule needs to follow that decision.

    The later change followed the whole path

    The later commit added a dedicated part_pay check to the form, create-request endpoint, and QR-code endpoint. It changed the button visibility check too, and the codebase included a permission mapping for the action.

    That gave us a path to review from end to end. The button was one stop on it. Someone might reach a form or result URL directly, so we wanted to see the checks on those routes as well.

    We broke the review into five questions:

    • Button: which permission decides whether staff see the action?
    • Form: does opening the form check the same dedicated permission?
    • Create endpoint: does the server check permission again before changing anything?
    • QR-code endpoint: can someone request the result directly without entering through the button?
    • Permission mapping: is the new permission defined, and which roles actually receive it?

    The source can help answer the first four. For the last one, open the actual role settings too. A permission defined in code doesn't tell you which staff have been granted it.

    We'd be careful about calling the whole flow secure from this one diff. We'd still check alternate routes, actual grants, and whether a QR-code request is tied to the correct record. What we could see here was that these particular routes had moved to the dedicated permission.

    A useful review pattern for new actions

    For another feature that changes money, stock, or customer data, follow the same route through the system:

    1. The page or button that introduces the action.
    2. The form that collects the request.
    3. The server endpoint that performs the action.
    4. Any related download, image, or result endpoint.
    5. The permission mapping and the actual grants used by staff roles.

    This is a useful task to give AI during review: map the routes and show the permission check on each one. Then open every path it lists. It's easy for a neat summary to miss a less obvious result or download endpoint.

    For testing, we'd use one role with permission and one without. Try the form and QR-code URL directly, then through the button. Also check that a rejected create request leaves no payment record behind. We didn't run those live-system tests in this Git review.

    When you add a new action, trace it past the button. The form, the write endpoint, and the result can each have their own route into the feature.

    The same payment feature also produced a different investigation: why an expired link could block a new request. Reviewing the route inventory and the record lifecycle separately made each question easier to verify.

    Turn the route inventory into a test matrix

    Use two test roles on a synthetic order: one with the feature permission and one without it. Give both only the underlying access your application normally requires, and record that setup. Otherwise, a denial caused by missing order access can hide a missing feature check.

    Entry point Without feature permission With feature permission
    Button and direct form URL Button hidden; direct access denied Available when business conditions permit
    Create endpoint Denied; no new payment record Still subject to order and amount validation
    Direct QR-code URL Denied Only the authorized record is accessible

    Repeat the direct requests with a record outside the role’s permitted scope. A feature permission should not erase record-level access rules. The permission worksheet marks every observed result as Not tested until you run it. These are acceptance criteria to verify, not a claim that the historical change passed them.