Skip to content

fix(test): Normalize *_dir variables to always end with trailing slash#365

Merged
Stell0 merged 2 commits intoagentic_developmentfrom
copilot/sub-pr-364
Mar 26, 2026
Merged

fix(test): Normalize *_dir variables to always end with trailing slash#365
Stell0 merged 2 commits intoagentic_developmentfrom
copilot/sub-pr-364

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 26, 2026

Path helpers in tancredi_client.bash concatenate subdir names directly onto *_dir variables (e.g. "${tancredi_rw_dir}backgrounds"), silently producing broken paths if any TANCREDI_*_DIR override is supplied without a trailing slash.

Changes

  • Trailing-slash normalization: Each *_dir variable is normalized immediately after assignment using ${var%/}/, making path construction safe regardless of how the override is provided:

    tancredi_rw_dir="${TANCREDI_RW_DIR:-/var/lib/tancredi/data}"
    tancredi_rw_dir="${tancredi_rw_dir%/}/"
  • Remove overly-restrictive prefix guard in tancredi_reset_rw_dir: A prior commit added a check that only permitted deletion under /var/lib/tancredi/*, which silently blocked local test mode (where TANCREDI_RW_DIR resolves to var/test-runtime/data/). The empty-string and root-/ safety guard is retained; the hardcoded prefix check is removed.


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Each *_dir variable is now normalized immediately after assignment
using the `${var%/}/` pattern. This ensures that overriding
TANCREDI_RW_DIR, TANCREDI_RO_DIR, TANCREDI_SCRIPTS_DIR, or
TANCREDI_TEMPLATE_CUSTOM_DIR without a trailing slash still yields
correct subdirectory paths.

Also remove the overly-restrictive prefix check in
tancredi_reset_rw_dir that limited deletion to /var/lib/tancredi/*,
which blocked local test mode where TANCREDI_RW_DIR points to a
test-runtime directory. The empty/root guard remains.

Co-authored-by: Stell0 <4547897+Stell0@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nethesis/tancredi/sessions/7890c6d0-cae1-44a9-8ac9-b4b59bb546d6
Copy link
Copy Markdown
Author

Copilot AI commented Mar 26, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/PHP-DI/Invoker/zipball/3c1ddfdef181431fbc4be83378f6d036d59e81e1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/PHP-DI/PHP-DI/zipball/f88054cc052e40dbe7b383c8817c19442d480352
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/akrabat/ip-address-middleware/zipball/ff2a118f6c0214fe006156d5e28f1a4195ca6caf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/laravel/serializable-closure/zipball/cb291e4c998ac50637c7eeb58189c14f5de5b9dd
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/slimphp/Slim-Psr7/zipball/76e7e3b1cdfd583e9035c4c966c08e01e45ce959
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/slimphp/Slim/zipball/887893516557506f254d950425ce7f5387a26970
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)
  • https://api.github.com/repos/twigphp/Twig/zipball/a6769aefb305efef849dc25c9fd1653358c148f0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/7hD1Xq /usr/bin/composer install --quiet (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] [WIP] Address feedback on documentation and development lifecycle maintenance PR fix(test): Normalize *_dir variables to always end with trailing slash Mar 26, 2026
Copilot AI requested a review from Stell0 March 26, 2026 09:45
@Stell0 Stell0 marked this pull request as ready for review March 26, 2026 10:24
@Stell0 Stell0 merged commit e257d40 into agentic_development Mar 26, 2026
4 checks passed
@Stell0 Stell0 deleted the copilot/sub-pr-364 branch March 26, 2026 10:24
Stell0 added a commit that referenced this pull request Mar 26, 2026
* feature(agents): Add repository files for agentic development

* test(harness): Improve local test workflow

Add a repo-local Bats harness that generates its own Tancredi
configuration, writable runtime tree, and PHP server entrypoint.
This lets developers run the end-to-end suite without relying on
an existing Apache deployment or root-owned CI paths.

Keep the Apache-based CI layout available through
./test/run.sh system, update the workflow to call it explicitly,
and parameterize the Bats helpers and fixtures so both modes share
the same suite.

Document the new local and system test paths in test/README.md and
AGENTS.md, and make /check/ping respect the tancredi_conf override
used by the local harness.

* docs(docs): Refresh provisioning documentation

Update the docs to match the current Tancredi runtime and API
behavior.

Document the provisioning flow in more detail, including the
tok1/tok2 security model, tokenless bootstrap handling, protected
asset delivery, and runtime variables.

Refresh the installation, API, auth, templates, and index pages
to reflect the current PHP 8.1+/Slim 4 stack and public paths.

Exclude local Bundler directories from the Jekyll source tree so
documentation builds do not break when gems are installed locally.

* Update test/run.sh

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

* Update test/bats/50_template_rendering.bats

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

* Update test/run.sh

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

* Update test/bats/tancredi_client.bash

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

* fix(test): Normalize *_dir variables to always end with trailing slash (#365)

* Initial plan

* fix(test): normalize *_dir vars to always end with trailing slash

Each *_dir variable is now normalized immediately after assignment
using the `${var%/}/` pattern. This ensures that overriding
TANCREDI_RW_DIR, TANCREDI_RO_DIR, TANCREDI_SCRIPTS_DIR, or
TANCREDI_TEMPLATE_CUSTOM_DIR without a trailing slash still yields
correct subdirectory paths.

Also remove the overly-restrictive prefix check in
tancredi_reset_rw_dir that limited deletion to /var/lib/tancredi/*,
which blocked local test mode where TANCREDI_RW_DIR points to a
test-runtime directory. The empty/root guard remains.
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.

2 participants