Skip to content

Commit db5c8d1

Browse files
committed
docs: Add task files for whitespace bug fix
- Create task #81 for writing tests - Create task #82 for implementing fix - Create task #83 for quote stripping feature - Update task readme with new entries
1 parent 5222068 commit db5c8d1

File tree

4 files changed

+135
-65
lines changed

4 files changed

+135
-65
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Write tests for whitespace detection bug in parse_from_argv
2+
3+
## Description
4+
5+
Create comprehensive test suite that reproduces the whitespace detection bug in `unilang_parser/src/parser_engine.rs`. The current implementation only checks for spaces (`.contains(' ')`) when determining if values need quoting, but fails to detect tabs, newlines, and other whitespace characters. This undermines the entire purpose of the argv-based parser, which was designed to preserve token boundaries.
6+
7+
This task is part of the TDD bug-fix sequence. Related tasks: #082 (implement fix).
8+
9+
## Requirements
10+
11+
- All work must strictly adhere to all applicable rulebooks
12+
(discover via `prompt .rulebooks.relevant`)
13+
14+
## Acceptance Criteria
15+
16+
- Test suite created in `unilang_parser/tests/argv_multiword_bug_test.rs`
17+
- Tests verify tabs within values fail (currently marked as ignored)
18+
- Tests verify newlines within values fail (currently marked as ignored)
19+
- Tests verify all Unicode whitespace characters
20+
- Tests document expected behavior vs current broken behavior
21+
- All new tests fail consistently, demonstrating the bug
22+
- Test documentation includes root cause explanation
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Fix whitespace detection bug in parse_from_argv
2+
3+
## Description
4+
5+
Fix the whitespace detection bug in `parse_from_argv` method at lines 1135 and 1148 of `unilang_parser/src/parser_engine.rs`. Change from checking only spaces (`.contains(' ')`) to checking all whitespace characters (`.chars().any(|c| c.is_whitespace())`).
6+
7+
This is a critical 2-line fix that enables the parser to properly quote values containing tabs, newlines, and other non-space whitespace, preserving argv token boundaries as designed.
8+
9+
This task implements the fix after tests are written in #081.
10+
11+
## Requirements
12+
13+
- All work must strictly adhere to all applicable rulebooks
14+
(discover via `prompt .rulebooks.relevant`)
15+
- Tests from task #081 must be written and failing before implementing fix
16+
17+
## Acceptance Criteria
18+
19+
- Line 1135 changed from `value.contains( ' ')` to `value.chars().any(|c| c.is_whitespace())`
20+
- Line 1148 changed from `arg.contains( ' ')` to `arg.chars().any(|c| c.is_whitespace())`
21+
- All tests from task #081 now pass
22+
- Previously ignored tests (`test_argv_tab_characters`, `test_argv_newline_characters`) now pass
23+
- No regressions in existing tests
24+
- Full test suite passes: `w3 .test l::3` on both unilang and unilang_parser crates
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Implement preserved quotes stripping in parse_from_argv
2+
3+
## Description
4+
5+
Enhance `parse_from_argv` to detect and strip literal quote characters that occur when users over-quote parameters. For example, when a user types `'param::"value"'`, the shell preserves the inner double quotes as literal characters, resulting in `param::"value"` being passed to the parser. Currently this creates double-quoting issues.
6+
7+
This is a lower-priority enhancement that improves handling of edge cases. The natural syntax (without over-quoting) already works correctly.
8+
9+
## Requirements
10+
11+
- All work must strictly adhere to all applicable rulebooks
12+
(discover via `prompt .rulebooks.relevant`)
13+
14+
## Acceptance Criteria
15+
16+
- Detection logic added to identify literal quote characters in parameter values
17+
- Quote stripping logic implemented while preserving intentionally escaped quotes
18+
- Tests created covering over-quoting scenarios
19+
- Test `test_argv_multiword_parameter_with_shell_quotes_preserved` passes (currently ignored)
20+
- No regressions in existing functionality
21+
- Documentation updated explaining quote handling behavior

0 commit comments

Comments
 (0)