main
md 51 lines 2.36 KB
Rendered Raw
1 # dirty_json.py DOX
2
3 ## Purpose
4
5 - Own the `dirty_json.py` helper module.
6 - This module parses and serializes relaxed JSON-like model output.
7 - Keep this file-level DOX profile synchronized with `dirty_json.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `dirty_json.py` owns the runtime implementation.
12 - `dirty_json.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `DirtyJson` (no explicit base class)
15 - `parse_string(json_string)`
16 - `parse(self, json_string)`
17 - `feed(self, chunk)`
18 - `get_start_pos(self, input_str: str) -> int`
19 - Top-level functions:
20 - `try_parse(json_string: str)`
21 - `parse(json_string: str)`
22 - `stringify(obj, **kwargs)`
23
24 ## Runtime Contracts
25
26 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
27 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
28 - Observed side-effect areas: filesystem writes, settings/state persistence.
29 - Imported dependency areas include: `json`.
30
31 ## Key Concepts
32
33 - Important called helpers/classes observed in the source: `DirtyJson.parse_string`, `json.dumps`, `json.loads`, `self._reset`, `self.stack.pop`, `DirtyJson`, `parser.parse`, `self.get_start_pos`, `self._parse`, `self._advance`, `self._skip_whitespace`, `self._parse_object_content`, `self._parse_array_content`, `self._skip_padding_from`, `self._looks_like_missing_comma_before_key`, `result.strip`, `self.current_char.isspace`, `self._parse_value`, `self._continue_parsing`, `self._parse_object`.
34 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
35
36 ## Work Guidance
37
38 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
39 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
40 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
41
42 ## Verification
43
44 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
45 - Related tests observed by source search:
46 - `tests/test_dirty_json.py`
47 - `tests/test_projects.py`
48
49 ## Child DOX Index
50
51 No child DOX files.