Skip to content

Add differential pair point-to-point error - #686

Closed
0hmX wants to merge 2 commits into
mainfrom
agent/add-differential-pair-point-to-point-error
Closed

Add differential pair point-to-point error#686
0hmX wants to merge 2 commits into
mainfrom
agent/add-differential-pair-point-to-point-error

Conversation

@0hmX

@0hmX 0hmX commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • add a typed source_differential_pair_not_point_to_point_error Circuit JSON element
  • capture the pair name, connection polarity and selector, connectivity key, source net, and connected source ports
  • register the error in source-element, any-circuit-element, and public CircuitJsonError unions
  • add schema, default-ID, union, polarity, and public-error-type coverage
  • document the new Circuit JSON element in the generated schema reference

Why

RFC tscircuit/rfc#13 requires branched differential-pair conductors to produce an actionable error. Core needs a durable Circuit JSON diagnostic so the error survives serialization and can be displayed by downstream tools.

Developer impact

This PR only adds the schema contract. A follow-up Core PR will emit the error during source design-rule checks and keep invalid differential-pair constraints out of autorouter input.

Validation

  • bun test (287 passed)
  • bun run lint:zod
  • bun run check-snake-case
  • tsc --noEmit
  • bun run build
  • git diff --check

All GitHub Actions checks are green.

@0hmX
0hmX marked this pull request as ready for review August 5, 2026 00:05
Comment on lines +23 to +58
test("source_differential_pair_not_point_to_point_error schema parses and defaults its identifiers", () => {
const error =
source_differential_pair_not_point_to_point_error.parse(errorInput)

expect(error.error_type).toBe(
"source_differential_pair_not_point_to_point_error",
)
expect(error.source_differential_pair_not_point_to_point_error_id).toMatch(
/^source_differential_pair_not_point_to_point_error_/,
)
expect(error.connection_polarity).toBe("positive")
expect(error.connected_source_port_ids).toEqual([
"source_port_1",
"source_port_2",
"source_port_3",
])
const circuitJsonError: CircuitJsonError = error
expect(circuitJsonError.type).toBe(
"source_differential_pair_not_point_to_point_error",
)
})

test("any_circuit_element includes source_differential_pair_not_point_to_point_error", () => {
const parsed = any_circuit_element.parse(errorInput)

expect(parsed.type).toBe("source_differential_pair_not_point_to_point_error")
})

test("source_differential_pair_not_point_to_point_error validates polarity", () => {
expect(() =>
source_differential_pair_not_point_to_point_error.parse({
...errorInput,
connection_polarity: "neutral",
}),
).toThrow()
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file contains 3 test(...) calls (at lines 23, 45, and 51), but the rule states that a *.test.ts file may have AT MOST one test(...). The file should be split into multiple numbered files, for example:

  • source-differential-pair-not-point-to-point-error1.test.ts (schema parses and defaults its identifiers)
  • source-differential-pair-not-point-to-point-error2.test.ts (any_circuit_element includes the error)
  • source-differential-pair-not-point-to-point-error3.test.ts (validates polarity)

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@seveibar seveibar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too specific, use props warning

@0hmX 0hmX closed this Aug 5, 2026
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.

2 participants