You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: tighten code comments and add comment guidance to code style
Remove issue-number references and reviewer-facing context from the inline
and XML doc comments added for the consumer-pump observability change, and
narrow the remaining comments to explaining the code itself.
Add a Comments section to .agent_instructions/code_style.md: no issue/PR links
in comments, comments explain the why of non-obvious code (not the what or the
change history), reviewer rationale belongs in the ADR, keep comments concise.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .agent_instructions/code_style.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,4 +36,9 @@
36
36
- As we support multiple schedulers, these should use their own assembly.
37
37
- As we support multiple locking providers, these should use their own assembly.
38
38
- Default to a class per source file approach, unless one class clearly exists as the details of another.
39
+
- Comments
40
+
- Do not put links or references to issues or PRs (e.g. `(issue #4089)`, `#4207`) in code or XML doc comments. The traceability lives in git history and the ADR, not in the source.
41
+
- A comment is for code that needs explanation — typically the *why* behind a non-obvious decision. Do not narrate *what* the code does, restate the code, or describe the change relative to how the code used to be.
42
+
- Inline comments are not notes to a reviewer. Context about the fix, the alternatives considered, the previous behaviour, or the history of a change is reviewer-facing rationale and belongs in the ADR, not in an inline comment. A future maintainer reading the code only needs what helps them understand the code as it now stands.
43
+
- Keep comments concise. Prefer one tight line over a paragraph.
Copy file name to clipboardExpand all lines: src/Paramore.Brighter/Observability/IAmABrighterTracer.cs
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -45,9 +45,8 @@ public interface IAmABrighterTracer : IDisposable
45
45
/// <param name="message">What is the <see cref="Message"/> that we received; if they have a traceparentid we will use that as a parent for this trace</param>
46
46
/// <param name="messagingSystem">What is the messaging system that we are receiving a message from</param>
47
47
/// <param name="options">The <see cref="InstrumentationOptions"/> for how deep should the instrumentation go</param>
48
-
/// <param name="serializedHeader">The header serialized once by <see cref="EnrichReceiveSpan"/> for the receive span,
49
-
/// threaded in so the process span reuses it instead of serializing the header a second time per message (issue #4089);
50
-
/// when null (no preceding receive span) the header is serialized here</param>
48
+
/// <param name="serializedHeader">The header already serialized by <see cref="EnrichReceiveSpan"/>, reused here instead
49
+
/// of serializing it again; when null (no preceding receive span) the header is serialized by this method</param>
51
50
/// <returns></returns>
52
51
Activity?CreateSpan(
53
52
MessagePumpSpanOperationoperation,
@@ -78,8 +77,8 @@ public interface IAmABrighterTracer : IDisposable
78
77
/// <param name="span">The receive span to enrich; no-op if null</param>
79
78
/// <param name="message">The <see cref="Message"/> that was received</param>
80
79
/// <param name="options">The <see cref="InstrumentationOptions"/> for how deep should the instrumentation go</param>
81
-
/// <returns>The header serialized once for this message (so it can be threaded into <see cref="CreateSpan(MessagePumpSpanOperation,Message,MessagingSystem,InstrumentationOptions,string)"/>
82
-
/// and not serialized again), or null if there was no span to enrich or messaging instrumentation is disabled</returns>
80
+
/// <returns>The serialized header, to pass to <see cref="CreateSpan(MessagePumpSpanOperation,Message,MessagingSystem,InstrumentationOptions,string)"/>
81
+
/// so it is not serialized again; null if there was no span to enrich or messaging instrumentation is disabled</returns>
83
82
string?EnrichReceiveSpan(
84
83
Activity?span,
85
84
Messagemessage,
@@ -88,8 +87,7 @@ public interface IAmABrighterTracer : IDisposable
88
87
/// <summary>
89
88
/// Propagates the producer's baggage onto the consumer side for a received message: lifts the message's
90
89
/// <see cref="MessageHeader.CorrelationId"/> into its <see cref="MessageHeader.Baggage"/> and sets it as the ambient
91
-
/// OpenTelemetry baggage for the current execution context. Called once per received message by the pump so the
92
-
/// propagation runs exactly once, independent of how many spans (receive, process) are created.
90
+
/// OpenTelemetry baggage for the current execution context. Called once per received message by the pump.
93
91
/// </summary>
94
92
/// <param name="message">The <see cref="Message"/> that was received</param>
Copy file name to clipboardExpand all lines: tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_A_Message_Has_A_Malformed_Correlation_Id_The_Pump_Continues.cs
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -85,8 +85,7 @@ public MalformedCorrelationIdPumpObservabilityTests()
Copy file name to clipboardExpand all lines: tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_A_Message_Is_Dispatched_The_Header_Is_Serialized_Once.cs
+1-7Lines changed: 1 addition & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -103,7 +103,6 @@ public MessageHeaderSerializationObservabilityTests()
&&a.TagObjects.Any(to =>tois{Value: not null,Key:BrighterSemanticConventions.MessageType}&&Enum.Parse<MessageType>(to.Value.ToString()??string.Empty)==MessageType.MT_EVENT));
@@ -133,17 +131,13 @@ public void When_a_message_is_dispatched_the_header_is_serialized_once_for_both_
133
131
&&a.TagObjects.Any(to =>tois{Value: not null,Key:BrighterSemanticConventions.MessageType}&&Enum.Parse<MessageType>(to.Value.ToString()??string.Empty)==MessageType.MT_EVENT));
134
132
Assert.NotNull(processSpan);
135
133
136
-
//both spans must still carry the serialized header with the correct value (diagnostic contract preserved)
Copy file name to clipboardExpand all lines: tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_A_Message_With_A_Correlation_Id_Is_Dispatched_Both_Spans_Share_One_Header.cs
+2-7Lines changed: 2 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -103,8 +103,6 @@ public MessageHeaderCorrelationIdObservabilityTests()
Copy file name to clipboardExpand all lines: tests/Paramore.Brighter.Core.Tests/Observability/MessageDispatch/When_Creating_A_Process_Span_Baggage_Propagation_Is_Decoupled.cs
+3-6Lines changed: 3 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -51,25 +51,22 @@ public CreateProcessSpanBaggageDecoupledObservabilityTests()
0 commit comments