Skip to content

Preserve Fresh e2e server logs in CI for post-mortem debugging. - #358

Merged
jamals86 merged 4 commits into
mainfrom
fix/workspace-dep-upgrades
Aug 5, 2026
Merged

Preserve Fresh e2e server logs in CI for post-mortem debugging.#358
jamals86 merged 4 commits into
mainfrom
fix/workspace-dep-upgrades

Conversation

@jamals86

Copy link
Copy Markdown
Collaborator

No description provided.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings July 26, 2026 19:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves CI/post-mortem debugging for the “fresh” e2e server by making its stdout/stderr logs durable across test runs and uploading them as a GitHub Actions artifact.

Changes:

  • Add configurable log export path (KALAMDB_AUTO_TEST_SERVER_LOG) and preserve/copy logic for the fresh test server logs.
  • Print fresh-server log tails on key auth/setup failures to improve actionable CI output.
  • Upload the fresh-server log from CI as an artifact (fresh-server-log) and ignore the CI artifacts directory in git.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
cli/kalam-cli-e2e/tests/common/mod.rs Adds durable log path support, log preservation/copying, and failure-time log tail dumping for fresh e2e servers.
.gitignore Ignores the ci-artifacts/ directory to avoid committing CI outputs.
.github/workflows/ci.yml Sets the durable log env var, ensures the artifacts directory exists, tails the log for visibility, and uploads it as an artifact.
Comments suppressed due to low confidence (1)

cli/kalam-cli-e2e/tests/common/mod.rs:1588

  • preserve_auto_test_server_log(&log_path) copies the whole log file while the server is still running. This can become expensive as logs grow and can also produce incomplete preserved copies due to concurrent writes; the log is already preserved on failure and on Drop/shutdown.
    preserve_auto_test_server_log(&log_path);

Comment thread cli/kalam-cli-e2e/tests/common/mod.rs Outdated
Comment on lines +905 to +921
fn dump_auto_test_server_log_tail(context: &str) {
let Some(log_path) = resolve_auto_test_server_log_for_dump() else {
eprintln!("[TEST] No fresh-server log available ({context})");
return;
};

let contents = fs::read_to_string(&log_path).unwrap_or_default();
let tail: Vec<&str> = contents.lines().rev().take(80).collect::<Vec<_>>().into_iter().rev().collect();
eprintln!(
"[TEST] Fresh server log tail ({context}) from {} ({} lines):",
log_path.display(),
tail.len()
);
for line in tail {
eprintln!(" {line}");
}
}
Cluster tests no longer call test_context() under KALAMDB_SERVER_TYPE=fresh, and schema gen uses unbound isolated credentials so profile URLs match the project.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 27, 2026 04:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

cli/kalam-cli-e2e/tests/common/mod.rs:810

  • The comment says this is an "Absolute path", but auto_test_server_log_export_path() can return a relative path (it accepts any non-empty string). Either enforce absoluteness or update the comment to avoid being misleading.
    /// Absolute path to the fresh-server stdout/stderr log.
    #[serde(default)]
    log_path: Option<PathBuf>,

cli/kalam-cli-e2e/tests/common/mod.rs:913

  • dump_auto_test_server_log_tail reads the entire log file into memory just to print the last ~80 lines. Since the log is opened in append mode and can grow large in CI, this can be slow and memory-heavy on failure paths.
    let contents = fs::read_to_string(&log_path).unwrap_or_default();
    let tail: Vec<&str> = contents.lines().rev().take(80).collect::<Vec<_>>().into_iter().rev().collect();
    eprintln!(

jamals86 and others added 2 commits July 30, 2026 21:23
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 5, 2026 13:17
@jamals86
jamals86 merged commit ca3a3f2 into main Aug 5, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

cli/kalam-cli-e2e/tests/common/mod.rs:912

  • dump_auto_test_server_log_tail() reads the entire log file into memory (read_to_string) just to print the last ~80 lines. Since this log is now explicitly preserved in CI, it can become large and risk OOM / slowdowns in failing runs. Stream the file and keep a bounded tail buffer instead.
    let contents = fs::read_to_string(&log_path).unwrap_or_default();
    let tail: Vec<&str> = contents.lines().rev().take(80).collect::<Vec<_>>().into_iter().rev().collect();

Comment on lines +885 to +895
if let Ok(Some(state)) = read_auto_test_server_state_locked() {
if let Some(log_path) = state.log_path {
if log_path.exists() {
return Some(log_path);
}
}
let in_data = state.storage_dir.join("server.log");
if in_data.exists() {
return Some(in_data);
}
}
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.

2 participants