Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/code-intel-cli/src/codegraph_provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ fn execute(request: &Request, result: &mut Value) -> Result<(), Failure> {
}
let provenance = json!({"collectionId":format!("codegraph-{identity}-{started}-{completed}-{}",std::process::id()),
"command":serde_json::to_string(&engine.invocation(&args)).map_err(|e| Failure::contract(e.to_string()))?,"startedAt":started,"completedAt":completed});
let uncertainty = json!(["Upstream language support is finite; unsupported source including PowerShell is not complete evidence.",
let uncertainty = json!(["Upstream language support is finite; unsupported source is not complete evidence.",
"Static relationships, dynamic dispatch, confidence/provenance and upstream truncation remain partial; absence is not proof.",
"Affected tests are candidates, not an authoritative test selection or delivery gate."]);
let payload = json!({"schema":"code-intel-evidence-payload.v1","data":{"codegraph":{"schema":"code-intel-codegraph-observation.v1",
Expand Down
4 changes: 2 additions & 2 deletions crates/code-intel-cli/src/codenexus_lite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ pub(crate) fn normalized_canonical_path(path: &Path) -> std::io::Result<PathBuf>
mod hardened_git;

/// File extensions the fallback "largest code file" selector considers.
const CODE_EXTENSIONS: [&str; 10] = [
".ps1", ".py", ".rs", ".go", ".ts", ".tsx", ".js", ".jsx", ".java", ".cs",
const CODE_EXTENSIONS: [&str; 9] = [
".py", ".rs", ".go", ".ts", ".tsx", ".js", ".jsx", ".java", ".cs",
];

/// Paths that must never enter the CodeNexus context (build output, VCS,
Expand Down
4 changes: 2 additions & 2 deletions crates/code-intel-cli/src/file_gate/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub(crate) const SOURCE_PROJECT: &str = "project";
/// all. `every_extension_is_only_classified_once` guards against silent
/// duplication.
pub(crate) const CODE_EXTENSIONS: &[&str] = &[
"ps1", "psm1", "py", "rs", "go", "ts", "tsx", "js", "jsx", "mjs", "cjs", "java", "cs", "cpp",
"c", "h", "hpp", "v",
"py", "rs", "go", "ts", "tsx", "js", "jsx", "mjs", "cjs", "java", "cs", "cpp", "c", "h", "hpp",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Version the baseline after dropping source extensions

When a target repository has an existing v6/engine-3.0.0 baseline created while .ps1 and .psm1 files were included, this change measures a different file set but leaves BASELINE_SCHEMA and ENGINE_VERSION unchanged. valid_baseline therefore accepts incomparable metrics, producing fabricated quality deltas and treating formerly measured PowerShell god files as resolved instead of returning baseline_engine_mismatch; bump the baseline identity and require an intentional re-baseline.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Not bumping in this PR. A version bump makes every existing baseline fail with baseline_engine_mismatch, including this repository's own owner-approved .sentrux/baseline.json (whose metrics don't change: this repo has no .ps1). The affected case is a target repository that kept .ps1 files and an old baseline; that is put to the owner to decide.


Generated by Claude Code

"v",
];

/// Directory names default-excluded at *any* depth, not just the repository
Expand Down
29 changes: 1 addition & 28 deletions crates/code-intel-cli/src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ fn collect_source_files(
fn language_from_path(path: &Path) -> Option<&'static str> {
match path.extension().and_then(|value| value.to_str())? {
"rs" => Some("rust"),
"ps1" | "psm1" | "psd1" => Some("powershell"),
"py" => Some("python"),
"js" | "mjs" | "cjs" => Some("javascript"),
"ts" | "tsx" => Some("typescript"),
Expand Down Expand Up @@ -271,18 +270,6 @@ fn edge_targets(language: &str, line: &str) -> Vec<(&'static str, String)> {
}
}
}
"powershell" => {
if line.starts_with(". ") || line.starts_with("& ") {
if let Some(target) = first_path_like_token(line) {
targets.push(("invoke", target));
}
}
if line.contains("Join-Path") {
if let Some(target) = quoted_tail(line) {
targets.push(("path_reference", target));
}
}
}
_ => {
if let Some(target) = quoted_tail(line) {
if target.contains('/') || target.contains('\\') {
Expand All @@ -309,7 +296,7 @@ fn resolve_target(
candidates.push(normalized.clone());
}

let extension_candidates = ["rs", "ps1", "py", "js", "ts", "tsx", "json", "md", "toml"];
let extension_candidates = ["rs", "py", "js", "ts", "tsx", "json", "md", "toml"];
let mut expanded = Vec::new();
for candidate in candidates {
expanded.push(candidate.clone());
Expand Down Expand Up @@ -339,7 +326,6 @@ fn extract_symbols(file: &SourceFile, full: bool) -> Vec<Value> {
let line = raw_line.trim();
let symbol = match file.language {
"rust" => rust_symbol(line),
"powershell" => powershell_symbol(line),
"python" => python_symbol(line),
"javascript" | "javascript-react" | "typescript" => js_symbol(line),
_ => None,
Expand Down Expand Up @@ -379,11 +365,6 @@ fn rust_symbol(line: &str) -> Option<(&'static str, String)> {
None
}

fn powershell_symbol(line: &str) -> Option<(&'static str, String)> {
line.strip_prefix("function ")
.map(|rest| ("function", take_ident(rest)))
}

fn python_symbol(line: &str) -> Option<(&'static str, String)> {
if let Some(rest) = line.strip_prefix("def ") {
return Some(("function", take_ident(rest)));
Expand Down Expand Up @@ -457,14 +438,6 @@ fn quoted_after(line: &str, marker: &str) -> Option<String> {
Some(after_quote.split_once(quote)?.0.to_string())
}

fn first_path_like_token(line: &str) -> Option<String> {
line.split_whitespace()
.skip(1)
.map(|value| value.trim_matches('"').trim_matches('\''))
.find(|value| value.contains(".ps1") || value.contains('/') || value.contains('\\'))
.map(ToString::to_string)
}

fn truncate(value: &str, max: usize) -> String {
if value.len() <= max {
return value.to_string();
Expand Down
15 changes: 6 additions & 9 deletions crates/code-intel-cli/src/language_pref/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,12 @@ fn read_language(path: &Path) -> Option<String> {
.map(str::to_string)
}

/// `$PSUICulture` (Windows) / `LANG`, `LC_ALL` (POSIX) only -- issue #155
/// deliberately stops here rather than reading other files or history to
/// guess. `PSUICulture` is a PowerShell automatic *variable*, not an OS
/// environment variable, so `env::var("PSUICulture")` is almost always
/// absent even on a Windows box whose live PowerShell session reports one;
/// that is the intended "signal unavailable" outcome falling through to
/// `en`, not a bug to route around with a WinAPI call or a shell-out to
/// `powershell.exe` -- the issue asks for a deterministic signal or `en`,
/// not best-effort culture detection.
/// `PSUICulture` (Windows) / `LANG`, `LC_ALL` (POSIX) environment variables
/// only -- issue #155 deliberately stops here rather than reading other files
/// or history to guess. When the variable is absent that is the intended
/// "signal unavailable" outcome falling through to `en`, not a bug to route
/// around with a WinAPI call or a shell-out -- the issue asks for a
/// deterministic signal or `en`, not best-effort culture detection.
fn system_locale_language() -> Option<String> {
let raw = if cfg!(windows) {
env::var("PSUICulture").ok()
Expand Down
19 changes: 2 additions & 17 deletions crates/code-intel-cli/src/native_code_evidence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@ use crate::artifact_ref::VerifiedArtifact;
use crate::capability::sha256_hex;
use crate::snapshot;

const SUPPORTED_HEURISTICS: [&str; 7] = [
"powershell",
"python",
"javascript",
"typescript",
"rust",
"go",
"java",
];
const SUPPORTED_HEURISTICS: [&str; 6] =
["python", "javascript", "typescript", "rust", "go", "java"];

pub(crate) fn execute(
request: &Value,
Expand Down Expand Up @@ -438,7 +431,6 @@ pub(crate) fn language(path: &str) -> &'static str {
.to_ascii_lowercase()
.as_str()
{
"ps1" | "psm1" => "powershell",
"py" => "python",
"js" | "jsx" | "mjs" | "cjs" => "javascript",
"ts" | "tsx" => "typescript",
Expand Down Expand Up @@ -475,7 +467,6 @@ fn extract_symbols(path: &str, language: &str, lines: &[&str]) -> Vec<Value> {
fn symbol_candidate<'a>(language: &str, line: &'a str) -> Option<(&'static str, &'a str)> {
let line = line.trim_start();
match language {
"powershell" => word_after_ci(line, "function ").map(|name| ("function", name)),
"python" => word_after(line, "def ")
.map(|name| ("function", name))
.or_else(|| word_after(line, "class ").map(|name| ("class", name))),
Expand Down Expand Up @@ -555,12 +546,6 @@ fn word_after<'a>(line: &'a str, prefix: &str) -> Option<&'a str> {
identifier(line.strip_prefix(prefix)?)
}

fn word_after_ci<'a>(line: &'a str, prefix: &str) -> Option<&'a str> {
line.get(..prefix.len())
.filter(|actual| actual.eq_ignore_ascii_case(prefix))?;
identifier(&line[prefix.len()..])
}

fn identifier(text: &str) -> Option<&str> {
let end = text
.char_indices()
Expand Down
2 changes: 1 addition & 1 deletion crates/code-intel-cli/src/project_orientation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ fn inventory_paths(bytes: &[u8]) -> Result<Vec<String>, AdapterError> {
}

fn command_script(path: &str) -> bool {
[".ps1", ".sh", ".cmd", ".bat"]
[".sh", ".cmd", ".bat"]
.iter()
.any(|suffix| path.to_ascii_lowercase().ends_with(suffix))
}
Expand Down
23 changes: 13 additions & 10 deletions crates/code-intel-cli/src/project_orientation_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ fn run(raw: &[String]) -> Result<Value, (i32, String)> {
"fileCount":fixture.file_count,
"providerStatus":if fixture.condition == "provider_missing" {"unavailable"} else {"available"},
"unknownFields":["call_graph","purpose","structural_relationships"],
"unsupportedFiles":["Cargo.toml","README.md"]
"unsupportedFiles":["Cargo.toml","README.md","run.sh"]
},
"warmPreparationMs":warm_materialization,
"samples":{"cold":cold,"warm":warm}
Expand Down Expand Up @@ -258,7 +258,7 @@ fn materialize(root: &Path, fixture: &Fixture, manifest: &Path) -> Result<PathBu
let mut paths = vec![
"Cargo.toml".to_string(),
"README.md".into(),
"run.ps1".into(),
"run.sh".into(),
"src/main.rs".into(),
"tests/orientation.rs".into(),
];
Expand All @@ -268,11 +268,13 @@ fn materialize(root: &Path, fixture: &Fixture, manifest: &Path) -> Result<PathBu
paths.sort();
let native = paths
.iter()
.map(|path| json!({
"path":path,
"language":if path.ends_with(".rs") {"rust"} else if path.ends_with(".ps1") {"powershell"} else {"text"},
"bytes":16,"lines":1,"textHash":"3".repeat(64),"source":"benchmark-fixture"
}))
.map(|path| {
json!({
"path":path,
"language":if path.ends_with(".rs") {"rust"} else {"text"},
"bytes":16,"lines":1,"textHash":"3".repeat(64),"source":"benchmark-fixture"
})
})
.collect::<Vec<_>>();
let dirty = fixture.condition == "dirty";
let snapshot = json!({
Expand All @@ -299,7 +301,7 @@ fn materialize(root: &Path, fixture: &Fixture, manifest: &Path) -> Result<PathBu
let survival = json!({
"schema":"code-intel-repository-survival-scan-result.v1","status":"completed","snapshotIdentity":SNAPSHOT,
"repository":{"kind":"unversioned","identity":format!("content-v1:{}", "c".repeat(64)),"revision":"benchmark-corpus-v1","dirty":dirty,"sourceSha256":snapshot_ref["sha256"]},
"inventory":{"fileCount":fixture.file_count,"extensions":{"rs":fixture.file_count.saturating_sub(3),"md":1,"toml":1,"ps1":1},"sourceSha256":inventory_ref["sha256"]},
"inventory":{"fileCount":fixture.file_count,"extensions":{"rs":fixture.file_count.saturating_sub(3),"md":1,"toml":1,"sh":1},"sourceSha256":inventory_ref["sha256"]},
"providerDiagnosis":{"providerId":"codenexus.full","status":"provider_unavailable","domainVerdict":"unknown"},
"completeness":"reduced","structuralVerdict":"unknown",
"limitations":["only repository identity and basic file inventory are available","deeper structural perception requires an admitted provider result"],
Expand Down Expand Up @@ -331,7 +333,7 @@ fn materialize(root: &Path, fixture: &Fixture, manifest: &Path) -> Result<PathBu
"native-coverage.json",
"code-evidence-coverage.v1",
"code_evidence.coverage",
&json!({"schema":"code-evidence-coverage.v1","producer":if fixture.condition == "provider_missing" {"benchmark-provider-missing"} else {"benchmark-provider-ready"},"parserKind":"line-heuristic","supportedHeuristics":["rust","powershell"],"unsupportedFiles":["Cargo.toml","README.md"],"symbolPrecision":"heuristic","importPrecision":"heuristic","relationshipPrecision":"unknown","callGraph":"unknown","effects":["repo_read","local_write"]}),
&json!({"schema":"code-evidence-coverage.v1","producer":if fixture.condition == "provider_missing" {"benchmark-provider-missing"} else {"benchmark-provider-ready"},"parserKind":"line-heuristic","supportedHeuristics":["rust"],"unsupportedFiles":["Cargo.toml","README.md","run.sh"],"symbolPrecision":"heuristic","importPrecision":"heuristic","relationshipPrecision":"unknown","callGraph":"unknown","effects":["repo_read","local_write"]}),
)?,
write_json_ref(
root,
Expand Down Expand Up @@ -560,7 +562,8 @@ fn evaluate(observations: &Value) -> Result<Value, AdapterError> {
orientation["purpose"]["status"] == "unknown",
orientation["purpose"]["evidence"] == json!([]),
orientation["activeChange"]["status"] == fixture["expected"]["activeChange"],
observed_file_count.saturating_add(2)
// Cargo.toml, README.md and run.sh carry no language.
observed_file_count.saturating_add(3)
== fixture["expected"]["fileCount"]
.as_u64()
.unwrap_or(u64::MAX),
Expand Down
Loading
Loading