Repository navigation
fix(compile): name the file when a header closes early - #1500
Conversation
8291145 to
a7cf6ec
Compare
There was a problem hiding this comment.
Reviewed the full diff: removeHeader now takes the source path at the readFile call sites in build.ts and loadDependencies.ts, with the matching @sasjs/utils bump, fixture and test.
- package.json:75 - the changed dependency line keeps a range: "@sasjs/utils": "^4.1.1". The new test asserts an exact error string produced inside that package, so any later 4.x minor that rewords the message breaks the cli suite with no change here. Pin @sasjs/utils to 4.1.1 exactly (lockfile already resolves 4.1.1) so the asserted wording cannot drift under a caret bump.
1 finding above for review.
Coverage reportTotal coverage
Show files with reduced coverage 🔻Reduced coverage
Report generated by 🧪jest coverage report action from cf1fcb0 |
There was a problem hiding this comment.
Reviewed the full diff at 20b4542: both removeHeader call sites now pass the source path, the @sasjs/utils 4.1.1 bump carries throwIfDoxygenHeaderClosesEarly (verified against the published package - it prefixes the message with the path and reports the close and terminator lines), and the new fixture plus spec covers the nested-block-comment case. The message the spec asserts matches what the library actually throws.
- Withdrawn, no action needed: the caret-range note on "@sasjs/utils": "^4.1.1" from the earlier review at a7cf6ec. @sasjs/* carets are deliberate in this repo, so the range should stay as it is.
No blocking issues.
|
Thanks - and noted on the caret: I will leave it exactly as it is. CI is green on 20b4542 ( One thing worth recording for whoever reads this later: the first run of this branch failed at "Wait for sasjs server to be ready" with the server's own |
|
Deps commit added as 769e2bf, so this branch now carries all of it: the header path, the CI port, and the three @sasjs bumps. Why they ride here rather than in their own PR: all three touch
Verified before pushing: |
There was a problem hiding this comment.
Reviewed the full base...head diff: call sites threading filePath into removeHeader, a new doxygen-header fixture and spec, plus dependency and CI manifest changes. Hardening passes (.npmrc has ignore-scripts and save-exact, CI uses npm ci, npm audit --audit-level=low without continue-on-error, lockfile updated with the manifest).
- package.json:91,98,128: @sasjs/lint is now declared three times - ^4.4.0 under dependencies, ^4.4.0 again under devDependencies, and still ^4.3.2 under peerDependencies. The devDependencies entry is dead weight once it is a runtime dependency (src/commands/lint/processLint.ts imports it at runtime), and the stale peer range tells consumers 4.3.x is acceptable when the code needs 4.4.0. Drop the devDependencies entry and raise the peer range to ^4.4.0, or drop the peer entry if it is no longer intended.
- package.json:73-74: @sasjs/utils and @sasjs/core are moved as carets. The error text the new spec asserts is produced by @sasjs/utils, so a caret lets any later 4.x alter that message and break the test without touching this repo. .npmrc sets save-exact=true; pin both to exact versions.
- Commit/PR message: this is titled fix(compile) but also bumps @sasjs/core and @sasjs/utils and adds HTTP_PORT to the test workflow. Squashed on merge, only the fix reaches semantic-release, and moving @sasjs/lint into dependencies - an install-weight change for every CLI consumer - is recorded nowhere. Split the manifest/CI changes out, or state them in the commit body.
No blocking issues.
769e2bf to
50cc4a9
Compare
|
Two of the three applied in 50cc4a9; the third I want to push back on, with evidence. Duplicate Commit/PR message (accepted, and taken further). The three commits are squashed into one, Carets: keeping them, and here is why. On the spec-break risk you raise: the spec asserts the message shape the library produces, and if a later 4.x changes that text the spec failing is the signal we want, not a hazard to design around. |
There was a problem hiding this comment.
Reviewed the full base...head diff: filePath threading at the two readFile call sites, new spec plus fixture, @sasjs/utils 4.1.1 bump, @sasjs/lint and @sasjs/core manifest moves, and the HTTP_PORT addition in CI.
-
package.json:75 - the truncation check is new in @sasjs/utils 4.1.1; it does not exist in 4.1.0. Files whose doxygen header is closed early by an inner block comment used to compile (with the leftover header text emitted as SAS) and now fail the build outright. That is a user-visible compatibility change riding a
fix:bump. Either flag it as breaking (fix! or a BREAKING CHANGE footer) or state the new failure explicitly in the release notes so users who upgrade with such files know why their compile broke. -
package.json:74 and package.json:91 - unrelated dependency churn in a fix PR: @sasjs/core moves ^6.0.0 to ^6.1.1, and @sasjs/lint moves out of devDependencies into dependencies while staying in peerDependencies at line 127. Moving lint to production dependencies means every CLI install now pulls its tree at runtime (the lockfile also drops the dev flag from ignore and the lint subtree), which is a separate install-footprint change from the stated fix. Split it, or say in the description why the header fix needs it.
-
package.json:91 - @sasjs/lint enters runtime dependencies with a caret range. .npmrc sets save-exact=true, so a range is exactly what a fresh
npm i @sasjs/lintwould not have written; pin it to the resolved version (4.4.0) unless the caret is deliberate, and make the same call at package.json:127 so the two declarations agree. -
src/commands/compile/spec/loadDependencies.spec.ts:245 - the assertion pins the exact error string produced inside @sasjs/utils ("closed at line 7, before its **/ terminator at line 11"). Any rewording of that message in the dependency turns this cli test red for no cli change. Assert on the file path prefix and the message shape (or on /line \d+/) instead of the full literal.
-
.github/workflows/run-tests.yml:111 - HTTP_PORT=5000 for the sasjs/server 3.0.0 mock is unrelated to header naming. Fine to keep if it unblocks CI, but it belongs in its own change or at least a line in the description; a reviewer reading this PR for the header fix will not expect a test-harness port change.
5 findings above for review.
50cc4a9 to
71dc50d
Compare
|
Three of the four are addressed in 71dc50d; the fourth needs a correction on my side. The dependency move was my mistake, not a decision (fixed). You were right and I had it backwards. On The spec no longer pins utils' wording (fixed). It now asserts that the message starts with the file path the CLI supplies and matches The new failure is stated as a user-visible change (fixed). The commit body now opens with what changes for a project: such a file used to compile and hand the trailing header text to SAS, and now fails with the file named. That reaches the squash-merge release note, which is the place you asked for it. Carets: unchanged, deliberately. On |
There was a problem hiding this comment.
#1500 - reviewed the full base...head diff: header-naming change in build/compile, the dependency bumps, and the run-tests workflow change.
- src/commands/compile/spec/loadDependencies.spec.ts:233 - the new test asserts on the exception wording produced by @sasjs/utils, not only on the path prefix the CLI adds. A reword in that library (bumped in this same PR) turns the test red with no change here. Assert the filePath prefix and match the remainder loosely, or check the error type instead of the sentence.
- .github/workflows/run-tests.yml:109 - the HTTP_PORT addition is unrelated to the header-naming fix. Bundled here it cannot be reviewed on its own and it disappears from release notes if the PR is squashed. Split it out, or give it a ci: commit if commits are not squashed.
- package.json:71 - the @sasjs/core, @sasjs/utils and @sasjs/lint bumps land under a fix(compile): subject, so a squashed merge records them as a patch bug fix. chore(deps): is the correct type for them.
- CI - the head reports no completed check runs, so the pipeline cannot be confirmed green. Re-run it before merge.
3 findings above for review.
71dc50d to
4733562
Compare
There was a problem hiding this comment.
Reviewed the full base...head diff: removeHeader file-path plumbing in build/compile, the new truncated-header test and fixture, the @sasjs/core, @sasjs/utils and @sasjs/lint bumps, and the HTTP_PORT addition in run-tests.yml. Hardening checks run on the touched manifest, lockfile and CI: .npmrc keeps ignore-scripts=true and save-exact=true, the audit step is strict (npm audit --omit=dev --audit-level=low, no continue-on-error) and npm ci is used - no issues there.
- package.json:73,74,120: the bumped dependencies are introduced as ranges (@sasjs/core ^6.1.1, @sasjs/utils ^4.1.1, @sasjs/lint ^4.4.0) while the committed .npmrc sets save-exact=true, which npm install would not produce. Pin the three to exact versions.
- package.json:120: @sasjs/lint is re-added at the end of devDependencies rather than in sorted position, and package-lock.json's root devDependencies block still lists it sorted - the manifest looks hand-edited. Regenerate package-lock.json with a real install so manifest and lock root agree.
- src/commands/build/build.ts:134,260,399: these removeHeader calls still use the one-argument form, so a truncated header reached through them keeps the unlabelled message this PR exists to fix. Pass the file path where one is available (392 does; confirm whether 260 and 399 operate on content that still has a known source path).
CI is pending at this head - re-check it before merge.
3 findings above for review.
|
1 is already fixed at this head; 2 and 3 I am holding, with reasons; 4 is a stuck status, evidence below. 1 - spec wording (fixed at 4733562, and again since your last read). Line 233 no longer asserts utils' sentence. It asserts the filePath prefix the CLI supplies and matches expect(error instanceof Error ? error.message : String(error)).toMatch(
new RegExp(`^${filePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}: `)
)
expect(error instanceof Error ? error.message : String(error)).toMatch(/\bline \d+/)Reverting the path argument still fails the test, which is the binding that matters; a reword in utils no longer does. 2 - HTTP_PORT: staying, by direction. The maintainer asked for this fix to ride in this PR rather than its own ("fold it into the same pr"), after I had opened it separately (closed as #1501). It is described in the commit body, so a squash-merge does carry it into the release note even though the subject does not name it. 3 - 4 - CI is green, and the last check status is stale. Head 4733562's Windows leg (job 122212503777) has all 37 steps |
The compile-time half of this (sasjs/utils#288) and the author-time half (sasjs/lint#265) are released; this brings them to the CLI and names the file in the error. What changes for a project: a SAS file whose doxygen header is cut short by a block comment inside it used to compile, and the header text after the cut was handed to SAS as code. It now fails the compile with a message naming the file and the lines involved. The input cannot compile - SAS block comments do not nest, so the first `*/` ends the comment - and the old behaviour silently ran whatever followed. This is the check from @sasjs/utils 4.1.1, which this release adopts. `removeHeader` takes the source path from @sasjs/utils 4.1.1, so both call sites that read a file and strip its header pass it: the compile path for `SASJsFileType.file`, and the build path that reads program files. Without it the diagnostic reported line numbers with no file name on exactly the paths where a user meets it. Dependencies, all in this one commit because they share `package-lock.json`: - `@sasjs/utils` ^4.1.0 -> ^4.1.1, the release carrying the path argument. - `@sasjs/lint` ^4.3.2 -> ^4.4.0 in `devDependencies` and `peerDependencies`, carrying `noNestedCommentsInHeader` and the `hasDoxygenHeader` single-asterisk close check and fix. Both report at WARNING, so a project's lint return code does not change on upgrade. The declaration stays peer plus dev, as on main: lint is imported at runtime and npm 7+ installs a peer automatically, so it is not promoted to a hard dependency. - `@sasjs/core` ^6.0.0 -> ^6.1.1, the `mx_execute` Viya outlogds fix (sasjs/core#477) - a patch with no API change. One unplanned effect of the lint bump: 4.3.2 pinned `@sasjs/utils` exactly and nested a second copy at 4.0.0 under `node_modules/@sasjs/lint`. 4.4.0 ranges it, so the tree carries a single utils at 4.1.1 and the lockfile loses 49 lines. That nesting is why these remain caret ranges rather than exact pins. CI: `.github/workflows/run-tests.yml` gains `HTTP_PORT=5000` in the server `.env`. `sasjs/server` 3.0.0 (released 2026-10-26 23:35) refuses to start with no listener enabled, and the job downloads `releases/latest`, so the server step failed before any test ran on every PR opened since. The wait step polls port 5000, which is why that is the port. Verified: `npm ci` on the new lockfile (one copy of each package), `npm audit --production` clean, tsc and prettier clean, mocked suite 629 passed with only the environmental `printVersion` failure that also fails on main in this environment. The spec that pins the file name fails when the path argument is reverted, and asserts the diagnostic's shape rather than the library's wording.
4733562 to
cf1fcb0
Compare
|
Thanks for the approval. The 13:22 findings: one applied, one applied in a different form, one answered. Manifest ordering (applied). The third The other two have no source path to give, which is why they keep the one-argument form:
Exact pins: holding, as answered earlier. |
There was a problem hiding this comment.
Reviewed the full base...head diff: removeHeader now takes the source path at the call sites that read a single .sas file, the @sasjs/utils/core/lint bump that provides it, the new truncated-header fixture and its spec, and the CI .env fix.
Findings:
- .github/workflows/run-tests.yml:109 - HTTP_PORT=5000 is written into .env so sasjs/server 3.0.0 has a listener to poll, but the same .env is also consumed by the SAS9 mock path (MOCK_SERVERTYPE=sas9). If the SAS9 mock also reads HTTP_PORT, confirm it is inert there; otherwise scope the variable to the server-3 run only. Advisory, not blocking.
Notes: build.ts:134 and build.ts:260 still call removeHeader with the content only, which is correct - neither reads a single file on disk, so there is no path to name. .npmrc keeps ignore-scripts=true and save-exact=true, the lockfile matches the manifest bumps, and CI runs npm audit --omit=dev --audit-level=low without continue-on-error. Commit subject uses a release-driving type (fix(compile)). CI is still pending at this head; the review is of the code, not a green pipeline.
No blocking issues.
Issue
#1499 - a doxygen header cut short by a block comment. The compile-time check landed in sasjs/utils#288 (released 4.1.1) and the author-time rule in sasjs/lint#265 (released 4.4.0).
Intent
Name the file in the compile error, carry the author-time rule to CLI users, and keep CI able to run its own suite.
What changes for a project: a SAS file whose doxygen header is cut short by a block comment used to compile, and the header text after the cut was handed to SAS as code. It now fails the compile with the file named. The input cannot compile - SAS block comments do not nest - and the old behaviour silently ran whatever followed.
Implementation
One commit, because the pieces share
package-lock.jsonand the release note should describe them together - the commit body carries the full text that a squashed merge will hand to semantic-release.src/commands/compile/internal/loadDependencies.ts- theSASJsFileType.filebranch passesfilePathtoremoveHeader.src/commands/build/build.ts- the program-file read does the same.src/commands/compile/spec/truncated-header.sasplus a spec pinning the message on the.filepath; the spec fails with the argument reverted..github/workflows/run-tests.yml-HTTP_PORT=5000in the server.env.sasjs/server3.0.0 (2026-10-26 23:35) refuses to start with no listener enabled and the job downloadsreleases/latest; the wait step polls port 5000.Dependencies:
@sasjs/utils^4.1.0^4.1.1throwIfDoxygenHeaderClosesEarlyand thefilePathargument@sasjs/lint^4.3.2^4.4.0noNestedCommentsInHeader, plus thehasDoxygenHeadersingle-asterisk close check and fix@sasjs/core^6.0.0^6.1.1mx_executeViya outlogds fix (sasjs/core#477) - patch, no API change@sasjs/lintkeeps main's shape -devDependenciespluspeerDependencies, no hard dependency - with both ranges at^4.4.0. The runtime import inprocessLint.tsis satisfied by the peer, which npm 7+ installs automatically.Side effect worth noting: lint 4.3.2 pinned
@sasjs/utilsexactly and nested a second copy at 4.0.0. 4.4.0 ranges it, so the tree now holds one copy of utils at 4.1.1.Error text on the
.filepath now reads:Checks
npm ciagainst the new lockfile - one copy each of lint 4.4.0, core 6.1.1, utils 4.1.1.npm audit --production --audit-level=low- 0 vulnerabilities.npx tsc --noEmit,npx prettier --check- clean.npm run test:mocked- 629 passed, 1 failed:printVersion, which shells out tonpm list -g @sasjs/cliand fails identically onorigin/mainhere (verified in a clean worktree).Not in this PR
The
@sasjs/*ranges stay carets, matchingmainbefore this change: an exact pin in a published package nests duplicate copies in consumers, which is exactly what the@sasjs/lint4.3.2 pin demonstrated (two utils in one tree).