Skip to content

Add a runner and a comparison for PHPStan, sniffer, evaluator and tests - #53

Open
geronica wants to merge 1 commit into
feature/token-reduction-phase-1from
feature/token-reduction-baseline-runner
Open

geronica wants to merge 1 commit into
feature/token-reduction-phase-1from
feature/token-reduction-baseline-runner

Conversation

@geronica

Copy link
Copy Markdown
Contributor

Stacked on #52 (token reduction phase 1). Merge #52 first.

What changes

spryker-upgrade and spryker-feature-install made the agent run PHPStan, the code sniffer, the
evaluator and Codeception by hand (… 2>&1 | tee <file>). The full tool output went into the agent's
context, and the agent compared the results with the baseline by reading the logs.

  • run-tools.php runs the tools in the container with the same commands as before (pseudo-terminal
    wrapper for macOS and Linux, the same memory limit). It writes the full output to the file names
    that check-baselines.php, compare-baselines.php and check-dod.php read, with exit <code> as
    the last line. It prints one line per tool: the exit code, the result and the log file. A tool that
    did not start shows as "did not run".
  • The baseline run pins the invocation in tool-invocation.json: the sniffer entry point (detected
    or given), the test environment variables and the codecept options. Later runs use the pin.
  • compare-tool-runs.php (upgrade) prints one verdict line per tool and only the new PHPStan errors,
    sniffer violations, evaluator findings and failing tests per suite. The baseline is the
    *-post-tooling.txt file when it exists, else the Phase 0 file. Exit 0 = no regression, 1 =
    regression, 2 = usage error or a missing baseline.
  • tool-output.php holds the output parsing that check-baselines.php and compare-baselines.php now
    share. compare-baselines.php keeps its file names, output lines and exit codes.
  • Both skills call the runner and the comparison instead of the raw commands, and add one rule:
    read the summary, and open a log file only for the failing part.

Effect

On a booted demo shop, one run of PHPStan, the sniffer and the evaluator writes 119,760 bytes of log.
The agent now sees 549–784 bytes per run and 393 bytes per comparison.

Not in this PR

  • Frontend builds (npm run yves and the others) still print their full output.
  • The Linux form of the pseudo-terminal wrapper is tested as a command only; the tests ran on macOS.
  • The test-suite parsing is tested with fixtures, not with a real suite run.

Checks

  • php bin/lint-plugins.php: Plugin lint passed (0 warnings).
  • php bin/lint-hook-parity.php: Hook files agree (2 events).
  • bash tests/scripts/test-sync-rules.sh: All assertions passed.
  • php plugins/spryker-ai-dev-sdk/hooks/hooks.test.php: 42 checks, 0 failed.
  • php plugins/spryker-ai-dev-sdk/skills/spryker-upgrade/scripts/upgrade-scripts.test.php: 260 checks, 0 failed.
  • php tests/scripts/feature-install/feature-install.test.php: 134 checks, 0 failed.

- run-tools.php runs the tools in the container, writes the full output to
  files in the state directory and prints one line per tool
- compare-tool-runs.php prints only what is new against the baseline
- tool-output.php holds the output parsing shared with check-baselines.php
  and compare-baselines.php
- The baseline run pins the sniffer entry point, the test environment and
  one set of codecept options per test configuration
- spryker-upgrade and spryker-feature-install call the runner instead of
  the raw tool commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant