Repository navigation
Reject duplicate node IDs in graph clones - #396
Merged
jserv merged 1 commit intoOct 22, 2026
Merged
Conversation
jserv
reviewed
Oct 21, 2026
jserv
reviewed
Oct 21, 2026
bangyou0912
force-pushed
the
codex/reject-duplicate-graph-nodes
branch
from
October 21, 2026 02:29
3e698ef to
6f239f8
Compare
Contributor
Author
|
The browser, Rust, and mutation checks pass at 6f239f8. The portable lane fails only at cargo-audit, which reports RUSTSEC-2026-0381 and RUSTSEC-2026-0382 in the existing dependencies. Cargo.toml and Cargo.lock are unchanged from upstream main at f3ae86c. The failed run is https://github.com/sysprog21/codetrial/actions/runs/39533317148. Should the dependency updates be handled separately, with this PR rebased afterward? |
Contributor
Rebase latest |
bangyou0912
force-pushed
the
codex/reject-duplicate-graph-nodes
branch
from
October 21, 2026 02:46
6f239f8 to
45a8896
Compare
bangyou0912
marked this pull request as ready for review
October 21, 2026 03:00
jserv
reviewed
Oct 21, 2026
bangyou0912
force-pushed
the
codex/reject-duplicate-graph-nodes
branch
from
October 21, 2026 05:07
45a8896 to
7031df8
Compare
jserv
requested changes
Oct 21, 2026
jserv
left a comment
Contributor
There was a problem hiding this comment.
Rebase latest main branch and resolve conflicts.
bangyou0912
force-pushed
the
codex/reject-duplicate-graph-nodes
branch
from
October 22, 2026 05:45
7031df8 to
3cf4dfd
Compare
jserv
reviewed
Oct 22, 2026
Graph output was collapsed by node ID, allowing distinct objects with the same ID to pass as a valid clone. Reject these outputs in every runner while retaining legitimate shared nodes and cycles, so reported test results reflect the graph the candidate actually returned. C also rejects IDs outside its supported range so extra nodes cannot disappear from the serialized output and bypass validation. Existing input nodes are reported as deep-copy errors before duplicate-ID errors. Closes sysprog21#381
bangyou0912
force-pushed
the
codex/reject-duplicate-graph-nodes
branch
from
October 22, 2026 06:09
3cf4dfd to
fb8b164
Compare
Contributor
|
Thank @bangyou0912 for contributing! |
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.
Graph serializers discarded a second object carrying an already visited node ID, so an invalid clone could receive full marks. JavaScript, Python, C, C++, and Java now reject distinct objects sharing an ID while continuing to accept cycles and shared nodes in valid graphs. C neighbor ordering remains tracked separately by #360.
The regression suite executes the browser runners and compiled harnesses against a valid cyclic triangle, a duplicated root, and a duplicated non-root node in each language. Before the fix, all ten invalid-graph checks failed and all five valid-graph checks passed. Afterward, all 15 checks passed without skips on both Windows and Linux.
Validation: Prettier, ESLint, Clippy, and the Git hooks passed. The completed ./scripts/test.sh run reported 1,294 browser checks passing with no failures and six Java checks skipped; Java was then installed and the focused five-language suite passed without skips. The full gate failed at the existing CLI file-permission assertion (0777 instead of 0600 on the WSL Windows filesystem) and six mutation-planning checks caused by missing jq. After installing jq, all six mutation-planning checks passed. The full gate is not green locally; the CLI failure also prevented later Rust test targets from running. Additional broad reruns were stopped after severe local resource contention and do not establish a passing result.
The completed gate also skipped commentflow, ruff, shfmt, shellcheck, cargo-audit, and actionlint because their tools were unavailable. Credentialed live-interview checks, mutation testing, and cross-platform release builds were not run locally and remain for their appropriate CI or credentialed lanes.
The before and after screenshots show the same intentionally invalid JavaScript solution on the actual interview page, served from a local static test server: 5/5 before the fix and 2/5 afterward, with the three corrupted graph cases rejected. This was not a credentialed live interview.
Closes #381
Summary by cubic
Fixes graph clone validation so returned graphs with distinct nodes sharing an ID are rejected instead of silently passing. Previously, serializers collapsed nodes by ID, letting an invalid clone earn full marks.
Closes #381.
Written for commit fb8b164. Summary will update on new commits.