Skip to content

Path-sink census remainder after #217: lossy/absolute sinks still fail open #390

Description

@dean0x

#217 (PR #388) closed lint.rs relative_display, the source-map anchors, the output.rs stem fallbacks and fmt's exit code. Same datum, remaining sinks — each should fail closed with mds::io, or emit root-relative text; one test per sink; census table in the PR:

  1. crates/mds-cli/src/build.rs apply_source_map_file_label (~:1159) — sm.file = out.file_name().map(to_string_lossy) into the published SMv3 file; the same lossy basename at ~:1492 and ~:1558 (stale-map reconciliation). Proposal: to_str(); None ⇒ omit file and warn, or reject the output path at resolve_output_path_for_kind.
  2. crates/mds-cli/src/fmt.rs (~:184 and ~:248) — file_name = path.display().to_string() threaded into format_source_named, so lexer/safety-gate diagnostics name the raw (absolute, lossy) path while lint names root-relative. Proposal: root-relative via NativeFs display or a shared helper.
  3. crates/mds-core/src/lib.rs lint() (:1283-1286) — file_name().and_then(to_str).unwrap_or(path_str) labels a stem-less path with the full path string; and crates/mds-cli/src/lint.rs <file> sentinel (:1053; dead: non-UTF-8 is rejected by read_source_file first, None only for /). Document or fold into the fail-closed contract.
  4. getcwd fallbacks: crates/mds-cli/src/output.rs canonicalize_out_dir (:218-220) and crates/mds-cli/src/build.rs compute_source_map_base (:1091) — current_dir().unwrap_or_else(|_| "."): with an unreadable cwd a relative --out-dir becomes ./<dir> (uncanonicalizable ⇒ in-root exclusion never matches) and source_map_base stays relative (silently demotes map-relative to root-relative — the comment near build.rs :1123-1124 names the hazard). read_stdin (:708) and auto_detect_mds_file (~:775) already error; make these two do the same (mds::io, exit 2).
  5. crates/mds-cli/src/watch.rs graph_key (~:225) — p.to_path_buf() fallback when the parent cannot be canonicalized: audit as the same class.

Refs #217, PR #388.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliCLI commands and optionsrustPull requests that update rust codetech-debtTechnical debt

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions