GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(id-web): collision-proof spaced-destination placeholders on save (#1348) by dezren39 · Pull Request #4665 · developing-today/code Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 18 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Handed off to opencode claimant: task 10682 claimed by lane code-r, execution lane assigned |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…markdown_serialization (#1348) Port of PR #4665 commit 0a650eb onto current main: the codec split (#4704) moved prosemirror_to_markdown and substitute_spaced_destinations from web/markdown.rs to web/markdown/markdown_serialization.rs, and the old patch no longer applies (its file is 10467 lines vs 7791 on main; rebase conflicts across the whole region). The fix logic is verbatim: collision-proof placeholder minting (ast_contains_literal + fresh_spaced_destination_placeholder), destination-only restoration (restore_spaced_destination) replacing the global str::replace at markdown_serialization.rs:55, and the #1348 collision test moved to the markdown.rs test module.
c8db297 to
f45e814
Compare
|
🤖 Shepherd update — fix ported to current main (task 10682, lane code-a) PR #4665 no longer rebased: its patch targeted pkgs/id/src/web/markdown.rs as of October (10467 lines), but the codec split (#4704) moved prosemirror_to_markdown and substitute_spaced_destinations into pkgs/id/src/web/markdown/markdown_serialization.rs (markdown.rs is 7791 lines on main), and the bug is still live there — the global str::replace restoration sat at markdown_serialization.rs:55. Port (head f45e814, force-pushed with lease): branch reset to current main plus one commit carrying the original fix verbatim —
Verification limits (pre-existing, not this change): cargo check / cargo test for the id lib with the web feature fails on clean main with 5 (check) / 9 (test) errors in fileops/world_hub/WorldService visibility — reproduced identically on an unmodified main worktree this shift; that breakage is already filed as issue #8795. Default-feature cargo test -p id passes (exit 0). rustfmt (edition 2024) reports no diffs in the ported regions; remaining fmt diffs are pre-existing main debt in other files. So this PR waits on CI at the new head; merge only when the runnable checks are green and the #8795 situation is accounted for. No Codex review findings exist on this PR (reviews and review comments both empty on fresh read). Issue #1348 stays open until merge. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: f45e814d4f
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if taken | ||
| .iter() | ||
| .any(|(placeholder, _)| placeholder == &candidate) | ||
| || ast_contains_literal(root, &candidate) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Check previously captured raw URLs when minting placeholders
When a document has multiple spaced destinations, previously substituted URLs are no longer in the AST, so this check can reuse a token contained in one of those raw URLs. For example, [a](<x y>) followed by [b](<idweb-spaced-destination-0-placeholder ](idweb-spaced-destination-2-placeholder)>) visits b first and assigns it token 1, then assigns token 2 to a. Restoring token 1 reintroduces ](idweb-spaced-destination-2-placeholder) inside b's URL, and restoring token 2 rewrites that substring to ](<x y>), corrupting the saved destination. This specific input survived the previous implementation, which assigned tokens 0 and 1. Check the raw values in taken as well as the current AST, or scan an immutable snapshot of the original strings.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in fc30c48 on this branch (task 10682, lane code-d).
You were right: fresh_spaced_destination_placeholder checked candidates against the AST and against the already-minted placeholder names, but not against the raw destinations already captured in taken. A candidate embedded in a captured raw could be minted for a later link, and restoring the captured raw then reintroduced the token where the later restoration would rewrite it.
Fix: minting now also rejects any candidate contained in a captured raw destination (taken.iter().any(|(_, raw)| raw.contains(&candidate))), with the invariant documented on the function.
Regression test: test_spaced_destination_placeholder_avoids_captured_raw_urls in pkgs/id/src/web/markdown.rs uses exactly this shape — [a](<x y>) alongside a link whose raw destination literally contains the -0- and -2- tokens — and asserts a byte-identical round-trip and fixpoint. Verified: the new test fails on the pre-fix code and passes with the fix, and the full web::markdown test module passes (290 tests).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…aw destinations (#1348) Codex review on PR #4665 (P2): fresh_spaced_destination_placeholder checked candidates against the AST and minted names but not against raw destinations already captured in taken. Restoring a captured raw reintroduces its literal text while later placeholders are still pending, so a token embedded in a captured raw would be rewritten by a later restoration, corrupting that destination. Minting now also rejects candidates contained in any captured raw, and the invariant is documented on the function. Regression test test_spaced_destination_placeholder_avoids_captured_raw_urls (verified failing pre-fix, passing post-fix; full web::markdown module: 290 passed). Oracle: byte-identical round-trip + fixpoint of the Codex example document.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: fc30c482b5
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| #[test] | ||
| fn test_spaced_destination_placeholder_collision_preserves_literal_text() { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Add property coverage for placeholder collision invariants
The new serializer coverage consists only of fixed examples, but AGENTS.md explicitly requires property tests for meaningful serializer invariants and says example tests do not replace them. The collision-proofing invariant here depends on combinations of token indices, traversal order, repeated destinations, and captured raw URLs; the added examples cover only selected combinations. Add proptest coverage generating these combinations and checking that literal content and raw destinations are preserved and serialization reaches a fixpoint.
AGENTS.md reference: AGENTS.md:L38-L42
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
id(web): spaced-destination placeholder can collide with document text — global replace on save rewrites the document's own words (PR #1022)
There was an error while loading. Please reload this page.