Ticket graphs

Every ticket as the root of its provenance graph — goal, patch, approval, runs and (as the ticket-class build lands) mandate, manifestations, guarantees, journey, artifacts and children. Rendered through the <<<TicketGraphList>>> tag.

← all ticket-graphs

DONE#389 forge-refactor

Rewrite gitlab__testmonkeyalpha-group__jazz-forge__dz_debug:tests/test_dz_debug.py as behavior-preserving, installable, control-config'd Python [forge-rw:c8f726c326f94dd3]

goal

THIS UNIT SUPERSEDES #309 — it is the SAME module and the same work, re-filed to be SELF-CONTAINED. The superseded unit named its source only as a `git cat-file` command against the forge's bare repos, which the sandboxed pair_loop worker that executes these tickets cannot run, so it could not be done as filed (#346; #259 is the proof). A ticket body is permanent in SQL (tg_tickets_immutable_identity, migrations/0029_ticket_authorization .sql:111-117), so that body could not be repaired — this ticket carries the fix instead, and the original is halted by a stop ticket rather than erased. Do the work HERE. Rewrite ONE unique forge module as entirely new, behavior-preserving, installable, control-config'd Python, per the FORGE-wide refactor standard #200 (#std). This ticket covers ONE module — the one identified below — and nothing else. It was filed against the module's DEDUPLICATED identity, so if that module was copy-pasted across the forge, every copy is covered by this single ticket. MODULE KEY : forge-rw:c8f726c326f94dd3 (the ticketer's idempotency marker — it lives in this ticket's TITLE. Do not edit the title, or the module will be re-filed as a duplicate.) IDENTITY : AST-NORMALIZED — codebean's `_ast_norm` (#183), i.e. ast.dump(ast.parse(ast.unparse(ast.parse(src)))). Copies of this module that differ only in comments, blank lines, quoting or spacing carry the SAME module-sha and are covered by THIS ticket. A differing docstring is real content, so a module whose docstring differs is a DIFFERENT module with its own ticket. SIZE : 2301 bytes EXTENSION : .py CANONICAL SOURCE (the location this ticket is named for): repo : gitlab__testmonkeyalpha-group__jazz-forge__dz_debug path : tests/test_dz_debug.py ref : refs/heads/main (as recorded when this module was first filed) blob : 08863df5ccd3fc3c06e3ccd81ad7f3dcddd97d9f (git blob sha1) REFERENCE ONLY — you do NOT need this command. This module's bytes are embedded COMPLETE in THE ORIGINAL SOURCE block below, and that is what the rewrite is based on. For a reader who does have forge access: git --git-dir=/Users/stevenpeterson/code/installed/jazz-project/config/forge/remotes/gitlab__testmonkeyalpha-group__jazz-forge__dz_debug.git cat-file blob 08863df5ccd3fc3c06e3ccd81ad7f3dcddd97d9f THE SAME MODULE ALSO LIVES AT THESE FORGE TIPS — 1 copy/copies. They SHARE THIS ticket: this module is rewritten ONCE, and every location below is satisfied by that one rewrite. Do not file a ticket per copy. testmonkeyalpha-group__jazz-forge__dz_debug:tests/test_dz_debug.py HISTORICAL OCCURRENCES of this exact blob — every OTHER DISTINCT {repo, path} the omni-git index (`occ`, joined on the git blob sha1) records this byte-identical file at, with the index's own `ts` for the first row of each. Any place this run enumerated LIVE is listed under the forge tips above, not here. Context for the rewrite, not extra work: forge__work__dz_debug:tests/test_dz_debug.py [occ.ts 20260701T122754Z] testmonkeyalpha-group/jazz-forge/dz_debug:tests/test_dz_debug.py [occ.ts gitlab] THE ORIGINAL SOURCE, EMBEDDED — YOU NEED NO FORGE ACCESS TO DO THIS TICKET. The module's own bytes are reproduced below, inside this ticket. THEY are the authoritative copy and the behavior-preserving basis: rewrite from them. The `git --git-dir=... cat-file blob` command under CANONICAL SOURCE above is kept only as a REFERENCE for a reader who happens to have forge access — running it is NOT part of this ticket. (Why the bytes are here at all: the pair_loop worker that executes this ticket is sandboxed to the ticket's own congruency worktree and cannot read the forge's bare repos. Ticket #346 is the fix that put them on the ticket.) The block BEGINS at the line ===ORIGINAL SOURCE (verbatim, the behavior-preserving basis)=== and ENDS at the first line ===END SOURCE=== Everything strictly between those two lines is the module — 2301 byte(s), byte for byte, with no re-indentation, no re-wrapping and nothing elided. ===ORIGINAL SOURCE (verbatim, the behavior-preserving basis)=== """Regression tests for dz_debug — Logger filtering + debug_decorator + save.""" import json import pytest from dz_debug.log import Logger from dz_debug import logger as dlog def _logger(tmp_path, **cfg): base = {"log_root": str(tmp_path), "mirror_to_stderr": False} base.update(cfg) return Logger("svc", build_id="test", config=base) def test_logger_writes_line(tmp_path): log = _logger(tmp_path) log.info("hello world") log.close() text = (tmp_path / "test" / "svc.log").read_text() assert "hello world" in text and "[svc]" in text and "INFO" in text def test_min_level_filters(tmp_path): log = _logger(tmp_path, profile="standard") # min_level INFO -> DEBUG dropped log.debug("should-not-appear") log.info("should-appear") log.close() text = log.path.read_text() assert "should-appear" in text and "should-not-appear" not in text def test_channel_tags_gate_debug(tmp_path): log = _logger(tmp_path, profile="debug") # perf on, payload off in debug log.debug("perf-line", tags=["perf"]) log.debug("payload-line", tags=["payload"]) log.close() text = log.path.read_text() assert "perf-line" in text and "payload-line" not in text def test_path_and_channels_properties(tmp_path): log = _logger(tmp_path, profile="debug") assert log.path.name == "svc.log" assert isinstance(log.channels, dict) and log.channels["perf"] is True log.close() def test_debug_decorator_records_and_returns(): dlog.L.clear() @dlog.debug_decorator def add(a, b): return a + b assert add(2, 3) == 5 assert any(e.get("function") == "add" and "execution_time" in e for e in dlog.L.values()) def test_debug_decorator_reraises_and_records_exception(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) # contain the trace.json side effect dlog.L.clear() @dlog.debug_decorator def boom(): raise ValueError("nope") with pytest.raises(ValueError): boom() assert any("exception" in e for e in dlog.L.values()) def test_save_writes_json(tmp_path): dlog.L.clear() dlog.L["k"] = {"function": "x"} out = tmp_path / "trace.json" dlog.save(str(out)) assert json.loads(out.read_text())["k"]["function"] == "x" ===END SOURCE=== THE CALLABLE SURFACE — every callable in the original, lowered with codebean's `lower_node` (#183). The rewrite must present THIS surface (same names, same parameters, same defaults) so callers of the original keep working: _logger(tmp_path, **cfg) test_logger_writes_line(tmp_path) test_min_level_filters(tmp_path) test_channel_tags_gate_debug(tmp_path) test_path_and_channels_properties(tmp_path) test_debug_decorator_records_and_returns() test_debug_decorator_reraises_and_records_exception(tmp_path, monkeypatch) test_save_writes_json(tmp_path) CAPTURED BEHAVIORAL EXEMPLARS: none. no function in this module is minable — criteria_miner mines only self-contained pure functions (it refuses anything that mentions a world-touching or non-deterministic name, plus methods and no-arg functions), and nothing here qualified This does NOT weaken the ticket's bar — it MOVES the work: you must write the equivalence exemplars by hand from the original's behavior before rewriting, and they are what settles this ticket. THE STANDARD — #200's four requirements, which this ticket exists to enforce. All four are the standard's own words; none is optional: 1. BEHAVIOR-PRESERVING, VERIFIED NOT ASSERTED — the deliverable is ENTIRELY NEW source code (rewritten, not copied). It must reproduce the ORIGINAL's behavior, and the proof is the exemplars above (captured via codebean lower_* #183 + criteria_miner IO-exemplars, exactly as #200 specifies). 2. A PYTHON MODULE — regardless of the source language. This module's source is `.py`; the rewrite is Python either way. 3. INSTALLABLE — a proper package: pyproject.toml, `pip install -e .` works, console entry points where applicable. 4. CONTROL-CONFIG'D — NO hardcoded paths or params. A JSON/registry config object drives it (the install.json / registry.json idiom of this repo), and per note-for-claude a tool that cannot see its config THROWS rather than guessing a default. ACCEPTANCE (#200's, per rewrite ticket) — this ticket settles when ALL of: a. the new source reproduces every captured exemplar above, plus the edge cases you add for what sampling cannot reach (paste the runs as evidence); b. it presents the callable surface above, so existing callers keep working; c. `pip install -e .` installs it clean from its own pyproject.toml; d. it runs off a config object with ZERO hardcoded settings, and throws without one. Kind is `build` (a pair: coder + adversarial tester). This ticket hangs off #200 by a `spawned` edge, so a stop ticket aimed at #200 brakes every rewrite in this programme. Filed mechanically by checkouts/current/congruency/tools/forge_refactor_ticketer.py under ticket #201, from the forge bare repos at /Users/stevenpeterson/code/installed/jazz-project/config/forge/remotes. Its original source is embedded above (#346), so this ticket is complete on its own.

patch

none

approval

unapproved

runs

no runs recorded

mandate (clauses)

not yet recorded — lands with the ticket-class build

manifestations

not yet recorded — lands with the ticket-class build

guarantees

not yet recorded — lands with the ticket-class build

journey (blunders & successes)

not yet recorded — lands with the ticket-class build

artifacts (forge)

not yet recorded — lands with the ticket-class build

source (forge tree)

browse congruency source (forge-parked tree)

children

#309 Rewrite gitlab__testmonkeyalpha-group__jazz-forge__dz_debug:tests/test_dz_debug.py as behavior-preserving, installable, control-config'd Python [forge-rw:c8f726c326f94dd3] (supersedes · REQUESTED)