Skip to content

fix(diff-logs): find the repo root from subdirectories and keep probe scripts out of placement - #26

Merged
ilanh merged 1 commit into
mainfrom
fix/diff-logs-root-and-excludes
Nov 3, 2026
Merged

ilanh merged 1 commit into
mainfrom
fix/diff-logs-root-and-excludes

Conversation

@ilanh

@ilanh ilanh commented Nov 3, 2026

Copy link
Copy Markdown
Owner

What and why

Two diff-logs problems found when the probe driver lived inside the repo:

  • Wrong root from a subdirectory. cd openshell && openshell-annotate diff-logs sandbox-logs.txt scanned only that directory (0 stale, wrong place:). When --root is not given, diff-logs now walks up to the nearest openshell-annotate.toml (like git), prints note: using repository root ..., and loads that config. The log paths you pass are still resolved from where you run it. An explicit --root other than . is never second-guessed. (The other commands take explicit path arguments relative to the working directory, so I left their root handling alone.)
  • Probe scripts used as placement targets. diff-logs --write inserted directives into openshell/exercise.sh because it mentions the host. New [diff-logs] exclude patterns (same literal syntax as [scan].exclude) keep files from being picked as the place for a suggestion, while directives inside them still count. The --observed-file is always skipped.

Docs: README config block, --root help (CLI.md regenerated).

Tests: tests/diff_logs_root.rs (subdirectory run, --write from a subdirectory, exclude vs no exclude, observed file never a target). TOOLCHAIN=1.94 scripts/ci-local.sh and stable clippy pass.

Ordering: edits the diff-logs arm of main.rs and find_mention in diff_logs.rs; the TLS PR (#24) edits other parts of diff_logs.rs, so a rebase of the second one to merge may be needed.

Closes #11

@ilanh
ilanh force-pushed the fix/diff-logs-root-and-excludes branch from 27a78f5 to 266dc1c Compare November 3, 2026 08:19
@ilanh
ilanh merged commit af8d630 into main Nov 3, 2026
2 checks passed
@ilanh
ilanh deleted the fix/diff-logs-root-and-excludes branch November 3, 2026 08:22
ilanh added a commit that referenced this pull request Nov 3, 2026
…entials (#30)

## What and why

Three of five tested projects needed a hand-written custom provider
profile, and `providers.sh` only said `# UNMAPPED ... write a custom
profile`.

- **`generate --scaffold-profiles DIR`** writes `DIR/<id>.yaml` for
every unmapped credential (id = env var lower-cased with hyphens): the
credential, plus endpoints, `access` and binaries taken from the
`egress` directives in the file that declares the credential. `tls=skip`
endpoints get `allow_uninspected_credentials: true` (OpenShell's profile
lint requires it for L4-only credentialed endpoints); credentials with
no egress in their file get `endpoints: []` and TODO comments. Existing
files are kept, nothing is written without the flag, no secret values
are involved. The `UNMAPPED` comment in `providers.sh` now points to the
flag.
- **Misleading duplicate warning:** `egress X duplicates an endpoint the
profile adds` is now only shown when the profile's `binaries` overlap
the rule's binaries (profile bound to `gh`/`git`, app is `node`: the
explicit rule is needed, no warning). Profiles that list no binaries
keep the old behaviour.
- README section "Credentials with no provider profile"; CLI.md
regenerated.

Checked with the real tool: skeletons generated from
anthropic-proxy-rs's sidecar (`tls=skip` case) and synthetic cases all
pass `openshell provider profile lint -f` (OpenShell 0.1.6 on the dev
server). CI cannot run that, so the tests reload the skeletons with our
own profile loader.

Tests: `tests/scaffold_profiles.rs` (3 tests) and a unit test.
`TOOLCHAIN=1.94 scripts/ci-local.sh` and stable clippy pass.

Ordering: independent (new module `scaffold.rs`; small edits in
`providers.rs`, `generate.rs`, `main.rs`'s `Generate` arm). Another PR
(#26) edits other parts of `main.rs`, and #21/#25 edit `do_scan`; any of
them may need a trivial rebase.

Closes #13

---------

Signed-off-by: Ilan Harel <[email protected]>
Co-authored-by: Ilan Harel <[email protected]>
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.

diff-logs does not find the repo root and treats probe scripts in the repo as source

1 participant