1
0
mirror of https://github.com/sasjs/server.git synced 2026-07-23 21:25:29 +00:00
Commit Graph

558 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 dec5191491 fix(api): isolate drive.spec.ts's files folder from the real drive
drive.spec.ts already isolates itself into a unique, timestamped
tmpFolder for getSasjsRootFolder()/getUploadsFolder(), cleaned up via
afterAll(() => deleteFolder(tmpFolder)). But getFilesFolder() - what
nearly every test in this file actually writes to - resolves through
a separate, unmocked function (getSasjsDriveFolder()/process.driveLoc),
so every run left real files/folders (e.g. 'level1', 'my/path/...')
behind in the shared api/sasjs_root/drive/files, causing later runs
to fail: folder-listing tests saw stale entries, and file-creation
tests got 409 Conflict against files a previous run already created.

Mock getFilesFolder() the same way getUploadsFolder() already is, so
it resolves inside the same isolated tmpFolder and gets cleaned up
by the existing afterAll. Verified by running the suite twice in a
row from a clean slate: both runs pass, and the real sasjs_root/drive
is never touched.
2026-07-14 11:32:01 +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 0af6b63ffa fix: fix code.spec.ts failing on a fresh checkout (CI) 2026-07-14 09:20:35 +03:00
YuryShkoda 67fce475a3 fix(api): harden mock SAS executable and timeouts for CI
- wrap the file read/write in a small retry() helper instead of
  letting an uncaught exception (e.g. a rename racing an existsSync
  check) crash the process with a non-zero exit indistinguishable
  from a genuine SAS failure
- bump the internal give-up deadline from 1500ms to 8000ms
- bump the corresponding Jest test timeouts from 15000ms to 30000ms to match
2026-07-14 08:41:35 +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
Trevor Moody 02fe79d4d7 chore(deps): full package-lock rebuild 2025-12-21 01:22:35 +00:00
Trevor Moody 00a107babd chore(deps): rebuilt api/package-json to sync 2025-12-21 01:15:05 +00:00
Trevor Moody 4f782025db fix(deps): bump dependencies and resolve audit issues 2025-12-21 00:27:24 +00:00
Trevor Moody 225f381bdf fix: (deps) rerun npm i to sync 2025-11-25 12:27:14 +00:00
Trevor Moody ab96653564 fix: (deps) bump @sasjs/core to 4.59.7 2025-11-25 12:18:50 +00:00
M e51b20421a fix: addressing test fail 2025-09-25 13:49:32 +02:00
M 631e95604b fix: typescript errors 2025-09-25 13:40:10 +02:00
M 198cd79354 fix: typescript errors 2025-09-25 13:34:55 +02:00
M 379ea604bc fix: packages missmatch 2025-09-25 13:12:23 +02:00
M 9ffa403bcb chore: package-lock 2025-09-25 13:06:06 +02:00
M 6d123c3e23 fix: type libs 2025-09-25 13:03:47 +02:00
Trevor Moody a5c99971cc build: server/api dependency update 2025-09-19 14:06:50 +01:00
Allan Bowe 3529232f1f chore: whitespace removal 2025-03-12 17:29:02 +00:00
Allan Bowe f4768bffd3 fix: extra bit of sleep for file recognition
closes #381
2025-03-12 17:27:57 +00:00
Yury bc2cff1d0d chore(api): updated trigger endpoints description 2024-10-31 15:30:32 +03:00
Yury 66aa9b5891 chore(api): updated trigger endpoints description 2024-10-31 15:20:35 +03:00
Yury ca17e7c192 chore(api): updated endpoint description 2024-10-31 14:08:56 +03:00
Yury 73df102422 chore(api): updated endpoint description 2024-10-31 12:27:56 +03:00
Yury 48a9a4dd0e fix(api): fixed condition in processProgram 2024-10-31 11:17:20 +03:00
Yury 4f6f735f5b chore(lint): fixed code style issue 2024-10-31 10:08:34 +03:00
Yury 6b6546c7ad feat(api): added session state endpoint 2024-10-30 17:42:50 +03:00
Yury f94ddc0352 refactor(session): implemented session state 2024-10-30 15:33:06 +03:00
Yury 03670cf0d6 chore(swagger): fixed code/stp trigger examples 2024-10-30 15:25:03 +03:00
Yury 5cda9cd5d8 feat(api): enabled query params in stp/trigger endpoint 2024-10-30 09:39:47 +03:00
Yury deee34f5fd chore(stp): removed query logic from trigger endpoint 2024-10-29 16:55:40 +03:00
Yury b0723f1444 feat(stp): added trigger endpoint 2024-10-29 16:27:53 +03:00
Yury e9519cb3c6 chore(code): used correct type 2024-10-29 16:20:27 +03:00
Yury 049a7f4b80 chore(swagger): improved description 2024-10-29 12:02:26 +03:00
Yury 3053c68bdf chore(lint): fixed linting issues 2024-10-29 11:40:44 +03:00
Yury 76750e864d chore(lint): fixed lint issue 2024-10-29 11:30:05 +03:00
Yury ffcf193b87 feat(code): added code/trigger API endpoint 2024-10-29 11:18:04 +03:00
Yury 73d965daf5 fix(api): fixed env issue in MacOS executable 2024-01-15 15:14:06 +03:00
Allan 068edfd6a5 chore: lint fix 2023-11-07 20:39:05 +00:00
Allan Bowe 7e8cbbf377 fix: enable embedded LFs in JS STP vars 2023-11-07 15:51:32 +00:00
Allan 41c627f93a chore: lint fix 2023-08-07 19:39:02 +01:00
Allan Bowe 49f5dc7555 Update swagger.yaml 2023-08-07 19:32:29 +01:00
Allan Bowe f6e77f99a4 Update swagger.yaml 2023-08-07 19:31:20 +01:00
Allan Bowe b57dfa429b Update stp.ts 2023-08-07 19:30:09 +01:00
sabhas 9586dbb2d0 fix: add _debug as optional query param in swagger apis for GET stp/execute 2023-08-07 22:01:52 +05:00
Yury Shkoda 0f91395fbb lint: fixed linting issues 2023-07-24 18:36:08 +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 d458b5bb81 chore: cleanup 2023-05-03 10:56:17 +03:00
Yury Shkoda 958ab9cad2 chore(execution): add includePrintOutput to ExecuteFileParams 2023-05-03 10:46:21 +03:00