Skip to content

fix(sourcegen): split multi-line condition in Activity context remarks#4

Merged
ANcpLua merged 1 commit into
mainfrom
fix-activity-condition-leak
Jun 4, 2026
Merged

fix(sourcegen): split multi-line condition in Activity context remarks#4
ANcpLua merged 1 commit into
mainfrom
fix-activity-condition-leak

Conversation

@ANcpLua
Copy link
Copy Markdown
Owner

@ANcpLua ANcpLua commented Jun 4, 2026

Summary

Follow-up to the example-value escaping fix (PR #3). That fix covered WriteExamplesComment + EventsEmitter; this closes the last instance of the same bug class.

ActivityExtensionsEmitter concatenated RequirementLevel.Condition — a free-form, sometimes multi-line registry field — directly into one AppendDocLine, instead of splitting it the way EventsEmitter already does. The v1.41.0 registry has 46 multi-line conditions (db.*, faas, messaging, k8s, session, feature_flag, …), so any consumer projecting the Activities surface for those prefixes got uncompilable output.

Evidence

A temporary [SemanticConventionActivities("db")] marker emitted 126+ CS0102/CS0246/CS0708 (leaked condition prose parsed as code). After the fix: 0 / 0.

Fix

Split the composed line via SourceWriter.SplitLines before AppendDocLine — idiomatic, matches the existing summary/remarks/Note handling.

Verification

  • Full solution build: 0 / 0
  • SourceGeneration snapshot tests: 60 / 60 (single-line conditions byte-identical)
  • db-activities repro: 126+ errors → 0 / 0 (repro removed; not committed)

🤖 Generated with Claude Code

The activity-context remarks path concatenated RequirementLevel.Condition — a
free-form, sometimes multi-line registry field — straight into a single
AppendDocLine, the same leak class fixed for example values. The v1.41.0
registry has 46 multi-line conditions (db.*, faas, messaging, k8s, session,
feature_flag, ...), so any consumer projecting the Activities surface for those
prefixes got uncompilable output (e.g. [SemanticConventionActivities("db")]
emitted 126+ CS0102/CS0246/CS0708 from leaked prose).

Split the composed line via SourceWriter.SplitLines before AppendDocLine,
matching how EventsEmitter already handles Condition/Note. Single-line
conditions are byte-identical (60/60 snapshot tests pass); a db-activities repro
goes from 126+ errors to 0/0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ANcpLua ANcpLua merged commit 742ba11 into main Jun 4, 2026
2 checks passed
@ANcpLua ANcpLua deleted the fix-activity-condition-leak branch June 4, 2026 01:19
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.

1 participant