Skip to content

fix(instrument): --force overwrites only files that carry the ownership marker (#169) - #195

Merged
radra23 merged 1 commit into
mainfrom
fix/force-targets-generated-only
Oct 3, 2026
Merged

radra23 merged 1 commit into
mainfrom
fix/force-targets-generated-only

Conversation

@radra23

@radra23 radra23 commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

/otel-instrument --force could offer hand-written application code for regeneration and write it into the write-guard sentinel. Closes #169.

What changed

  • Scanner: bootstrapFiles holds only files that construct or configure an SDK. New existingOtel.apiCallSites holds hand-written files that use or extend OTel (API call sites, custom processors, the data files behind them); all importers of a call-site helper are recorded
  • /otel-instrument Step 4: found files are split by the ownership marker. Hand-written paths never enter existingArtifacts, the overwrite warning or the .claude/.otel-force sentinel. A service with only hand-written OTel exits with an accurate message, --force or not
  • /otel-evaluate and the auditor read apiCallSites, so those files are still audited
  • New fixture nextjs-brownfield-api-helper (SDK bootstrap, framework hook, API-only helper, second importer) and tests/hooks/force-scope.test.sh. Bumps to 0.8.16

Behaviour change: a markerless file the plugin never generated can no longer be overwritten by --force, even one named tracing.ts. This matches /otel-uninstrument's marker gate.

Test plan

  • All hook, snapshot, drift and e2e unit tests pass locally; claude plugin validate . --strict passes

  • Teeth: 11 of the 16 force-scope checks fail against the previous prose

  • The .NET inline-Program.cs case from the issue comment is covered by the marker split and the new message; a dotnet-brownfield fixture is left open under Ongoing: widen the fixture set as new codebase shapes surface bugs #122

  • Vendor, SDK and semantic-convention facts were verified against the source, not recalled — linked where it isn't obvious.

  • Nothing hardcoded that has a single source of truth (SEMCONV_VERSION, backends.txt, hooks/otel-paths.sh).

…ip marker (#169)

The scanner defined bootstrapFiles as "the SDK bootstrap and any helper module beside it",
and /otel-instrument Step 4 treated that list as the set of existing generated artifacts.
On a brownfield Next.js service the list also held the framework hook and an application
helper that only calls the Logs API, so the "already exists" gate and the --force overwrite
warning named them, and Step 4 wrote them into the .claude/.otel-force sentinel. On .NET the
SDK is configured inline in Program.cs, so the composition root landed in the list too.

- scanner: bootstrapFiles now holds only files that construct or configure an SDK. A new
  existingOtel.apiCallSites field holds hand-written files that use or extend OTel (API call
  sites, custom processors, the data files behind them), and the scanner records every
  importer of a call-site helper, not just the first.
- /otel-instrument Step 4: files found are split by the ownership marker. Hand-written paths
  never enter existingArtifacts, the overwrite warning or the sentinel; --force widens what
  may be regenerated and never turns user code into generated code. A service whose OTel is
  hand-written and has no generated artifact exits with an accurate message instead of the
  generic "Generated artifact already exists".
- /otel-evaluate and the auditor read apiCallSites too, so those files are still audited.

Adds fixtures/nextjs-brownfield-api-helper (one file per role: SDK bootstrap, framework hook,
API-only helper, a second importer) and tests/hooks/force-scope.test.sh, wired into lint-hooks.
11 of its 16 checks fail against the previous prose. Bumps to 0.8.16.

The .NET inline-composition-root case from the issue comment is covered by the marker split
and the new message; a dotnet-brownfield fixture is still open under #122.
@radra23
radra23 merged commit a066937 into main Oct 3, 2026
11 checks passed
@radra23
radra23 deleted the fix/force-targets-generated-only branch October 3, 2026 14:06
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.

[bug] scanner puts OTel-API call-site helpers and the framework hook into bootstrapFiles, so --force targets hand-written app code

1 participant