impact.py

clew/guard/impact.py

Change-impact analysis from git diff.

_cell

str clew.guard.impact._cell(str text)

Make one table cell out of repo-controlled text.

clew/guard/impact.py:660

Source · 5 lines
def _cell(text: str) -> str:
    collapsed = text.replace("\r", " ").replace("\n", " ").replace("\t", " ")
    return collapsed.replace("|", "\\|")

Activity · 2 steps
lines 661–661collapsed = text.replace("\r", " ").replace("\n", " ").replace("\t", " ")lines 662–662return collapsed.replace("|", "\\|")

Flows

_collect_changed_lines

set[int] clew.guard.impact._collect_changed_lines(str file_path, bool staged, str|None diff_range, RunCommand|None run_command)

Collect all changed lines for a file from branch diff and/or staged changes.

clew/guard/impact.py:83

Source · 19 lines
def _collect_changed_lines(
    file_path: str,
    staged: bool,
    diff_range: str | None,
    run_command: RunCommand | None,
) -> set[int]:
    changed: set[int] = set()
    diff_output = _get_file_diff(file_path, staged, diff_range, run_command)
    if diff_output:
        changed.update(parse_changed_lines(diff_output))
    if diff_range and not staged:
        staged_output = _get_file_diff(
            file_path, staged=True, diff_range=None, run_command=run_command
        )
        if staged_output:
            changed.update(parse_changed_lines(staged_output))
    return changed

Activity · 9 steps
lines 89–89changed: set[int] = set()lines 90–90diff_output = _get_file_diff(file_path, staged, diff_range, run_command)lines 91–91◇ if diff_outputlines 92–92changed.update(parse_changed_lines(diff_output))lines 93–93◇ if diff_range and not stagedlines 94–96staged_output = _get_file_diff( file_path, staged=True, diff_range=None, run_command=run_command )lines 97–97◇ if staged_outputlines 98–98changed.update(parse_changed_lines(staged_output))lines 99–99return changed

Flows

_extract_changed_functions

list[ChangedFunction] clew.guard.impact._extract_changed_functions(str file_path, dict[str, Any] config, set[int] changed_lines)

Find changed functions in a single file given changed line numbers.

clew/guard/impact.py:124

Source · 33 lines
def _extract_changed_functions(
    file_path: str,
    config: dict[str, Any],
    changed_lines: set[int],
) -> list[ChangedFunction]:
    functions = parse_source_file(file_path, config)
    if functions is None:
        return []

    result: list[ChangedFunction] = []
    for func in functions:
        start = func.doxygen.start_line if func.doxygen else func.def_line
        func_lines = set(range(start, func.body_end + 1))
        if not func_lines & changed_lines:
            continue

        reqs = func.doxygen.tags.get("req", []) if func.doxygen else []
        version = None
        if func.doxygen and "version" in func.doxygen.tags:
            version = func.doxygen.tags["version"][0]

        result.append(
            ChangedFunction(
                name=func.name,
                file_path=file_path,
                reqs=reqs,
                new_version=version,
                qualified=func.qualified,
            )
        )
    return result

Activity · 15 steps
lines 129–129functions = parse_source_file(file_path, config)lines 130–130◇ if functions is Nonelines 131–131return []lines 133–133result: list[ChangedFunction] = []lines 134–134◇ for func in functionslines 135–135start = func.doxygen.start_line if func.doxygen else func.def_linelines 136–136func_lines = set(range(start, func.body_end + 1))lines 137–137◇ if not func_lines & changed_lineslines 138–138continuelines 140–140reqs = func.doxygen.tags.get("req", []) if func.doxygen else []lines 141–141version = Nonelines 142–142◇ if func.doxygen and "version" in func.doxygen.tagslines 143–143version = func.doxygen.tags["version"][0]lines 145–153result.append( ChangedFunction( name=func.name, file_path=file_path, reqs=reqs, new_version=version, qualified=func.qualified, ) )lines 154–154return result

Requirements

REQ-DDB-GUARD-008

Flows

_get_file_diff

str | None clew.guard.impact._get_file_diff(str file_path, bool staged, str|None diff_range, RunCommand|None run_command)

Get raw diff output for a single file.

clew/guard/impact.py:105

Source · 15 lines
def _get_file_diff(
    file_path: str,
    staged: bool,
    diff_range: str | None,
    run_command: RunCommand | None,
) -> str | None:
    # git.run_git owns the failure contract and returns None; no local except tuple to
    # drift onto a narrower set.
    if staged:
        return get_staged_diff(file_path, run_command)
    if diff_range:
        return get_diff(file_path, diff_range, run_command)
    return None

Activity · 5 steps
lines 113–113◇ if stagedlines 114–114return get_staged_diff(file_path, run_command)lines 115–115◇ if diff_rangelines 116–116return get_diff(file_path, diff_range, run_command)lines 117–117return None

Flows

_get_requirements_config

tuple[str, str, str, str] | None clew.guard.impact._get_requirements_config(dict[str, Any] config)

Extract requirements config, raising if a declared catalog is unusable.

clew/guard/impact.py:212

Source · 34 lines
def _get_requirements_config(
    config: dict[str, Any],
) -> tuple[str, str, str, str] | None:
    req_config = get_requirements(config)
    if not req_config:
        logger.info("No requirements section declared; catalog features are off")
        return None

    req_file = req_config.get("file")
    if not req_file:
        # GH #68: a repository whose catalogue its consumer owns names only `external`.
        if req_config.get("external"):
            return None
        raise RequirementsError(
            "impact.requirements is declared but neither impact.requirements.file nor "
            "impact.requirements.external is"
        )
    # Containment before open(): the catalog path is repo-controlled, and its rows are
    # echoed back in validation errors. Without this, pointing it at any readable file
    # turned the error channel into a file-disclosure primitive.
    resolve_contained_path(req_file, setting="impact.requirements.file")
    if not Path(req_file).exists():
        raise RequirementsError(f"Requirements catalog not found: {req_file}")

    fmt = req_config.get("format", REQUIREMENTS_FORMAT_DEFAULT)
    logger.info("Requirements catalog: %s (format=%s)", req_file, fmt)
    return (
        req_file,
        fmt,
        req_config.get("id_column", REQUIREMENTS_ID_COLUMN_DEFAULT),
        req_config.get("name_column", REQUIREMENTS_NAME_COLUMN_DEFAULT),
    )

Activity · 15 steps
lines 215–215req_config = get_requirements(config)lines 216–216◇ if not req_configlines 217–217logger.info("No requirements section declared; catalog features are off")lines 218–218return Nonelines 220–220req_file = req_config.get("file")lines 221–221◇ if not req_filelines 223–223◇ if req_config.get("external")lines 224–224return Nonelines 225–228raise RequirementsError( "impact.requirements is declared but neither impact.requirements.file nor " "impact.requirements.external is" )lines 232–232resolve_contained_path(req_file, setting="impact.requirements.file")lines 233–233◇ if not Path(req_file).exists()lines 234–234raise RequirementsError(f"Requirements catalog not found: {req_file}")lines 236–236fmt = req_config.get("format", REQUIREMENTS_FORMAT_DEFAULT)lines 237–237logger.info("Requirements catalog: %s (format=%s)", req_file, fmt)lines 238–243return ( req_file, fmt, req_config.get("id_column", REQUIREMENTS_ID_COLUMN_DEFAULT), req_config.get("name_column", REQUIREMENTS_NAME_COLUMN_DEFAULT), )

Requirements

REQ-DDB-GUARD-011

Flows

_load_csv_full

dict[str, dict[str, str]] clew.guard.impact._load_csv_full(str path, str id_col)

Parse CSV file into req_id -> full row mapping.

clew/guard/impact.py:479

Show on the map →

Called by none

Calls none

Source · 18 lines
def _load_csv_full(path: str, id_col: str) -> dict[str, dict[str, str]]:
    reqs: dict[str, dict[str, str]] = {}
    with open(path, newline="", encoding="utf-8") as f:
        reader = csv.DictReader(f)
        if reader.fieldnames is not None and id_col not in reader.fieldnames:
            raise RequirementsError(
                f"Requirements catalog {path}: id_column {id_col!r} is not in the header "
                f"({', '.join(reader.fieldnames)})"
            )
        for row in reader:
            # A row shorter than the header yields None values (csv restval), which
            # used to raise AttributeError on .strip().
            req_id = (row.get(id_col) or "").strip()
            if req_id:
                reqs[req_id] = {k: (v or "").strip() for k, v in row.items()}
    return reqs

Activity · 10 steps
lines 480–480reqs: dict[str, dict[str, str]] = {}lines 481–481with open(path, newline="", encoding="utf-8") as flines 482–482reader = csv.DictReader(f)lines 483–483◇ if reader.fieldnames is not None and id_col not in reader.fieldnameslines 484–487raise RequirementsError( f"Requirements catalog {path}: id_column {id_col!r} is not in the header " f"({', '.join(reader.fieldnames)})" )lines 488–488◇ for row in readerlines 491–491req_id = (row.get(id_col) or "").strip()lines 492–492◇ if req_idlines 493–493reqs[req_id] = {k: (v or "").strip() for k, v in row.items()}lines 494–494return reqs

Requirements

REQ-DDB-GUARD-011

_load_yaml_full

dict[str, dict[str, str]] clew.guard.impact._load_yaml_full(str path, str id_col)

Parse a YAML catalog into req_id -> full row mapping.

clew/guard/impact.py:514

Source · 18 lines
def _load_yaml_full(path: str, id_col: str) -> dict[str, dict[str, str]]:
    try:
        with open(path) as f:
            data = yaml.safe_load(f)
    except (OSError, yaml.YAMLError) as e:
        raise RequirementsError(f"Could not read requirements catalog {path}: {e}") from e

    if isinstance(data, dict) and REQUIREMENTS_ROOT_KEY in data:
        return _rows_from_mapping(data[REQUIREMENTS_ROOT_KEY], path)
    if isinstance(data, list):
        logger.info("%s uses the flat list form; the mapping form is preferred", path)
        return _rows_from_list(data, id_col)
    raise RequirementsError(
        f"Requirements catalog {path} must be a mapping with a top-level "
        f"'{REQUIREMENTS_ROOT_KEY}:' key, or a list of rows"
    )

Activity · 11 steps
lines 515–515trylines 516–516with open(path) as flines 517–517data = yaml.safe_load(f)lines 518–518except (OSError, yaml.YAMLError) as elines 519–519raise RequirementsError(f"Could not read requirements catalog {path}: {e}") from elines 521–521◇ if isinstance(data, dict) and REQUIREMENTS_ROOT_KEY in datalines 522–522return _rows_from_mapping(data[REQUIREMENTS_ROOT_KEY], path)lines 523–523◇ if isinstance(data, list)lines 524–524logger.info("%s uses the flat list form; the mapping form is preferred", path)lines 525–525return _rows_from_list(data, id_col)lines 526–529raise RequirementsError( f"Requirements catalog {path} must be a mapping with a top-level " f"'{REQUIREMENTS_ROOT_KEY}:' key, or a list of rows" )

Requirements

REQ-DDB-GUARD-011

_markdown_row

str clew.guard.impact._markdown_row(ImpactEntry entry, bool owned, bool tested)

One requirement's table row.

clew/guard/impact.py:698

Source · 12 lines
def _markdown_row(entry: ImpactEntry, owned: bool, tested: bool) -> str:
    name = _cell(entry.req_name or "\u2014")
    func_names = ", ".join(
        _cell(f.name) + (f" (via {_cell(' → '.join(f.via))})" if f.via else "")
        for f in entry.functions
    )
    dash = chr(0x2014)
    who = f" {', '.join(_cell(r) for r in entry.reviewers or []) or dash} |" if owned else ""
    tests = f" {', '.join(_cell(t.name) for t in entry.tests or []) or dash} |" if tested else ""
    return f"| {_cell(entry.req_id)} | {name} | {func_names} |{who}{tests}"

Activity · 6 steps
lines 699–699name = _cell(entry.req_name or "\u2014")lines 700–703func_names = ", ".join( _cell(f.name) + (f" (via {_cell(' → '.join(f.via))})" if f.via else "") for f in entry.functions )lines 704–704dash = chr(0x2014)lines 705–705who = f" {', '.join(_cell(r) for r in entry.reviewers or []) or dash} |" if owned else ""lines 706–706tests = f" {', '.join(_cell(t.name) for t in entry.tests or []) or dash} |" if tested else ""lines 707–707return f"| {_cell(entry.req_id)} | {name} | {func_names} |{who}{tests}"

Flows

_place_untagged

None clew.guard.impact._place_untagged(ChangedFunction cf, Any reach, dict[str, list[ChangedFunction]] req_funcs, Any extras)

File an untagged change under the requirements its callers reach, else as unmapped.

clew/guard/impact.py:606

Source · 27 lines
def _place_untagged(
    cf: ChangedFunction, reach: Any, req_funcs: dict[str, list[ChangedFunction]], extras: Any
) -> None:
    from .reach import NO_CALLER, NO_INDEX, TEST_CODE

    if reach.is_test(cf.file_path):
        extras.unmapped.append({"name": cf.name, "file": cf.file_path, "reason": TEST_CODE})
        return
    ## ONE FUNCTION, TWO PLACES (2.2, clew#76): a declaration whose definition carries `@req`
    ## (or the reverse) is linked by those requirements directly, as coverage counts it (PG2).
    own = reach.own_reqs(cf)
    if own:
        for req_id in own:
            req_funcs.setdefault(req_id, []).append(
                ChangedFunction(cf.name, cf.file_path, [req_id], cf.old_version, cf.new_version)
            )
        return
    reached = reach.via(cf)
    for req_id, chain in reached:
        req_funcs.setdefault(req_id, []).append(
            ChangedFunction(cf.name, cf.file_path, [], cf.old_version, cf.new_version, chain)
        )
    if not reached:
        reason = NO_INDEX if reach.db is None else NO_CALLER
        extras.unmapped.append({"name": cf.name, "file": cf.file_path, "reason": reason})

Activity · 15 steps
lines 609–609from .reach import NO_CALLER, NO_INDEX, TEST_CODElines 611–611◇ if reach.is_test(cf.file_path)lines 612–612extras.unmapped.append({"name": cf.name, "file": cf.file_path, "reason": TEST_CODE})lines 613–613returnlines 616–616own = reach.own_reqs(cf)lines 617–617◇ if ownlines 618–618◇ for req_id in ownlines 619–621req_funcs.setdefault(req_id, []).append( ChangedFunction(cf.name, cf.file_path, [req_id], cf.old_version, cf.new_version) )lines 622–622returnlines 623–623reached = reach.via(cf)lines 624–624◇ for req_id, chain in reachedlines 625–627req_funcs.setdefault(req_id, []).append( ChangedFunction(cf.name, cf.file_path, [], cf.old_version, cf.new_version, chain) )lines 628–628◇ if not reachedlines 629–629reason = NO_INDEX if reach.db is None else NO_CALLERlines 630–630extras.unmapped.append({"name": cf.name, "file": cf.file_path, "reason": reason})

Flows

_raw_entries

list[tuple[str, dict[str, Any]]] clew.guard.impact._raw_entries(Any data, str id_col)

A catalogue's entries as (id, raw fields), in either catalogue shape.

clew/guard/impact.py:359

Source · 9 lines
def _raw_entries(data: Any, id_col: str) -> list[tuple[str, dict[str, Any]]]:
    if isinstance(data, dict) and isinstance(data.get(REQUIREMENTS_ROOT_KEY), dict):
        node = data[REQUIREMENTS_ROOT_KEY]
        return [(str(k), v) for k, v in node.items() if isinstance(v, dict)]
    if isinstance(data, list):
        return [(str(r[id_col]), r) for r in data if isinstance(r, dict) and r.get(id_col)]
    return []

Activity · 6 steps
lines 360–360◇ if isinstance(data, dict) and isinstance(data.get(REQUIREMENTS_ROOT_KEY), dict)lines 361–361node = data[REQUIREMENTS_ROOT_KEY]lines 362–362return [(str(k), v) for k, v in node.items() if isinstance(v, dict)]lines 363–363◇ if isinstance(data, list)lines 364–364return [(str(r[id_col]), r) for r in data if isinstance(r, dict) and r.get(id_col)]lines 365–365return []

Flows

_reviewers

list[str] | None clew.guard.impact._reviewers(OwnerResolver|None owners, list[ChangedFunction] funcs)

The owners of a requirement's changed files, first-seen order, each once.

clew/guard/impact.py:639

Source · 10 lines
def _reviewers(owners: OwnerResolver | None, funcs: list[ChangedFunction]) -> list[str] | None:
    if owners is None or not owners.has_sources():
        return None
    names: dict[str, None] = {}
    for cf in funcs:
        for owner, *_rest in owners.owners_of(cf.file_path):
            names.setdefault(owner, None)
    return list(names)

Activity · 7 steps
lines 640–640◇ if owners is None or not owners.has_sources()lines 641–641return Nonelines 642–642names: dict[str, None] = {}lines 643–643◇ for cf in funcslines 644–644◇ for owner, *_rest in owners.owners_of(cf.file_path)lines 645–645names.setdefault(owner, None)lines 646–646return list(names)

Flows

_rows_from_list

dict[str, dict[str, str]] clew.guard.impact._rows_from_list(list data, str id_col)

Convert a list of flat row mappings into req_id -> row form.

clew/guard/impact.py:471

Show on the map →

Called by _load_json_full, _load_yaml_full

Calls none

Source · 4 lines
def _rows_from_list(data: list, id_col: str) -> dict[str, dict[str, str]]:
    return {str(row[id_col]): row for row in data if isinstance(row, dict) and row.get(id_col)}

Activity · 1 steps
lines 472–472return {str(row[id_col]): row for row in data if isinstance(row, dict) and row.get(id_col)}

Requirements

REQ-DDB-GUARD-011

_rows_from_mapping

dict[str, dict[str, str]] clew.guard.impact._rows_from_mapping(Any node, str path)

Convert a requirements mapping node into id -> row form.

clew/guard/impact.py:536

Source · 17 lines
def _rows_from_mapping(node: Any, path: str) -> dict[str, dict[str, str]]:
    if not isinstance(node, dict):
        raise RequirementsError(
            f"Requirements catalog {path}: '{REQUIREMENTS_ROOT_KEY}' must be a mapping "
            f"keyed by requirement ID, got {type(node).__name__}"
        )
    rows: dict[str, dict[str, str]] = {}
    for req_id, fields in node.items():
        if not isinstance(fields, dict):
            raise RequirementsError(
                f"Requirements catalog {path}: {req_id} must be a mapping of fields, "
                f"got {type(fields).__name__}"
            )
        rows[str(req_id)] = {k: str(v) for k, v in fields.items()}
    return rows

Activity · 8 steps
lines 537–537◇ if not isinstance(node, dict)lines 538–541raise RequirementsError( f"Requirements catalog {path}: '{REQUIREMENTS_ROOT_KEY}' must be a mapping " f"keyed by requirement ID, got {type(node).__name__}" )lines 542–542rows: dict[str, dict[str, str]] = {}lines 543–543◇ for req_id, fields in node.items()lines 544–544◇ if not isinstance(fields, dict)lines 545–548raise RequirementsError( f"Requirements catalog {path}: {req_id} must be a mapping of fields, " f"got {type(fields).__name__}" )lines 549–549rows[str(req_id)] = {k: str(v) for k, v in fields.items()}lines 550–550return rows

Requirements

REQ-DDB-GUARD-011

_summarise_id

str clew.guard.impact._summarise_id(str req_id)

Render a catalog key for an error message, truncated and single-line.

clew/guard/impact.py:372

Source · 7 lines
def _summarise_id(req_id: str) -> str:
    flat = " ".join(str(req_id).split())
    if len(flat) > _MAX_ID_CHARS:
        flat = flat[:_MAX_ID_CHARS] + "..."
    return repr(flat)

Activity · 4 steps
lines 373–373flat = " ".join(str(req_id).split())lines 374–374◇ if len(flat) > _MAX_ID_CHARSlines 375–375flat = flat[:_MAX_ID_CHARS] + "..."lines 376–376return repr(flat)

Requirements

REQ-DDB-GUARD-016

Flows

_unmapped_markdown

str clew.guard.impact._unmapped_markdown(ImpactExtras|None extras)

The unmapped sections: changes and files that reach no requirement.

clew/guard/impact.py:714

Source · 16 lines
def _unmapped_markdown(extras: ImpactExtras | None) -> str:
    if extras is None:
        return ""
    lines: list[str] = []
    if extras.unmapped:
        lines += ["", "### Changes that reach no requirement", ""]
        lines += [
            f"- `{_cell(u['name'])}` ({_cell(u['file'])}): {_cell(u['reason'])}"
            for u in extras.unmapped
        ]
    if extras.unmapped_files:
        lines += ["", "### Changed files with no changed function", ""]
        lines += [f"- {_cell(f)}" for f in extras.unmapped_files]
    return "\n".join(lines) + ("\n" if lines else "")

Activity · 10 steps
lines 715–715◇ if extras is Nonelines 716–716return ""lines 717–717lines: list[str] = []lines 718–718◇ if extras.unmappedlines 719–719lines += ["", "### Changes that reach no requirement", ""]lines 720–723lines += [ f"- `{_cell(u['name'])}` ({_cell(u['file'])}): {_cell(u['reason'])}" for u in extras.unmapped ]lines 724–724◇ if extras.unmapped_fileslines 725–725lines += ["", "### Changed files with no changed function", ""]lines 726–726lines += [f"- {_cell(f)}" for f in extras.unmapped_files]lines 727–727return "\n".join(lines) + ("\n" if lines else "")

Flows

_validate_requirements

None clew.guard.impact._validate_requirements(dict[str, dict[str, str]] reqs, str path, dict[str, Any] config, str name_col)

Enforce the name field and the configured ID pattern across a catalog.

clew/guard/impact.py:382

Source · 27 lines
def _validate_requirements(
    reqs: dict[str, dict[str, str]],
    path: str,
    config: dict[str, Any],
    name_col: str,
) -> None:
    id_pattern = get_validate(config).get("tags", {}).get("req", {}).get("pattern")
    problems: list[str] = []

    for req_id, row in reqs.items():
        shown = _summarise_id(req_id)
        if id_pattern and not re.fullmatch(id_pattern, req_id):
            problems.append(f"{shown}: does not match validate.tags.req.pattern '{id_pattern}'")
        if not str(row.get(name_col, "")).strip():
            problems.append(f"{shown}: missing required field '{name_col}'")

    if not problems:
        return

    reported = problems[:_MAX_REPORTED_PROBLEMS]
    if len(problems) > len(reported):
        reported.append(f"... and {len(problems) - len(reported)} more problem(s)")
    for p in reported:
        logger.error("Requirements catalog error in %s: %s", path, p)
    raise RequirementsError(f"Invalid requirements catalog {path}", reported)

Activity · 16 steps
lines 388–388id_pattern = get_validate(config).get("tags", {}).get("req", {}).get("pattern")lines 389–389problems: list[str] = []lines 391–391◇ for req_id, row in reqs.items()lines 392–392shown = _summarise_id(req_id)lines 393–393◇ if id_pattern and not re.fullmatch(id_pattern, req_id)lines 394–394problems.append(f"{shown}: does not match validate.tags.req.pattern '{id_pattern}'")lines 395–395◇ if not str(row.get(name_col, "")).strip()lines 396–396problems.append(f"{shown}: missing required field '{name_col}'")lines 398–398◇ if not problemslines 399–399returnlines 401–401reported = problems[:_MAX_REPORTED_PROBLEMS]lines 402–402◇ if len(problems) > len(reported)lines 403–403reported.append(f"... and {len(problems) - len(reported)} more problem(s)")lines 404–404◇ for p in reportedlines 405–405logger.error("Requirements catalog error in %s: %s", path, p)lines 406–406raise RequirementsError(f"Invalid requirements catalog {path}", reported)

Requirements

REQ-DDB-GUARD-011

Flows

build_impact_report

list[ImpactEntry] clew.guard.impact.build_impact_report(list[ChangedFunction] changed_functions, dict[str, Any] config, OwnerResolver|None owners=None)

Group changed functions by requirement for the impact report.

clew/guard/impact.py:558

Source · 8 lines
def build_impact_report(
    changed_functions: list[ChangedFunction],
    config: dict[str, Any],
    owners: OwnerResolver | None = None,
) -> list[ImpactEntry]:
    return build_report(changed_functions, config, owners)[0]

Activity · 1 steps
lines 563–563return build_report(changed_functions, config, owners)[0]

Requirements

REQ-DDB-GUARD-010

build_report

tuple[list[ImpactEntry], ImpactExtras | None] clew.guard.impact.build_report(list[ChangedFunction] changed_functions, dict[str, Any] config, OwnerResolver|None owners=None, Any reach=None, list[str]|None unmapped_files=None)

Group changes by requirement, and with a reach step, add tests, via and unmapped.

clew/guard/impact.py:573

Source · 29 lines
def build_report(
    changed_functions: list[ChangedFunction],
    config: dict[str, Any],
    owners: OwnerResolver | None = None,
    reach: Any = None,
    unmapped_files: list[str] | None = None,
) -> tuple[list[ImpactEntry], ImpactExtras | None]:
    req_names = load_requirements(config)
    extras = ImpactExtras(unmapped_files=list(unmapped_files or [])) if reach else None
    req_funcs: dict[str, list[ChangedFunction]] = {}
    for cf in changed_functions:
        for req in cf.reqs:
            req_funcs.setdefault(req, []).append(cf)
        if not cf.reqs and reach is not None:
            _place_untagged(cf, reach, req_funcs, extras)
    tests = reach.tests_for(set(req_funcs), set(req_names)) if reach else {}
    entries = [
        ImpactEntry(
            req_id=req_id,
            req_name=req_names.get(req_id),
            functions=funcs,
            reviewers=_reviewers(owners, funcs),
            tests=list(tests.get(req_id, [])) if reach else None,
        )
        for req_id, funcs in sorted(req_funcs.items())
    ]
    return entries, extras

Activity · 11 steps
lines 580–580req_names = load_requirements(config)lines 581–581extras = ImpactExtras(unmapped_files=list(unmapped_files or [])) if reach else Nonelines 582–582req_funcs: dict[str, list[ChangedFunction]] = {}lines 583–583◇ for cf in changed_functionslines 584–584◇ for req in cf.reqslines 585–585req_funcs.setdefault(req, []).append(cf)lines 586–586◇ if not cf.reqs and reach is not Nonelines 587–587_place_untagged(cf, reach, req_funcs, extras)lines 588–588tests = reach.tests_for(set(req_funcs), set(req_names)) if reach else {}lines 589–598entries = [ ImpactEntry( req_id=req_id, req_name=req_names.get(req_id), functions=funcs, reviewers=_reviewers(owners, funcs), tests=list(tests.get(req_id, [])) if reach else None, ) for req_id, funcs in sorted(req_funcs.items()) ]lines 599–599return entries, extras

Requirements

REQ-DDB-GUARD-010

Flows

collect_changed_functions

list[ChangedFunction] clew.guard.impact.collect_changed_functions(list[str] file_paths, dict[str, Any] config, str|None diff_range=None, bool staged=False, RunCommand|None run_command=None)

Parse source files and cross-reference with git diff to find changed functions.

clew/guard/impact.py:161

Source · 10 lines
def collect_changed_functions(
    file_paths: list[str],
    config: dict[str, Any],
    diff_range: str | None = None,
    staged: bool = False,
    run_command: RunCommand | None = None,
) -> list[ChangedFunction]:
    return collect_changes(file_paths, config, diff_range, staged, run_command)[0]

Activity · 1 steps
lines 168–168return collect_changes(file_paths, config, diff_range, staged, run_command)[0]

Requirements

REQ-DDB-GUARD-008

collect_changes

tuple[list[ChangedFunction], list[str]] clew.guard.impact.collect_changes(list[str] file_paths, dict[str, Any] config, str|None diff_range=None, bool staged=False, RunCommand|None run_command=None)

The changed functions, and the changed files that hold none of them.

clew/guard/impact.py:179

Source · 27 lines
def collect_changes(
    file_paths: list[str],
    config: dict[str, Any],
    diff_range: str | None = None,
    staged: bool = False,
    run_command: RunCommand | None = None,
) -> tuple[list[ChangedFunction], list[str]]:
    changed_funcs: list[ChangedFunction] = []
    unmapped_files: list[str] = []
    for file_path in file_paths:
        ## A REGULAR FILE OR NOTHING IS OPENED (2.2, clew#75): a submodule bump names the gitlink,
        ## which exists as a DIRECTORY, so `exists()` let it through to be parsed as source and
        ## IsADirectoryError ended the report. Deleted files and gitlinks alike are unmapped.
        if not Path(file_path).is_file():
            logger.warning("Not a regular file (deleted, or a submodule): %s", file_path)
            unmapped_files.append(file_path)
            continue
        changed_lines = _collect_changed_lines(file_path, staged, diff_range, run_command)
        found = (
            _extract_changed_functions(file_path, config, changed_lines) if changed_lines else []
        )
        changed_funcs.extend(found)
        if changed_lines and not found:
            unmapped_files.append(file_path)
    return changed_funcs, unmapped_files

Activity · 13 steps
lines 186–186changed_funcs: list[ChangedFunction] = []lines 187–187unmapped_files: list[str] = []lines 188–188◇ for file_path in file_pathslines 192–192◇ if not Path(file_path).is_file()lines 193–193logger.warning("Not a regular file (deleted, or a submodule): %s", file_path)lines 194–194unmapped_files.append(file_path)lines 195–195continuelines 196–196changed_lines = _collect_changed_lines(file_path, staged, diff_range, run_command)lines 197–199found = ( _extract_changed_functions(file_path, config, changed_lines) if changed_lines else [] )lines 200–200changed_funcs.extend(found)lines 201–201◇ if changed_lines and not foundlines 202–202unmapped_files.append(file_path)lines 203–203return changed_funcs, unmapped_files

Requirements

REQ-DDB-GUARD-010

Flows

filter_requirements_by_version

dict[str, dict[str, str]] clew.guard.impact.filter_requirements_by_version(dict[str, dict[str, str]] reqs, dict[str, Any] config)

Filter requirements to those active at the configured current version.

clew/guard/impact.py:426

Source · 38 lines
def filter_requirements_by_version(
    reqs: dict[str, dict[str, str]],
    config: dict[str, Any],
) -> dict[str, dict[str, str]]:
    from .config import compare_versions, parse_version

    validate = get_validate(config)
    current_str = validate.get("_current_version_resolved") or validate.get("current_version")
    version_field = get_requirements(config).get("version_field")

    if not current_str or not version_field:
        return reqs

    # A missing field used to default to "v0.0.0", so a typo'd version_field — or rows
    # that simply omit it — silently made EVERY requirement active. The gate then
    # appeared to work while enforcing nothing.
    missing = sorted(
        rid for rid, row in reqs.items() if not str(row.get(version_field, "")).strip()
    )
    if missing:
        problems = [_summarise_id(rid) for rid in missing[:_MAX_REPORTED_PROBLEMS]]
        if len(missing) > len(problems):
            problems.append(f"... and {len(missing) - len(problems)} more")
        logger.error("version_field %r missing on %d requirement(s)", version_field, len(missing))
        raise RequirementsError(
            f"requirements.version_field is {version_field!r} but these "
            f"requirements do not declare it",
            problems,
        )

    current = parse_version(current_str)
    return {
        rid: row
        for rid, row in reqs.items()
        if compare_versions(parse_version(row[version_field]), current) <= 0
    }

Activity · 15 steps
lines 430–430from .config import compare_versions, parse_versionlines 432–432validate = get_validate(config)lines 433–433current_str = validate.get("_current_version_resolved") or validate.get("current_version")lines 434–434version_field = get_requirements(config).get("version_field")lines 436–436◇ if not current_str or not version_fieldlines 437–437return reqslines 442–444missing = sorted( rid for rid, row in reqs.items() if not str(row.get(version_field, "")).strip() )lines 445–445◇ if missinglines 446–446problems = [_summarise_id(rid) for rid in missing[:_MAX_REPORTED_PROBLEMS]]lines 447–447◇ if len(missing) > len(problems)lines 448–448problems.append(f"... and {len(missing) - len(problems)} more")lines 449–449logger.error("version_field %r missing on %d requirement(s)", version_field, len(missing))lines 450–454raise RequirementsError( f"requirements.version_field is {version_field!r} but these " f"requirements do not declare it", problems, )lines 456–456current = parse_version(current_str)lines 457–461return { rid: row for rid, row in reqs.items() if compare_versions(parse_version(row[version_field]), current) <= 0 }

Requirements

REQ-DDB-GUARD-009

Flows

format_json

str clew.guard.impact.format_json(list[ImpactEntry] entries, ImpactExtras|None extras=None)

Render impact entries as a versioned JSON object.

clew/guard/impact.py:747

Source · 29 lines
def format_json(entries: list[ImpactEntry], extras: ImpactExtras | None = None) -> str:
    rows = [
        {
            "req_id": entry.req_id,
            "req_name": entry.req_name,
            "functions": [
                {
                    "name": f.name,
                    "file": f.file_path,
                    "version": f.new_version,
                    **({"via": f.via} if f.via is not None else {}),
                }
                for f in entry.functions
            ],
            **({"reviewers": entry.reviewers} if entry.reviewers is not None else {}),
            **(
                {"tests": [{"name": t.name, "file": t.file} for t in entry.tests]}
                if entry.tests is not None
                else {}
            ),
        }
        for entry in entries
    ]
    data: dict[str, Any] = {"schema_version": IMPACT_SCHEMA_VERSION, "entries": rows}
    if extras is not None:
        data.update(unmapped=extras.unmapped, unmapped_files=extras.unmapped_files)
    return json.dumps(data, indent=2) + "\n"

Activity · 5 steps
lines 748–769rows = [ { "req_id": entry.req_id, "req_name": entry.req_name, "functions": [ { "name": f.name, "file": f.file_path, "version": f.new_version, **({"via": f.via} if f.via is not None else {}), } for f in entry.functions ], **({"reviewers": entry.reviewers} if entry.reviewers is not None else {}), **( {"tests": [{"name": t.name, "file": t.file} for t in entry.tests]} if entry.tests is not None else {} ), } for entry in entries ]lines 770–770data: dict[str, Any] = {"schema_version": IMPACT_SCHEMA_VERSION, "entries": rows}lines 771–771◇ if extras is not Nonelines 772–772data.update(unmapped=extras.unmapped, unmapped_files=extras.unmapped_files)lines 773–773return json.dumps(data, indent=2) + "\n"

Requirements

REQ-DDB-GUARD-010

Flows

format_markdown

str clew.guard.impact.format_markdown(list[ImpactEntry] entries, ImpactExtras|None extras=None)

Render impact entries as a markdown table with summary.

clew/guard/impact.py:671

Source · 23 lines
def format_markdown(entries: list[ImpactEntry], extras: ImpactExtras | None = None) -> str:
    if not entries:
        return ("No requirements affected.\n" + _unmapped_markdown(extras)).rstrip("\n") + "\n"

    ## A Reviewers column only when the repository names owners: see `_reviewers`. A Tests column
    ## only when the report read them.
    owned = any(e.reviewers is not None for e in entries)
    tested = any(e.tests is not None for e in entries)
    head = "| REQ | Name | Functions Changed |" + (" Reviewers |" if owned else "")
    rule = "|-----|------|-------------------|" + ("-----------|" if owned else "")
    lines = ["## Change Impact Report", "", head + (" Tests |" if tested else "")]
    lines.append(rule + ("-------|" if tested else ""))
    total_funcs = 0
    for entry in entries:
        total_funcs += len(entry.functions)
        lines.append(_markdown_row(entry, owned, tested))
    lines.append("")
    lines.append(
        f"**Total: {len(entries)} requirement(s) affected, {total_funcs} function(s) changed**"
    )
    return "\n".join(lines) + "\n" + _unmapped_markdown(extras)

Activity · 15 steps
lines 672–672◇ if not entrieslines 673–673return ("No requirements affected.\n" + _unmapped_markdown(extras)).rstrip("\n") + "\n"lines 677–677owned = any(e.reviewers is not None for e in entries)lines 678–678tested = any(e.tests is not None for e in entries)lines 679–679head = "| REQ | Name | Functions Changed |" + (" Reviewers |" if owned else "")lines 680–680rule = "|-----|------|-------------------|" + ("-----------|" if owned else "")lines 681–681lines = ["## Change Impact Report", "", head + (" Tests |" if tested else "")]lines 682–682lines.append(rule + ("-------|" if tested else ""))lines 683–683total_funcs = 0lines 684–684◇ for entry in entrieslines 685–685total_funcs += len(entry.functions)lines 686–686lines.append(_markdown_row(entry, owned, tested))lines 687–687lines.append("")lines 688–690lines.append( f"**Total: {len(entries)} requirement(s) affected, {total_funcs} function(s) changed**" )lines 691–691return "\n".join(lines) + "\n" + _unmapped_markdown(extras)

Requirements

REQ-DDB-GUARD-010

Flows

format_report

str clew.guard.impact.format_report(list[ImpactEntry] entries, str fmt="markdown", ImpactExtras|None extras=None)

Dispatch to the appropriate formatter based on config.

clew/guard/impact.py:792

Source · 8 lines
def format_report(
    entries: list[ImpactEntry], fmt: str = "markdown", extras: ImpactExtras | None = None
) -> str:
    if fmt == "text":
        return format_text(entries)
    return (format_json if fmt == "json" else format_markdown)(entries, extras)

Activity · 3 steps
lines 795–795◇ if fmt == "text"lines 796–796return format_text(entries)lines 797–797return (format_json if fmt == "json" else format_markdown)(entries, extras)

Flows

format_text

str clew.guard.impact.format_text(list[ImpactEntry] entries)

Render impact entries as human-readable text.

clew/guard/impact.py:780

Source · 7 lines
def format_text(entries: list[ImpactEntry]) -> str:
    if not entries:
        return "No requirements affected.\n"
    req_ids = [e.req_id for e in entries]
    return f"REQs affected: {', '.join(req_ids)}\n"

Activity · 4 steps
lines 781–781◇ if not entrieslines 782–782return "No requirements affected.\n"lines 783–783req_ids = [e.req_id for e in entries]lines 784–784return f"REQs affected: {', '.join(req_ids)}\n"

Requirements

REQ-DDB-GUARD-010

impact_entries

list[ImpactEntry] clew.guard.impact.impact_entries(list[str] file_paths, dict[str, Any] config, bool staged=False, str|None diff_range=None, RunCommand|None run_command=None)

Collect the changed functions and map them to the requirements they implement.

clew/guard/impact.py:826

Source · 10 lines
def impact_entries(
    file_paths: list[str],
    config: dict[str, Any],
    staged: bool = False,
    diff_range: str | None = None,
    run_command: RunCommand | None = None,
) -> list[ImpactEntry]:
    return impact_report(file_paths, config, staged, diff_range, run_command)[0]

Activity · 1 steps
lines 833–833return impact_report(file_paths, config, staged, diff_range, run_command)[0]

Requirements

REQ-DDB-GUARD-010

impact_report

tuple[list[ImpactEntry], ImpactExtras | None] clew.guard.impact.impact_report(list[str] file_paths, dict[str, Any] config, bool staged=False, str|None diff_range=None, RunCommand|None run_command=None)

The full report: entries with covering tests and via , and the unmapped lists.

clew/guard/impact.py:842

Source · 19 lines
def impact_report(
    file_paths: list[str],
    config: dict[str, Any],
    staged: bool = False,
    diff_range: str | None = None,
    run_command: RunCommand | None = None,
) -> tuple[list[ImpactEntry], ImpactExtras | None]:
    from ..indexlocate import find_index
    from .reach import Reach

    if not file_paths and (staged or diff_range):
        from .git import get_changed_files

        file_paths = get_changed_files(diff_range, staged, run_command) or []
    changed, unmapped_files = collect_changes(file_paths, config, diff_range, staged, run_command)
    root = Path.cwd()
    owners = OwnerResolver.from_repo(root, config.get("owners"))
    reach = Reach(find_index(root), repo_root=root, config=config)
    return build_report(changed, config, owners, reach, unmapped_files)

1 more lines, not shown

Activity · 10 steps
lines 849–849from ..indexlocate import find_indexlines 850–850from .reach import Reachlines 852–852◇ if not file_paths and (staged or diff_range)lines 853–853from .git import get_changed_fileslines 855–855file_paths = get_changed_files(diff_range, staged, run_command) or []lines 856–856changed, unmapped_files = collect_changes(file_paths, config, diff_range, staged, run_command)lines 857–857root = Path.cwd()lines 858–858owners = OwnerResolver.from_repo(root, config.get("owners"))lines 859–859reach = Reach(find_index(root), repo_root=root, config=config)lines 860–860return build_report(changed, config, owners, reach, unmapped_files)

Requirements

REQ-DDB-GUARD-010

Flows

load_external_requirements

dict[str, dict[str, str]] clew.guard.impact.load_external_requirements(dict[str, Any] config, list[str]|None unchecked=None)

The requirement ids of the external catalogues this repository names (GH #68).

clew/guard/impact.py:252

Source · 34 lines
def load_external_requirements(
    config: dict[str, Any], unchecked: list[str] | None = None
) -> dict[str, dict[str, str]]:
    """The consumer's catalogue, read where it is pinned: each entry is a path or {repo, rev,
    path} relative to the repository, through the reader the wiki uses. An unreadable one or a
    URL is an error naming it, never an empty catalogue that would pass every tag.

    A PARENT (`parent: true`, #73 item 3, owner Q/A 2026-11-24) is the one exception: a module's
    gate runs where the product's clone may not be, so an unreadable parent is recorded in
    `unchecked` (by name) and its links are reported unchecked, never refused. The product's own
    gate, where the clone is, still checks them."""
    from ..requirements import read_catalog_at

    req_config = get_requirements(config)
    out: dict[str, dict[str, str]] = {}
    for source in req_config.get("external") or []:
        try:
            out.update(read_catalog_at(Path.cwd(), source))
        except ValueError as exc:
            if isinstance(source, dict) and source.get("parent") is True and unchecked is not None:
                name = str(source.get("name") or Path(str(source.get("repo", "parent"))).name)
                logger.warning(
                    "parent catalogue %s is not readable here (%s); its links are unchecked",
                    name,
                    exc,
                )
                unchecked.append(name)
                continue
            raise RequirementsError(f"impact.requirements.external: {exc}") from exc
    if out:
        logger.info("Loaded %d requirement(s) from external catalogues", len(out))
    return out

Activity · 16 steps
lines 263–263from ..requirements import read_catalog_atlines 265–265req_config = get_requirements(config)lines 266–266out: dict[str, dict[str, str]] = {}lines 267–267◇ for source in req_config.get("external") or []lines 268–268trylines 269–269out.update(read_catalog_at(Path.cwd(), source))lines 270–270except ValueError as exclines 271–271◇ if isinstance(source, dict) and source.get("parent") is True and unchecked is not Nonelines 272–272name = str(source.get("name") or Path(str(source.get("repo", "parent"))).name)lines 273–277logger.warning( "parent catalogue %s is not readable here (%s); its links are unchecked", name, exc, )lines 278–278unchecked.append(name)lines 279–279continuelines 280–280raise RequirementsError(f"impact.requirements.external: {exc}") from exclines 281–281◇ if outlines 282–282logger.info("Loaded %d requirement(s) from external catalogues", len(out))lines 283–283return out

Requirements

REQ-DDB-GUARD-027

Flows

load_failure_mode_ids

set[str] clew.guard.impact.load_failure_mode_ids(dict[str, Any] config)

Every failure-mode id the local catalogue declares.

clew/guard/impact.py:337

Source · 18 lines
def load_failure_mode_ids(config: dict[str, Any]) -> set[str]:
    from ..failuremodes import modes_of

    req_info = _get_requirements_config(config)
    if req_info is None or req_info[1] == "csv":
        return set()
    path, fmt, id_col, _name = req_info
    try:
        with open(path) as f:
            data = json.load(f) if fmt == "json" else yaml.safe_load(f)
        entries = _raw_entries(data, id_col)
        return {m.mode_id for rid, fields in entries for m in modes_of(rid, fields)}
    except ValueError as e:
        raise RequirementsError(f"Requirements catalog {path}: {e}") from e
    except (OSError, yaml.YAMLError) as e:
        raise RequirementsError(f"Could not read requirements catalog {path}: {e}") from e

Activity · 14 steps
lines 338–338from ..failuremodes import modes_oflines 340–340req_info = _get_requirements_config(config)lines 341–341◇ if req_info is None or req_info[1] == "csv"lines 342–342return set()lines 343–343path, fmt, id_col, _name = req_infolines 344–344trylines 345–345with open(path) as flines 346–346data = json.load(f) if fmt == "json" else yaml.safe_load(f)lines 347–347entries = _raw_entries(data, id_col)lines 348–348return {m.mode_id for rid, fields in entries for m in modes_of(rid, fields)}lines 349–349except ValueError as elines 350–350raise RequirementsError(f"Requirements catalog {path}: {e}") from elines 351–351except (OSError, yaml.YAMLError) as elines 352–352raise RequirementsError(f"Could not read requirements catalog {path}: {e}") from e

Requirements

REQ-DDB-GUARD-001

Flows

load_requirements

dict[str, str] clew.guard.impact.load_requirements(dict[str, Any] config)

Load requirement id -> name mapping (convenience wrapper).

clew/guard/impact.py:413

Source · 9 lines
def load_requirements(config: dict[str, Any]) -> dict[str, str]:
    req_info = _get_requirements_config(config)
    if req_info is None:
        return {}
    name_col = req_info[3]
    full = load_requirements_full(config)
    return {rid: row.get(name_col, "") for rid, row in full.items()}

Activity · 6 steps
lines 414–414req_info = _get_requirements_config(config)lines 415–415◇ if req_info is Nonelines 416–416return {}lines 417–417name_col = req_info[3]lines 418–418full = load_requirements_full(config)lines 419–419return {rid: row.get(name_col, "") for rid, row in full.items()}

Requirements

REQ-DDB-GUARD-009

Flows

load_requirements_full

dict[str, dict[str, str]] clew.guard.impact.load_requirements_full(dict[str, Any] config)

Load full requirement rows from the configured catalog.

clew/guard/impact.py:290

Source · 36 lines
def load_requirements_full(config: dict[str, Any]) -> dict[str, dict[str, str]]:
    req_info = _get_requirements_config(config)
    if req_info is None:
        return {}

    path, fmt, id_col, name_col = req_info
    loaders = {
        "csv": _load_csv_full,
        "json": _load_json_full,
        "yaml": _load_yaml_full,
    }
    loader = loaders.get(fmt)
    if not loader:
        raise RequirementsError(
            f"Unknown requirements format '{fmt}' for {path}; "
            f"expected one of {', '.join(sorted(loaders))}"
        )
    try:
        reqs = loader(path, id_col)
    except RequirementsError:
        raise
    except (OSError, UnicodeDecodeError, ValueError, AttributeError, KeyError) as e:
        # One wrapper for all three loaders: previously only the YAML path wrapped its
        # failures, so a malformed CSV or JSON catalog escaped the GuardError boundary
        # as a raw traceback for the same class of user error.
        raise RequirementsError(f"Could not parse requirements catalog {path}: {e}") from e
    if not reqs:
        raise RequirementsError(f"Requirements catalog {path} declared no requirements")
    _validate_requirements(reqs, path, config, name_col)
    logger.info("Loaded %d requirement(s) from %s", len(reqs), path)
    return reqs


# A malformed catalog should tell you what is wrong without echoing the file back.
# Reported problems are capped and each key is truncated, so the error channel cannot
# be used to read a file the caller pointed the catalog setting at.
Activity · 19 steps
lines 291–291req_info = _get_requirements_config(config)lines 292–292◇ if req_info is Nonelines 293–293return {}lines 295–295path, fmt, id_col, name_col = req_infolines 296–300loaders = { "csv": _load_csv_full, "json": _load_json_full, "yaml": _load_yaml_full, }lines 301–301loader = loaders.get(fmt)lines 302–302◇ if not loaderlines 303–306raise RequirementsError( f"Unknown requirements format '{fmt}' for {path}; " f"expected one of {', '.join(sorted(loaders))}" )lines 307–307trylines 308–308reqs = loader(path, id_col)lines 309–309except RequirementsErrorlines 310–310raiselines 311–311except (OSError, UnicodeDecodeError, ValueError, AttributeError, KeyError) as elines 315–315raise RequirementsError(f"Could not parse requirements catalog {path}: {e}") from elines 316–316◇ if not reqslines 317–317raise RequirementsError(f"Requirements catalog {path} declared no requirements")lines 318–318_validate_requirements(reqs, path, config, name_col)lines 319–319logger.info("Loaded %d requirement(s) from %s", len(reqs), path)lines 320–320return reqs

Requirements

REQ-DDB-GUARD-011

Flows

run_impact

str clew.guard.impact.run_impact(list[str] file_paths, dict[str, Any] config, bool staged=False, str|None diff_range=None, RunCommand|None run_command=None, str fmt="markdown")

Orchestrate diff analysis, requirement mapping, and report generation.

clew/guard/impact.py:808

Source · 12 lines
def run_impact(
    file_paths: list[str],
    config: dict[str, Any],
    staged: bool = False,
    diff_range: str | None = None,
    run_command: RunCommand | None = None,
    fmt: str = "markdown",
) -> str:
    entries, extras = impact_report(file_paths, config, staged, diff_range, run_command)
    return format_report(entries, fmt, extras)

Activity · 2 steps
lines 816–816entries, extras = impact_report(file_paths, config, staged, diff_range, run_command)lines 817–817return format_report(entries, fmt, extras)

Requirements

REQ-DDB-GUARD-010