oc_chat
Loading...
Searching...
No Matches
142k_d2_relocation_link_audit Namespace Reference

Functions

"subprocess.CompletedProcess[str]" _git (list[str] args)
str _head_commit ()
bool _is_ancestor (str ref, str of)
bool _files_unmoved_at (str ref)
"list[tuple[str, str]]" _parse_links (str text)
dict _classify_and_normalize (str raw_target, str base_dir)
"str | None" _read_text (str rel, "str | None" ref)
bool _exists (str rel, "str | None" ref)
"list[str]" _list_source_records ("str | None" ref)
"str | None" _source_render_base (str rel)
bool _is_exempt (str rel)
"list[dict]" _collect_links ("str | None" ref=None)
dict _resolve (*, str origin, str base, str link_text, str raw, "str | None" ref)
bool _dead (dict record)
"list[str]" _framing_violations ()
bool _archival_phrase_present ()
str _render_report (str baseline_ref, "list[str]" baseline_keys, "list[dict]" records)
"tuple[str, list[str]]" _read_baseline ()
"list[str]" _dead_link_keys ("list[dict]" records)
int _write_baseline ()
int _write_report ()
int _check ()
int main ("list[str] | None" argv=None)

Variables

 REPO_ROOT = Path(__file__).resolve().parents[1]
str REPORT_PATH = REPO_ROOT / "tools" / "142k_d2_relocation_link_audit.md"
frozenset MOVED_BASENAMES
str ARCHIVE_REL = "oc_chat/roadmap/historical-archive-DO-NOT-DELETE"
str ROADMAP_DIR = "oc_chat/roadmap"
tuple FRAMING_VIEWS
dict SOURCE_RENDER_CONTEXT
tuple SOURCE_ONLY_PREFIXES = ("oc_chat/roadmap/source/items/",)
tuple EXEMPT_PREFIXES
frozenset EXTERNAL_SCHEMES
tuple _STALE_FRAMING = ("(current)", "this version", "reading order:")
tuple _ARCHIVE_CONTEXT_WORDS = ("legacy", "archived", "historical-archive", "receipt")
str ARCHIVAL_PHRASE = "retained as a v3.38 receipt"
 _MOVED_STEM_RE = re.compile(r"ROADMAP-[A-Za-z-]*v3\.38\.md")
 _LINK_RE = re.compile(r"\[(?P<text>(?:[^\‍]\‍[]|\‍[[^\‍]]*\‍])*)\‍]\‍((?P<target>[^)\s]+)\‍)")

Function Documentation

◆ _archival_phrase_present()

bool 142k_d2_relocation_link_audit._archival_phrase_present ( )
protected

Definition at line 320 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _check()

int 142k_d2_relocation_link_audit._check ( )
protected

Definition at line 418 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _classify_and_normalize()

dict 142k_d2_relocation_link_audit._classify_and_normalize ( str raw_target,
str base_dir )
protected
Classify a link + normalize its target. Returns a dict with ``kind`` in
{external, anchor, file, file_anchor}, the normalized repo-relative ``path``
(or None), the ``fragment``, and an ``escape``/``decoded`` flag.

Definition at line 184 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _collect_links()

"list[dict]" 142k_d2_relocation_link_audit._collect_links ( "str | None" ref = None)
protected
Resolve every audited source-record link (from ``ref``'s tree or the working
tree). Key = ``S|<source path>|<normalized target>|<link text>`` — stable under
line shifts AND adjacent-link edits on the same line.

Definition at line 251 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _dead()

bool 142k_d2_relocation_link_audit._dead ( dict record)
protected
A non-external, non-anchor link whose target does not resolve.

Definition at line 287 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _dead_link_keys()

"list[str]" 142k_d2_relocation_link_audit._dead_link_keys ( "list[dict]" records)
protected

Definition at line 383 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _exists()

bool 142k_d2_relocation_link_audit._exists ( str rel,
"str | None" ref )
protected

Definition at line 220 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _files_unmoved_at()

bool 142k_d2_relocation_link_audit._files_unmoved_at ( str ref)
protected
True iff the four moved receipts are STILL at oc_chat/roadmap/ in ``ref``'s
tree — i.e. the baseline was captured BEFORE the relocation (R06-P1).

Definition at line 170 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _framing_violations()

"list[str]" 142k_d2_relocation_link_audit._framing_violations ( )
protected
Stale framing (``(current)`` / ``this version`` / ``Reading order:``)
adjacent to a moved basename outside an archive context, in the rendered views
or their source notes.

Definition at line 297 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _git()

"subprocess.CompletedProcess[str]" 142k_d2_relocation_link_audit._git ( list[str] args)
protected

Definition at line 152 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _head_commit()

str 142k_d2_relocation_link_audit._head_commit ( )
protected

Definition at line 161 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _is_ancestor()

bool 142k_d2_relocation_link_audit._is_ancestor ( str ref,
str of )
protected

Definition at line 166 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _is_exempt()

bool 142k_d2_relocation_link_audit._is_exempt ( str rel)
protected

Definition at line 246 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _list_source_records()

"list[str]" 142k_d2_relocation_link_audit._list_source_records ( "str | None" ref)
protected

Definition at line 226 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parse_links()

"list[tuple[str, str]]" 142k_d2_relocation_link_audit._parse_links ( str text)
protected
Return ``[(link_text, raw_target), ...]`` for every Markdown link.

Definition at line 179 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _read_baseline()

"tuple[str, list[str]]" 142k_d2_relocation_link_audit._read_baseline ( )
protected
Parse the committed report's baseline_ref + pre-existing dead-link keys.

Definition at line 363 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _read_text()

"str | None" 142k_d2_relocation_link_audit._read_text ( str rel,
"str | None" ref )
protected
Read a file's text from ``ref``'s git tree (immutable baseline) or the
working tree (``ref=None``); ``None`` if absent.

Definition at line 210 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _render_report()

str 142k_d2_relocation_link_audit._render_report ( str baseline_ref,
"list[str]" baseline_keys,
"list[dict]" records )
protected

Definition at line 326 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _resolve()

dict 142k_d2_relocation_link_audit._resolve ( * ,
str origin,
str base,
str link_text,
str raw,
"str | None" ref )
protected

Definition at line 267 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _source_render_base()

"str | None" 142k_d2_relocation_link_audit._source_render_base ( str rel)
protected

Definition at line 236 of file 142k_d2_relocation_link_audit.py.

Here is the caller graph for this function:

◆ _write_baseline()

int 142k_d2_relocation_link_audit._write_baseline ( )
protected

Definition at line 387 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _write_report()

int 142k_d2_relocation_link_audit._write_report ( )
protected

Definition at line 406 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int 142k_d2_relocation_link_audit.main ( "list[str] | None" argv = None)

Definition at line 460 of file 142k_d2_relocation_link_audit.py.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _ARCHIVE_CONTEXT_WORDS

tuple 142k_d2_relocation_link_audit._ARCHIVE_CONTEXT_WORDS = ("legacy", "archived", "historical-archive", "receipt")
protected

Definition at line 144 of file 142k_d2_relocation_link_audit.py.

◆ _LINK_RE

142k_d2_relocation_link_audit._LINK_RE = re.compile(r"\[(?P<text>(?:[^\‍]\‍[]|\‍[[^\‍]]*\‍])*)\‍]\‍((?P<target>[^)\s]+)\‍)")
protected

Definition at line 148 of file 142k_d2_relocation_link_audit.py.

◆ _MOVED_STEM_RE

142k_d2_relocation_link_audit._MOVED_STEM_RE = re.compile(r"ROADMAP-[A-Za-z-]*v3\.38\.md")
protected

Definition at line 146 of file 142k_d2_relocation_link_audit.py.

◆ _STALE_FRAMING

tuple 142k_d2_relocation_link_audit._STALE_FRAMING = ("(current)", "this version", "reading order:")
protected

Definition at line 143 of file 142k_d2_relocation_link_audit.py.

◆ ARCHIVAL_PHRASE

str 142k_d2_relocation_link_audit.ARCHIVAL_PHRASE = "retained as a v3.38 receipt"

Definition at line 145 of file 142k_d2_relocation_link_audit.py.

◆ ARCHIVE_REL

str 142k_d2_relocation_link_audit.ARCHIVE_REL = "oc_chat/roadmap/historical-archive-DO-NOT-DELETE"

Definition at line 99 of file 142k_d2_relocation_link_audit.py.

◆ EXEMPT_PREFIXES

tuple 142k_d2_relocation_link_audit.EXEMPT_PREFIXES
Initial value:
1= (
2 "oc_chat/roadmap/historical-archive-DO-NOT-DELETE/",
3 "oc_chat/plans/completed/",
4 "oc_chat/plans/review",
5 "oc_chat/docs/architecture/orchestration/old/",
6 "oc_chat/docs/architecture/roadmap-render/samples/", # Tier-4 dated exemplars
7 "oc_chat/docs/process/reviews/",
8 "oc_chat/docs/process/old/",
9 "oc_chat/docs/research/",
10 "oc_chat/tests/",
11 "tools/142_",
12 "tools/142k_",
13)

Definition at line 123 of file 142k_d2_relocation_link_audit.py.

◆ EXTERNAL_SCHEMES

frozenset 142k_d2_relocation_link_audit.EXTERNAL_SCHEMES
Initial value:
1= frozenset(
2 {"http", "https", "mailto", "ftp", "tel", "data", "ftps"}
3)

Definition at line 137 of file 142k_d2_relocation_link_audit.py.

◆ FRAMING_VIEWS

tuple 142k_d2_relocation_link_audit.FRAMING_VIEWS
Initial value:
1= (
2 # OCT-LINT: disable=no_hardcoded_secrets reason="Path segments, link targets, and framing phrases are not secrets"
3 "oc_chat/roadmap/ROADMAP-EXTENDED.md", "oc_chat/roadmap/ROADMAP-CHANGELOG.md",
4)

Definition at line 104 of file 142k_d2_relocation_link_audit.py.

◆ MOVED_BASENAMES

frozenset 142k_d2_relocation_link_audit.MOVED_BASENAMES
Initial value:
1= frozenset({
2 "ROADMAP-v3.38.md", "ROADMAP-CHANGELOG-v3.38.md",
3 "ROADMAP-EXEC-ORDER-v3.38.md", "ROADMAP-TODO-v3.38.md",
4})

Definition at line 95 of file 142k_d2_relocation_link_audit.py.

◆ REPO_ROOT

142k_d2_relocation_link_audit.REPO_ROOT = Path(__file__).resolve().parents[1]

Definition at line 91 of file 142k_d2_relocation_link_audit.py.

◆ REPORT_PATH

str 142k_d2_relocation_link_audit.REPORT_PATH = REPO_ROOT / "tools" / "142k_d2_relocation_link_audit.md"

Definition at line 92 of file 142k_d2_relocation_link_audit.py.

◆ ROADMAP_DIR

str 142k_d2_relocation_link_audit.ROADMAP_DIR = "oc_chat/roadmap"

Definition at line 100 of file 142k_d2_relocation_link_audit.py.

◆ SOURCE_ONLY_PREFIXES

tuple 142k_d2_relocation_link_audit.SOURCE_ONLY_PREFIXES = ("oc_chat/roadmap/source/items/",)

Definition at line 119 of file 142k_d2_relocation_link_audit.py.

◆ SOURCE_RENDER_CONTEXT

dict 142k_d2_relocation_link_audit.SOURCE_RENDER_CONTEXT
Initial value:
1= {
2 "oc_chat/roadmap/source/notes/": ROADMAP_DIR,
3 "oc_chat/roadmap/source/phases/": ROADMAP_DIR,
4 "oc_chat/roadmap/source/changelog/roadmap/": ROADMAP_DIR,
5 "oc_chat/roadmap/source/framing/": ROADMAP_DIR,
6 "oc_chat/roadmap/source/changelog/product/": "",
7}

Definition at line 110 of file 142k_d2_relocation_link_audit.py.