Commit Graph
78 Commits
Author SHA1 Message Date
YuryShkoda fd31fe94ea Merge remote-tracking branch 'origin/main' into issue-390
# Conflicts:
#	api/src/controllers/internal/spec/Execution.spec.ts
2026-07-14 11:58:24 +03:00
YuryShkoda 4858245372 fix(api): stop overwriting a failed JS/PY/R session back to completed
For JS/PY/R, processProgram sets session.state = failed (with
failureReason) itself when the interpreter process exits non-zero,
without throwing. ExecutionController.executeProgram then
unconditionally set session.state = completed right after
processProgram returned, silently overwriting that - so anything
downstream inspecting session.state (e.g. scheduleSessionDestroy's
expiresAfterMins branch) would see a crashed session mis-reported as
successful.

Guard the assignment so a failed state is never overwritten. No
effect on SAS, which sets state independently via its own spawned
process lifecycle.

Added Execution.spec.ts covering both the failure case (state stays
failed) and the success case (state still becomes completed), to
guard against regressing in either direction.
2026-07-14 11:29:30 +03:00
YuryShkoda f84af4ac06 fix(api): return prompt error response instead of hanging when a SAS session fails
The SAS-runtime poll loop in processProgram only checked for
SessionState.completed, so a session that failed (e.g. via %abort;)
left the loop spinning on delay(50) forever - the request never
resolved, even though the SAS log had already been written. Split a single completed-on-either-outcome
flag into separate completed/failed states without updating this loop.

- processProgram now throws when session.state becomes 'failed'
- Execution.ts catches that, reads the complete log (guaranteed
  complete since the session's process has already exited by then),
  and throws a SessionExecutionError carrying it
- stp.ts/code.ts surface { ..., log } in the HTTP error response
- add unit tests for the poll loop and the log-enrichment logic, plus
  a mock SAS executable + end-to-end test exercising the real
  session/process pipeline without needing a SAS install
- add docs/diagrams covering the session lifecycle and the SAS
  execution handshake mechanism, for future context
2026-07-13 13:46:36 +03:00
Yury f94ddc0352 refactor(session): implemented session state 2024-10-30 15:33:06 +03:00
Yury Shkoda 167b14fed0 docs(log-separator): left comment 2023-07-24 18:29:20 +03:00
Yury Shkoda 8940f4dc47 fix(log-separator): log separator should always wrap log 2023-07-24 18:27:21 +03:00
Yury Shkoda 958ab9cad2 chore(execution): add includePrintOutput to ExecuteFileParams 2023-05-03 10:46:21 +03:00
Yury Shkoda 9aaffce820 fix(execute): fixed adding print output 2023-05-02 15:49:44 +03:00
Yury Shkoda e78f87f5c0 fix(execute): added atribute indicating stp api 2023-05-02 15:18:05 +03:00
Yury Shkoda 9f521634d9 chore(webout): added comment 2023-05-02 11:30:55 +03:00
Yury Shkoda 31df72ad88 fix(webout): fixed adding empty webout to response payload 2023-05-02 11:17:12 +03:00
Yury Shkoda 6dd2f4f876 fix(execution): removed empty webout from response 2023-04-28 17:25:30 +03:00
Yury Shkoda c0f38ba7c9 wip(print-output): added print output to response payload 2023-04-28 15:09:44 +03:00
sabhas 4dcee4b3c3 fix: update the content type header after the program has been executed 2022-11-28 23:53:36 +05:00
sabhas 112431a1b7 fix: update the response header of request to stp/execute routes 2022-11-27 21:57:26 +05:00
medjedovic 36be3a7d5e feat: mocking sas9 responses with JS STP 2022-10-17 18:31:08 +02:00
sabhas 98ea2ac9b9 fix: update response of /SASjsApi/stp/execute and /SASjsApi/code/execute 2022-08-19 15:06:39 +05:00
sabhas 882bedd5d5 fix: add a new variable _SASJS_WEBOUT_HEADERS to code.js and code.py 2022-08-18 01:19:47 +05:00
sabhas 0f19384999 fix: fileTree api response to include an additional attribute isFolder 2022-07-19 16:13:46 +05:00
Saad Jutt 3130fbeff0 chore: code refactor for getting session controller 2022-06-21 03:41:44 +05:00
Saad Jutt 2119e9de9a feat(certs): ENV variables updated and set CA Root for HTTPS server 2022-06-21 03:17:14 +05:00
sabhas f738a6d7a3 chore: splitted functions into different files 2022-06-19 07:07:39 +05:00
sabhas 23b6692f02 fix: code/execute controller logic to handle different runtimes 2022-06-17 20:01:50 +05:00
sabhas ab222cbaab chore: verify executable paths 2022-06-17 18:12:03 +05:00
sabhas 1790e10fc1 chore: code fixes 2022-06-16 22:14:47 +05:00
Saad Jutt c830f44e29 chore: code fixes 2022-06-14 16:48:58 +05:00
sabhas de9ed15286 chore: update error message when stored program not found 2022-06-13 20:51:44 +05:00
sabhas 325285f447 Merge branch 'main' into issue-184 2022-06-13 20:42:28 +05:00
Mihajlo Medjedovic 3fa2a7e2e3 fix: execution controller error details 2022-06-13 12:25:06 +00:00
medjedovic 8a617a73ae fix: execution controller better error handling 2022-06-13 14:01:12 +02:00
sabhas 16856165fb feat: create and inject code for uploaded files to code.js 2022-06-09 14:54:11 +05:00
sabhas 058b3b0081 feat: configure child process with writeStream to write logs to log file 2022-06-08 02:01:31 +05:00
sabhas 9d5a5e051f fix: no need to stringify _webout in preProgramVarStatements, developer should have _webout as string in actual code 2022-06-07 13:27:18 +05:00
sabhas dffe6d7121 fix: refactor code in executeFile method of session controller 2022-06-06 15:23:42 +05:00
sabhas e5a7674fa1 chore: refactor ExecutionController class to remove code duplications 2022-06-06 09:09:21 +05:00
sabhas c58666eb81 fix: convert single executeProgram method to two methods i.e. executeSASProgram and executeJSProgram 2022-06-03 17:26:21 +05:00
Saad Jutt c275db184e feat(web): added profile + edit + autoexec changes 2022-05-26 04:25:15 +05:00
Saad Jutt 2a7223ad7d feat(api): added autoexec + major type setting changes 2022-05-24 21:12:32 +05:00
Saad Jutt 80b33c7a18 fix: issue174 + issue175 + issue146 2022-05-23 19:24:56 +05:00
Saad Jutt 636301e664 fix: reqHeadrs.txt will contain headers to access APIs 2022-05-08 02:49:16 +05:00
Saad Jutt 527f70e90d fix(stp): read file in non-binary mode if debug one 2022-04-02 07:09:27 +05:00
Saad Jutt 3ff6f5e865 fix(stp): return log+webout for debug on 2022-04-02 07:06:09 +05:00
Saad Jutt dd56a95314 fix(stp): use same session from file upload 2022-03-24 18:06:28 +05:00
Saad Jutt d27e070fc8 fix: moved macros from codebase to drive
This reverts commit d2956fc641.
2022-03-23 19:38:29 +05:00
Saad Jutt d2956fc641 Revert "fix: moved macros from codebase to drive"
This reverts commit 9ac3191891.
2022-03-23 17:59:06 +05:00
Saad Jutt 9ac3191891 fix: moved macros from codebase to drive 2022-03-23 09:19:33 +05:00
Saad Jutt 8822de95df fix(stp): write original file name in sas code for upload 2022-03-18 06:57:52 +05:00
Saad Jutt 145ac45036 fix(stp): return plain/text header for GET & debug 2022-03-14 04:42:30 +05:00
Saad Jutt 95843fa4c7 fix: macros are available Sessions with SASAUTOS 2022-03-06 01:57:14 +05:00
Saad Jutt 5005f203b8 fix(stp): return json for webout 2022-02-21 04:13:04 +05:00