Skip to content

fix(mx_execute): assign line from the input buffer in the Viya outlogds step - #477

Merged
allanbowe merged 3 commits into
mainfrom
fix/mx-execute-viya-outlogds-line
Oct 27, 2026
Merged

allanbowe merged 3 commits into
mainfrom
fix/mx-execute-viya-outlogds-line

Conversation

@sasjs-dev

@sasjs-dev sasjs-dev Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Follow-up to the first finding in the post-merge review of #476.

The Viya outlogds loop reads each job-log record with input; but never copies the buffer into the declared line variable, so outlogds comes back with the right number of rows and LINE missing on every one of them. The dataset looked populated while carrying no log text.

This assigns line=_infile_; straight after input;, the same way ms_runstp.sas reads the chopped log in #476 (and the putlog step a few lines above already relies on _infile_).

  • sasjs lint: exit 0, no errors or warnings in xplatform/mx_execute.sas.
  • The Viya branch is code-review only - there is no Viya session here to run tests/x-platform/mx_execute.test.sas against, so Test 3 has not been re-executed on Viya. The SASjs Server path is untouched by this change.
  • all.sas is generated by the pipeline; not edited here.

dc and others added 2 commits October 27, 2026 11:37
…ds step

The outlogds loop added in #476 reads each record with input; but never copies the buffer into the declared line variable, so every row of the captured Viya job log has LINE missing. Assign line=_infile_ after input, matching the ms_runstp read fixed in the same PR.

@sasjs-dev sasjs-dev Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full diff: the Viya outlogds read loop in xplatform/mx_execute.sas now assigns line=infile inside the do-while, mirrored in the generated all.sas. That matches the existing infile idiom elsewhere in the same macro, and the SAS 9 branch that only creates an empty dataset is unaffected.
Reviewed the diff - no blocking issues found.

The Test 3 volume assertion carries an unquoted comma in desc=, so SAS reads everything after it as a positional parameter: 'All positional parameters must precede keyword parameters', every following statement in the test then fails to compile, and the suite reports no results at all. Reworded without the comma so &loglines still resolves.
@sasjs-dev

sasjs-dev Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Ran the suite against the SASjs Server estate (sasjs cbd -t server then sasjs test mx_execute -t server, target server, appLoc /sasjs/core, head e45a16a).

SASjs Test ID                         Test Target  Test Suite Result
c7947894-3241-4fdf-a911-abcb07044789  mx_execute   PASS

13 of 13 assertions PASS, and the SAS log for the run contains no ERROR lines:

  • service creation, somedata1/somedata2 round-trip
  • Test 2 - no log dataset unless outlogds is asked for
  • Test 3 - child log captured via outlogds, and the capture is the whole log (1455 lines), not a fragment
  • Test 4 - clean run reports state=completed; no fixed-name table left in WORK
  • Test 5 - aborted child reports state=canceled and its message
  • Test 6 - the documented default call runs clean and leaves no log or flow table behind

The first run failed, and it was a test defect

The suite reported no results at all (0/1), with ERROR: All positional parameters must precede keyword parameters at the Test 3 volume assertion. The desc= value carried an unquoted comma - the captured log is the whole log, not a fragment - so SAS treated the remainder as a positional argument; every statement after that point failed to compile and the program's webout was not valid JSON. #476 introduced that wording when the volume assertion was added, so the suite could not pass on any platform, and it is why the previous run of this branch produced no assertions either.

Fixed in e45a16a by rewording without the comma (... the whole log not a fragment (&loglines lines)), which keeps &loglines resolving. all.sas is unaffected - the test file is not part of it.

Scope of this evidence

This exercises the SASjs Server path only. The Viya branch - the one this PR changes - is not reachable from a SASjs Server target, so it remains code-review only; there is no Viya session available here to run the suite against.

@allanbowe
allanbowe merged commit cacf2a9 into main Oct 27, 2026
3 of 4 checks passed
@allanbowe
allanbowe deleted the fix/mx-execute-viya-outlogds-line branch October 27, 2026 11:53
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

sasjs-dev Bot pushed a commit to sasjs/cli that referenced this pull request Oct 27, 2026
`@sasjs/lint` 4.4.0 carries the author-time half of this work
(sasjs/lint#265): the `noNestedCommentsInHeader` rule, and the
`hasDoxygenHeader` check and fix for a header that closes with a single
asterisk. Both report at WARNING, so a project's lint return code does not
change on upgrade.

`@sasjs/core` 6.1.1 is the `mx_execute` fix for the Viya outlogds step
(sasjs/core#477) - a patch with no API change.

The bumps ride in this PR because both touch `package.json` and
`package-lock.json`, which this branch already changes for `@sasjs/utils`
4.1.1; two PRs editing the same lockfile would only conflict.

Verified with `npm ci` against the new lockfile: lint 4.4.0, core 6.1.1 and
utils 4.1.1 resolve; `npm audit --production --audit-level=low` reports no
vulnerabilities.
sasjs-dev Bot pushed a commit to sasjs/cli that referenced this pull request Oct 27, 2026
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.

`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. A truncated
header used to report line numbers with no file name on those paths, which is
the failure the check exists to prevent.

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, 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.
- `@sasjs/core` ^6.0.0 -> ^6.1.1, the `mx_execute` Viya outlogds fix
  (sasjs/core#477) - a patch with no API change.

The `@sasjs/lint` devDependencies entry is gone: it is a runtime dependency of
`src/commands/lint/processLint.ts`, so the second declaration was dead weight.
Its peer range moves to ^4.4.0, since 4.4.0 is where the rule the CLI ships
comes from.

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 new spec fails with the path argument reverted.
sasjs-dev Bot pushed a commit to sasjs/cli that referenced this pull request Oct 27, 2026
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.
sasjs-dev Bot pushed a commit to sasjs/cli that referenced this pull request Oct 27, 2026
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.
sasjs-dev Bot pushed a commit to sasjs/cli that referenced this pull request Oct 27, 2026
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.
allanbowe pushed a commit to sasjs/cli that referenced this pull request Oct 27, 2026
…1500)

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.

Co-authored-by: [email protected] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant