Skip to content

Skip decorator/pragma lines in function intent extraction (#3115) - #3150

Merged
squid-protocol merged 1 commit into
mainfrom
fix/pli-intent-3115
Sep 17, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/pli-intent-3115

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3115.

Problem

Scanning IBM's zopeneditor-sample, PSAM2 (PLI/PSAM2.pli) rendered Intent: %PROCESS SOURCE RULES(LAXIF); in section 8 (Core Function Hitlist). The file's first line is a %PROCESS compiler-option directive. _extract_documentation_tether's "Harvest Above" scan treats a leading % as a comment prefix (correct for MATLAB/Erlang), so it swept the PL/I pragma in as the function's prose intent.

Fix

Before treating a harvested line as a comment, skip it if it matches the active language's own decorators rule — reusing pli.py's existing %PROCESS/*PROCESS/OPTIONS( pattern rather than duplicating it. The pragma is stepped over (so a genuine doc-comment above it is still captured) and never becomes the intent. Only fires for languages that define a decorators rule.

Verification

  • New test: a %PROCESS line is not used as intent, and a real prose doc-comment still is (including the case where the comment sits above the pragma).
  • No cross-language regression: the full tests/extraction/languages suite passes — 8249 passed, 3 skipped, 8 xfailed.
  • detector.py ruff identical to baseline; no new mypy errors.

Golden-master note: PL/I functions that previously absorbed a %PROCESS/*PROCESS directive as intent will now fall back to a real doc-comment or empty. Fixtures to be regenerated as part of the bless.

A PL/I function whose file began with a `%PROCESS` compiler-option directive
rendered `Intent: %PROCESS SOURCE RULES(LAXIF);` in the section-8 Core Function
Hitlist. `_extract_documentation_tether`'s "Harvest Above" scan treats a leading
`%` as a comment prefix (correct for MATLAB/Erlang), so it swept the PL/I pragma
in as prose intent.

Fix: before treating a harvested line as a comment, skip it if it matches the
active language's own `decorators` rule (reusing pli.py's existing
`%PROCESS`/`*PROCESS`/`OPTIONS(` pattern rather than duplicating it). A pragma
line is stepped over, so a genuine doc-comment above it is still captured, and
the pragma never becomes the intent. Generalizes safely: only fires for
languages that define a `decorators` rule.

Verified: new test asserts a `%PROCESS` line is not used as intent while a real
prose comment still is; the full tests/extraction/languages suite passes
(8249 passed, no cross-language regression); detector.py ruff identical to
baseline and no new mypy errors.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit cd09f87 into main Sep 17, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the fix/pli-intent-3115 branch September 17, 2026 21:59
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.

Function Intent extraction picks up a PL/I %PROCESS compiler directive

1 participant