Repository navigation
fix(core): bound Markdown directive whitespace scanning - #1926
Merged
Merged
Conversation
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Codex Review SummaryThis 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. |
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
phernandez
force-pushed
the
codex/security-atomic-staging
branch
from
October 28, 2026 21:12
6e59a28 to
d74bce5
Compare
phernandez
force-pushed
the
codex/security-markdown-token-work
branch
from
October 28, 2026 21:12
2217761 to
420978e
Compare
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
phernandez
changed the base branch from
codex/security-atomic-staging
to
main
October 28, 2026 22:18
phernandez
added a commit
that referenced
this pull request
Oct 28, 2026
## Why A CSV header controls the width used to pad every retained row. The existing output limit is checked only after building the expanded table. A 5 KiB source with 5,000 columns and 200 short rows allocates over 9 MiB before rejection. Fixes #1912. ## What Changed Pass the configured output budget into preview rendering and count the exact projected UTF-8 Markdown size before table padding and rendering. Reuse the existing configured limit and error type. ## Implementation Details The projection includes header/separator widths, padded cells, escaped pipes/backslashes, CRLF flattening, line endings, and the row-count footer. This keeps normal preview output byte-identical while preventing header-driven amplification. Empty-file previews also honor their output budget. Stacked on #1926; only CSV preview budgeting and its tests are new here. ## Testing - Before the fix: the bounded public-extractor regression recorded more than 9 MiB of allocation and failed its 1 MiB ceiling. - `uv run pytest tests/document_ingestion/test_csv_preview_budget.py tests/document_ingestion/test_csv_extractor.py -q --no-cov`: 24 passed. - Exact-byte budget tests cover empty, ASCII, escaped Unicode, CRLF, and ragged rows without mocks. - `just fast-check`: passed, including repository type checking. - `just doctor`: passed sandboxed write/index/search self-test. ## Risks / Follow-ups No new budget value or file-size policy: the existing CsvLimits.max_output_bytes now applies before output construction. The source and field limits continue to bound decoding and parsing. --------- Signed-off-by: phernandez <[email protected]>
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.
Why
The terminal
#bm:links_toregex retries a leading whitespace run at every position when no directive follows. A 150,000-space token exceeds a five-second subprocess deadline. Fixes #1900.What Changed
Use a single-character whitespace boundary before the literal directive instead of a repeated leading whitespace group. Existing callers trim the prefix, preserving directive-removal behavior.
Implementation Details
Only the fixed literal can initiate a trailing-whitespace match, so failed whitespace suffixes cannot overlap quadratically. Both observation parsing and code-aware relation directive handling share the corrected pattern. A subprocess bounds regression runtime without mocking the parser.
Stacked on #1925; only the shared directive pattern and its tests are new here.
Testing
uv run pytest tests/markdown/test_directive_work.py tests/markdown/test_markdown_plugins.py -q --no-cov: passed.just fast-check: passed, including repository type checking.just doctor: passed sandboxed write/index/search self-test.Risks / Follow-ups
The shared pattern's match start now points at the directive instead of its leading whitespace; both consumers already trim the prefix, so returned content remains identical. Broader Markdown parser work remains outside this PR.