contract-driven-delivery 2.1.3 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,6 +45,8 @@ def find_endpoint_table(lines: list[str]) -> list[tuple[int, str]]:
45
45
  Find all data rows across ALL '| method |' tables in the document.
46
46
  Blank lines and prose between rows do not end collection, making this
47
47
  robust to files where content is appended after the original table block.
48
+ A new markdown heading does end the active table so ADR 0002 schema field
49
+ tables under `## Schemas` are not misread as endpoint rows.
48
50
  """
49
51
  in_table = False
50
52
  sep_seen = False
@@ -53,6 +55,11 @@ def find_endpoint_table(lines: list[str]) -> list[tuple[int, str]]:
53
55
  for i, line in enumerate(lines):
54
56
  stripped = line.strip()
55
57
 
58
+ if re.match(r'^#{2,}\s+', stripped):
59
+ in_table = False
60
+ sep_seen = False
61
+ continue
62
+
56
63
  if not stripped:
57
64
  continue # blank lines never end table mode
58
65
 
@@ -66,7 +73,7 @@ def find_endpoint_table(lines: list[str]) -> list[tuple[int, str]]:
66
73
  continue
67
74
 
68
75
  # A header row for an endpoint table
69
- if cells[0].lower() == 'method':
76
+ if cells[0].lower() == 'method' and len(cells) > 1 and cells[1].lower() == 'path':
70
77
  in_table = True
71
78
  sep_seen = False
72
79
  continue # skip header row
@@ -132,6 +132,8 @@ def git_available(root: Path) -> bool:
132
132
  ['git', 'rev-parse', '--git-dir'],
133
133
  capture_output=True,
134
134
  text=True,
135
+ encoding='utf-8',
136
+ errors='replace',
135
137
  cwd=str(root),
136
138
  )
137
139
  return r.returncode == 0
@@ -150,6 +152,8 @@ def git_show_head(root: Path, rel_path: str) -> str | None:
150
152
  ['git', 'show', f'HEAD:{rel_path}'],
151
153
  capture_output=True,
152
154
  text=True,
155
+ encoding='utf-8',
156
+ errors='replace',
153
157
  cwd=str(root),
154
158
  )
155
159
  if r.returncode == 0: