xsync: decouple from oss workspace#3209
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the xsync tool self-contained by removing its cross-workspace path dependency on ci_logger and inlining the small logger implementation directly into the xsync crate, so xsync can still build even if the parent workspace is temporarily broken.
Changes:
- Added a local
ci_loggermodule inxsyncby inlining the logger implementation. - Replaced the
ci_loggerpath/workspace dependency with a directenv_loggerdependency in thexsync/nested workspace. - Updated
Cargo.lockto remove theci_loggerpackage entry and reflect the new direct dependency.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| xsync/xsync/src/main.rs | Registers the new local ci_logger module for initialization at startup. |
| xsync/xsync/src/ci_logger.rs | Inlines the ADO-aware logger implementation previously sourced from support/ci_logger. |
| xsync/xsync/Cargo.toml | Switches dependency from ci_logger to env_logger (workspace-provided) for the inlined module. |
| xsync/Cargo.toml | Removes the cross-workspace path dependency and adds env_logger to the nested workspace dependencies. |
| xsync/Cargo.lock | Removes the ci_logger package and updates xsync’s dependency list accordingly. |
e1c02f3 to
cccf610
Compare
Remove the cross-workspace path dependency on ci_logger (which resolved its workspace deps against the oss workspace), making xsync fully self-contained. This ensures xsync can build and run even when the parent workspace is broken -- eliminating the chicken-and-egg problem where xsync is needed to fix the workspace but can't build because the workspace is invalid. The ci_logger code (~90 lines) is inlined as a local module since xsync only uses the init() function. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cccf610 to
30add36
Compare
| fn new(log_level: Option<&str>) -> AdoLogger { | ||
| let max_level = match log_level.map(|s| s.to_lowercase()).as_deref() { | ||
| Some("trace") => LevelFilter::Trace, | ||
| Some("debug") => LevelFilter::Debug, | ||
| Some("info") => LevelFilter::Info, | ||
| Some("warn" | "warning") => LevelFilter::Warn, | ||
| Some("error") => LevelFilter::Error, | ||
| Some("off") => LevelFilter::Off, | ||
| _ => LevelFilter::Info, |
There was a problem hiding this comment.
XSYNC_LOG used to accept full env_logger filter syntax via ci_logger (e.g. module=debug,other=warn). This reimplementation only recognizes a few exact strings and silently falls back to Info for anything else, which can make existing configs appear to “stop working”. Consider either (a) supporting a minimal subset of the previous filter syntax (at least target=level / comma-separated), or (b) treating unrecognized values as an error (or at least printing a one-time warning to stderr before installing the logger) so misconfiguration is visible.
| fn new(log_level: Option<&str>) -> AdoLogger { | |
| let max_level = match log_level.map(|s| s.to_lowercase()).as_deref() { | |
| Some("trace") => LevelFilter::Trace, | |
| Some("debug") => LevelFilter::Debug, | |
| Some("info") => LevelFilter::Info, | |
| Some("warn" | "warning") => LevelFilter::Warn, | |
| Some("error") => LevelFilter::Error, | |
| Some("off") => LevelFilter::Off, | |
| _ => LevelFilter::Info, | |
| fn parse_level_filter(log_level: &str) -> Option<LevelFilter> { | |
| match log_level.trim().to_ascii_lowercase().as_str() { | |
| "trace" => Some(LevelFilter::Trace), | |
| "debug" => Some(LevelFilter::Debug), | |
| "info" => Some(LevelFilter::Info), | |
| "warn" | "warning" => Some(LevelFilter::Warn), | |
| "error" => Some(LevelFilter::Error), | |
| "off" => Some(LevelFilter::Off), | |
| _ => None, | |
| } | |
| } | |
| fn new(log_level: Option<&str>) -> AdoLogger { | |
| let max_level = match log_level { | |
| Some(value) => match Self::parse_level_filter(value) { | |
| Some(level) => level, | |
| None => { | |
| eprintln!( | |
| "warning: unrecognized log level {:?}; falling back to 'info'. Supported values: trace, debug, info, warn, warning, error, off.", | |
| value | |
| ); | |
| LevelFilter::Info | |
| } | |
| }, | |
| None => LevelFilter::Info, |
Remove the cross-workspace path dependency on
ci_logger(which resolved itsworkspace = truedeps against the oss workspace), making xsync fully self-contained. This ensures xsync can build and run even when the parent workspace is broken — eliminating the chicken-and-egg problem where xsync is needed to regenerateCargo.tomlbut can't build because the workspace is invalid.The ADO-aware logging is reimplemented in a small
log_initmodule (~60 lines) with no external dependencies beyondlog, replacing bothci_loggerandenv_logger.No pipeline changes needed —
update-mirror.yamlandhvlite-pr.yamlalready invoke xsync directly fromoss/xsync/.