Repository navigation
fix(instrument): --force overwrites only files that carry the ownership marker (#169) - #195
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/otel-instrument --forcecould offer hand-written application code for regeneration and write it into the write-guard sentinel. Closes #169.What changed
bootstrapFilesholds only files that construct or configure an SDK. NewexistingOtel.apiCallSitesholds 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-instrumentStep 4: found files are split by the ownership marker. Hand-written paths never enterexistingArtifacts, the overwrite warning or the.claude/.otel-forcesentinel. A service with only hand-written OTel exits with an accurate message,--forceor not/otel-evaluateand the auditor readapiCallSites, so those files are still auditednextjs-brownfield-api-helper(SDK bootstrap, framework hook, API-only helper, second importer) andtests/hooks/force-scope.test.sh. Bumps to 0.8.16Behaviour change: a markerless file the plugin never generated can no longer be overwritten by
--force, even one namedtracing.ts. This matches/otel-uninstrument's marker gate.Test plan
All hook, snapshot, drift and e2e unit tests pass locally;
claude plugin validate . --strictpassesTeeth: 11 of the 16
force-scopechecks fail against the previous proseThe
.NETinline-Program.cscase from the issue comment is covered by the marker split and the new message; adotnet-brownfieldfixture is left open under Ongoing: widen the fixture set as new codebase shapes surface bugs #122Vendor, 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).