Skip to content

Promote develop to main - #1013

Merged
ptr727 merged 2 commits into
mainfrom
develop
Aug 25, 2026
Merged

Promote develop to main#1013
ptr727 merged 2 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Promotes develop to main.

Includes:

🤖 Generated with Claude Code

ptr727 added 2 commits August 25, 2026 15:54
Fixes the three findings issue #1010 grouped as "lower priority than
data integrity, but confirmed real and cheap to fix":

1. **Nested-bracket link-label regex gap** (PR #913):
`spec/validate.py`'s and `spec/audit.py`'s `[^\]]*`-based link regexes
stopped at the first `]`, so `[API [docs]](url)` passed both the
registry description gate and `strip_md_links()` undetected. Replaced
with a balanced bracket/paren scanner in both files.
2. **README PATH-persistence self-contradiction** (PR #964): the
pre-commit snippet's README claimed `uv tool install` gives an
unconditionally PATH-available command, contradicting the next
sentence's own conditional-PATH guidance. Applied CodeRabbit's proposed
wording.
3. **Quota-widening-only-when-empty gap** (PR #986): `copilot_history()`
only widened past `HISTORY_PRS` when the narrow window came back fully
empty, so a narrow window carrying only a Copilot comment (no formal
review) returned early with no usable bot id, leaving a review just
outside the window permanently unread. Widening is now keyed on whether
a usable bot id was found, not on emptiness.

Each fix carries a regression test. Full suite (849 tests), ruff
format/check, mypy, prose_lint, and repo_gate (eol/eol-coverage) all
pass.

Closes #1010.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Clarified installation guidance for persistent tools and independently
running hooks.

* **Bug Fixes**
* Improved review history detection when recent activity contains
comments but no usable review information.
* Enhanced Markdown link validation for nested and escaped brackets and
parentheses, while safely ignoring unbalanced links.
* Improved validation performance for descriptions containing many
unmatched brackets.

* **Tests**
* Added coverage for widened review-history searches and complex
Markdown link formats.
  * Added regression coverage for large, malformed link patterns.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What

A `command -v shellcheck` (or markdownlint, cspell, actionlint,
editorconfig-checker, shfmt,
PSScriptAnalyzer) miss reads as "not installed" unless the checker
already knows these tools
are deliberately never installed natively on a fleet host, per
GOVERNANCE.md "Running the
Linters Locally." Nothing sat at the point that check fails to say so,
and CODESTYLE.md's own
Bash paragraph pointed only at the `shell-codestyle` Skill rather than
at a runnable invocation.

## Fix

- **GOVERNANCE.md** "Running the Linters Locally": states the general
principle inline, that
none of these tools is installed natively by decision, so their absence
from `command -v` is
  expected rather than evidence the check is unavailable.
- **CODESTYLE.md**: the Bash paragraph now points at that section
directly instead of only at
the Skill, so a reader who consults the carried instruction file gets a
runnable path without
  chasing a link.
- **AGENTS.md**: added a routing-table row ("Running a lint or format
check locally, or a lint
tool missing from `command -v`") so the deterministic,
every-session-read entry point covers
this too, rather than depending solely on the right Skill firing at the
right moment.

Docs-only change; `prose_lint.py`, `repo_gate.py`, and the Docker
markdownlint/cspell lint all
pass clean.

Fixes #763.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
  * Clarified shell linting and formatting guidance.
* Documented the supported clean-compile workflow for environments where
required tools are not installed locally.
* Clarified that missing tools from `PATH` does not indicate that checks
are unavailable.
* Added guidance for locating and running local lint and formatting
checks consistently.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 1 minute.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4e336c22-978c-4637-9ef8-62b98fcdceaa

📥 Commits

Reviewing files that changed from the base of the PR and between 702bb7e and 86783b9.

📒 Files selected for processing (9)
  • AGENTS.md
  • CODESTYLE.md
  • GOVERNANCE.md
  • catalog/snippets/pre-commit/README.md
  • scripts/pr_review.py
  • scripts/tests/test_pr_review.py
  • scripts/tests/test_spec_validate.py
  • spec/audit.py
  • spec/validate.py

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Harden Markdown link parsing and Copilot history lookup

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Detect and strip nested Markdown links with balanced, linear-time parsing.
• Widen Copilot history when recent activity lacks a usable bot identity.
• Route missing native linters to Docker commands and clarify pre-commit setup.
Diagram

graph TD
  D["Registry Description"] --> S["Balanced Link Scanner"] --> V["Validation and Audit"]
  P["Copilot Lookup"] --> N["Narrow History"] --> I{"Usable Bot ID"}
  I -- "Missing" --> W["Wide History"] --> R["History Result"]
  I -- "Found" --> R
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Centralize the balanced-link scanner
  • ➕ Eliminates drift between validation and audit behavior
  • ➕ Allows one regression suite to define shared parsing semantics
  • ➖ Requires choosing a shared module boundary for validation and transformation results
  • ➖ Slightly broadens the refactor beyond the targeted fixes
2. Use a Markdown parser library
  • ➕ Delegates broader Markdown grammar handling to a maintained parser
  • ➕ Could support future syntax requirements without more custom scanning
  • ➖ Adds a dependency to currently standard-library-only tooling
  • ➖ May recognize more Markdown constructs than the narrow description contract intends

Recommendation: Keep the focused linear-time scanner rather than adding a Markdown dependency, but consider extracting one shared span iterator for both spec/validate.py and spec/audit.py. The audit module already imports the validator, so centralizing the delimiter logic would preserve the PR's zero-dependency approach while reducing future semantic drift.

Files changed (9) +259 / -27

Bug fix (3) +188 / -22
pr_review.pyWiden Copilot history when no bot identity is found +22/-11

Widen Copilot history when no bot identity is found

• Changes the narrow-history success condition from non-empty activity to discovery of a usable Copilot bot ID. Comment-only recent windows now trigger the wider lookup needed to find an older formal review.

scripts/pr_review.py

audit.pyStrip balanced nested Markdown links safely +104/-6

Strip balanced nested Markdown links safely

• Replaces regex-based link stripping with a linear stack-based scanner supporting balanced nested brackets and parentheses, escaped delimiters, inline links, and reference links. Extends self-tests for parsing edge cases and pathological unmatched input performance.

spec/audit.py

validate.pyDetect balanced nested Markdown links in descriptions +62/-5

Detect balanced nested Markdown links in descriptions

• Replaces description-link regex checks with a linear balanced-delimiter scanner. Validation now catches nested labels, complex destinations, inner links, and escaped bracket cases without quadratic behavior.

spec/validate.py

Tests (2) +65 / -0
test_pr_review.pyCover comment-only Copilot history widening +23/-0

Cover comment-only Copilot history widening

• Adds a regression test proving that a narrow window containing only comments performs the wider lookup and recovers the bot identity from an older review.

scripts/tests/test_pr_review.py

test_spec_validate.pyExpand Markdown description-link regression coverage +42/-0

Expand Markdown description-link regression coverage

• Adds tests for nested labels, multiple parenthesized destination groups, links nested inside non-link brackets, escaped delimiters, and linear performance on unmatched brackets.

scripts/tests/test_spec_validate.py

Documentation (4) +6 / -5
AGENTS.mdRoute missing lint binaries to local invocation guidance +1/-0

Route missing lint binaries to local invocation guidance

• Adds a router entry directing agents to the known-working local lint and formatting commands when a tool is absent from 'command -v'.

AGENTS.md

CODESTYLE.mdDirect shell checks to governed lint commands +1/-1

Direct shell checks to governed lint commands

• Clarifies that shell clean-compile checks must follow the documented governance invocation instead of probing for a native 'shellcheck' binary.

CODESTYLE.md

GOVERNANCE.mdPromote and clarify Docker-based lint guidance +2/-2

Promote and clarify Docker-based lint guidance

• Promotes the local-linter section to a top-level governed rule and documents that fleet hosts intentionally omit native lint binaries. A missing command now explicitly routes users to the supported Docker invocation rather than treating the check as unavailable.

GOVERNANCE.md

README.mdCorrect pre-commit PATH availability wording +2/-2

Correct pre-commit PATH availability wording

• Removes the claim that 'uv tool install' always makes 'pre-commit' immediately PATH-accessible and distinguishes the installed command from hook tools run through 'uvx'.

catalog/snippets/pre-commit/README.md

@ptr727
ptr727 merged commit 5ab8d22 into main Aug 25, 2026
8 checks passed
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📜 Skill insights (4)

Grey Divider


Remediation recommended

1. CODESTYLE.md duplicates lint rule 📘 Rule violation ⚙ Maintainability
Description
The added sentence restates the canonical GOVERNANCE.md rule that a missing native shellcheck
binary does not make the check unavailable. The non-canonical file should only point readers to the
governing section.
Code

CODESTYLE.md[54]

+Bash, and only where a program cannot be Python: a bootstrap that installs the interpreter cannot be written in it, and a host tool that must run before a development toolchain exists cannot depend on one. Everything else is Python, with a test under the scripts tree's `tests/` directory. The mandatory `set -Eeuo pipefail` header, the pipefail-versus-early-reader pitfall, self-locating scripts, the `shellcheck`-plus-`shfmt` clean-compile, and the why-not-what comment rule are packaged as the `shell-codestyle` Skill at `.agents/skills/shell-codestyle/SKILL.md` in the hub, not a repo-relative link since that path is hub-local and not carried into every fleet repo. Read the skill for the full rules. Run the clean-compile check itself per [GOVERNANCE.md "Running the Linters Locally"][governance-running-the-linters-locally], not by probing `command -v shellcheck`.
Relevance

●●● Strong

Recent accepted style history supports removing duplicated governance guidance from non-canonical
documentation.

PR-#901

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2826346 prohibits partial restatements of cross-cutting rules outside AGENTS.md and
GOVERNANCE.md. The changed CODESTYLE.md sentence says not to probe command -v shellcheck,
while the canonical section states that a command -v <tool> miss does not mean the check is
unavailable and directs readers to its invocation.

Rule 2826346: Do not duplicate cross-cutting rules from AGENTS.md and GOVERNANCE.md in other repository files
CODESTYLE.md[54-54]
GOVERNANCE.md[215-217]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`CODESTYLE.md` partially restates the canonical rule about handling a missing native lint binary.

## Issue Context
Cross-cutting conditions and obligations must remain in `AGENTS.md` or `GOVERNANCE.md`. Other files may reference the canonical section without repeating its substance.

## Fix Focus Areas
- CODESTYLE.md[54-54]
- GOVERNANCE.md[215-217]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Docstring sentences wrap across lines 📜 Skill insight ✧ Quality
Description
The added _bracket_matches prose wraps individual sentences across several physical lines,
including a split after a link. This violates the requirement that each sentence occupy exactly
one line.
Code

spec/validate.py[R50-53]

+    A character class like `[^\\]]*` cannot count depth, so it stops at the first close and misses a link
+    label carrying its own nested brackets, e.g. `[API [docs]](url)`. Counting only open_char/close_char
+    nesting, ignoring the other bracket type, needs one such map per bracket type rather than one pass
+    mixing both. Built with a single left-to-right stack pass over the whole text rather than one depth-
Relevance

●●● Strong

A same-file recent precedent accepted rewriting docstrings to comply with one-sentence-per-line
formatting.

PR-#978

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2826725 forbids mid-sentence line wrapping. For example, the sentence beginning on line 50
continues through lines 51-53, and the sibling implementation has the same structure.

spec/validate.py[50-53]
spec/audit.py[633-636]
Skill: comment-and-doc-style

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Sentences in the new helper docstrings are wrapped across physical lines.

## Issue Context
Multi-line comments and docstrings must contain exactly one complete sentence per line, without mid-sentence wrapping.

## Fix Focus Areas
- spec/validate.py[50-62]
- spec/audit.py[633-644]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Comments use historical change framing 📜 Skill insight ✧ Quality
Description
The new comments describe what the implementation used to do and call the new behavior `Linear
now`. Documentation should state the current invariant directly rather than narrating the change.
Code

spec/audit.py[R3492-3493]

+    # A run of unmatched '[' used to re-scan the remaining text from every position (#1011, CodeRabbit),
+    # O(N^2) on a README tagline read before any length limit. Linear now: a slow run means a regression.
Relevance

●●● Strong

Recent accepted precedent explicitly requires present-tense comments instead of past-tense change
framing.

PR-#901

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2826805 rejects past-tense change framing in comments and documentation. The changed comments
explicitly compare an old repeated-scan behavior with the current linear implementation, and similar
used to wording appears in the added tests.

spec/audit.py[3492-3493]
scripts/tests/test_spec_validate.py[244-246]
Skill: comment-and-doc-style

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Added comments and docstrings narrate prior behavior using phrases such as `used to`, `previous version`, and `Linear now`.

## Issue Context
Comments and documentation should describe current behavior in present tense. Historical before/after framing belongs in the PR description or changelog.

## Fix Focus Areas
- spec/audit.py[637-644]
- spec/audit.py[3473-3493]
- scripts/tests/test_spec_validate.py[193-246]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (1)
4. Wall-clock checks can flake 🐞 Bug ☼ Reliability
Description
The new regression test fails solely when one invocation takes over one wall-clock second, so a
paused, contended, or coverage-instrumented CI process can fail even though _bracket_matches()
remains linear. The same timing gate is duplicated in spec/audit.py --selftest, making the
validation workflow vulnerable in two places.
Code

scripts/tests/test_spec_validate.py[R247-249]

+        start = time.monotonic()
+        validate.contains_description_markdown_link("[" * 20000)
+        self.assertLess(time.monotonic() - start, 1.0)
Relevance

●●● Strong

Recent reliability findings show the team accepts deterministic regression fixes for
nondeterministic failure risks.

PR-#959
PR-#970

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The unit test measures elapsed wall time and unconditionally asserts it is below one second; the
audit selftest similarly marks itself failed above one second. The validation action runs both
checks under coverage, so elapsed time includes nondeterministic runner scheduling and
instrumentation rather than only algorithmic complexity.

scripts/tests/test_spec_validate.py[244-249]
spec/audit.py[3492-3505]
.github/actions/validate/action.yml[28-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new complexity regression checks use a fixed one-second wall-clock threshold, which can fail nondeterministically when CI is paused or contended even if the implementation remains linear.

## Issue Context
Both the unit suite and `spec/audit.py --selftest` run under coverage in the validation workflow, adding variable instrumentation and host overhead. Keep regression coverage deterministic; move performance measurement to a non-gating benchmark or verify the algorithm without a wall-clock deadline.

## Fix Focus Areas
- scripts/tests/test_spec_validate.py[244-249]
- spec/audit.py[3492-3505]
- .github/actions/validate/action.yml[28-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

5. _bracket_matches exposes implementation details 📜 Skill insight ✧ Quality
Description
The new _bracket_matches docstrings are lengthy prose blocks that explain stack traversal,
complexity history, repeated scans, and push/pop mechanics rather than concisely stating the
callable's behavioral contract. Preserve only the mapping and escaping guarantees callers rely on,
moving any indispensable algorithm rationale to narrowly scoped inline comments.
Code

spec/validate.py[R53-56]

+    mixing both. Built with a single left-to-right stack pass over the whole text rather than one depth-
+    counting scan per open position: re-scanning from every unmatched open is what made a prior version of
+    this walk O(N^2) on a run of N unmatched opens (#1011, CodeRabbit, on spec/audit.py's sibling
+    implementation). A close pops the most recently pushed open, the same pairing a fresh depth count from
Relevance

●● Moderate

Accepted history supports concise prose, but evidence is weaker for removing this algorithm
rationale entirely.

PR-#978
PR-#901

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2827096 requires docstrings to focus on behavioral contracts rather than implementation
details, while Rule 2826677 requires comments to be one line by default and allows a second line
only for genuine constraints. Both added copies of _bracket_matches use many wrapped lines to
discuss examples, a left-to-right stack pass, repeated scans, algorithm choice and complexity
history, push/pop delimiter pairing, and escaping mechanics, demonstrating that they exceed a
concise contract and document implementation details.

spec/validate.py[48-63]
spec/audit.py[631-645]
Skill: python-codestyle
Skill: comment-and-doc-style

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description

The new `_bracket_matches` docstrings are long explanatory prose blocks that describe internal algorithm mechanics and implementation history instead of presenting a concise behavioral contract.

## Issue Context

Docstrings should state what callers can rely on and remain concise. Preserve the helper's mapping and escaping contract, and remove implementation discussion about stack traversal, repeated scans, complexity history, and push/pop mechanics; if any rationale is indispensable, express it through clearer code structure or a narrowly scoped inline comment near the relevant code, using one line by default and a second only for a genuine constraint the code cannot carry.

## Fix Focus Areas

- spec/validate.py[48-63]
- spec/audit.py[631-645]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Comments cite review task context 📜 Skill insight ✧ Quality
Description
The new explanatory prose cites #1011, CodeRabbit, and qodo while describing why the
implementation changed. Review and ticket provenance belongs in the PR description rather than
permanent code comments.
Code

spec/validate.py[R54-56]

+    counting scan per open position: re-scanning from every unmatched open is what made a prior version of
+    this walk O(N^2) on a run of N unmatched opens (#1011, CodeRabbit, on spec/audit.py's sibling
+    implementation). A close pops the most recently pushed open, the same pairing a fresh depth count from
Relevance

● Weak

A same-file, same-date precedent rejected removing issue provenance from durable explanatory
comments.

PR-#1004

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2827092 prohibits task- or PR-specific context in comments. The added prose explicitly names
issue #1011 and reviewer identities, and the same provenance appears in the sibling implementation
and tests.

spec/validate.py[54-62]
spec/audit.py[637-644]
scripts/tests/test_spec_validate.py[210-220]
Skill: python-codestyle

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
New comments and docstrings reference the current ticket and review agents.

## Issue Context
Permanent comments should explain enduring constraints without references to the task, PR, ticket, or reviewer that prompted the change.

## Fix Focus Areas
- spec/validate.py[54-62]
- spec/audit.py[637-644]
- scripts/tests/test_spec_validate.py[210-220]
- spec/audit.py[3473-3493]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 70 rules
✅ Skills: 5 invoked
  comment-and-doc-style
  dotnet-codestyle
  python-codestyle
  shell-codestyle
  workflow-ci-contract
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread CODESTYLE.md
## Shell

Bash, and only where a program cannot be Python: a bootstrap that installs the interpreter cannot be written in it, and a host tool that must run before a development toolchain exists cannot depend on one. Everything else is Python, with a test under the scripts tree's `tests/` directory. The mandatory `set -Eeuo pipefail` header, the pipefail-versus-early-reader pitfall, self-locating scripts, the `shellcheck`-plus-`shfmt` clean-compile, and the why-not-what comment rule are packaged as the `shell-codestyle` Skill at `.agents/skills/shell-codestyle/SKILL.md` in the hub, not a repo-relative link since that path is hub-local and not carried into every fleet repo. Read the skill for the full rules.
Bash, and only where a program cannot be Python: a bootstrap that installs the interpreter cannot be written in it, and a host tool that must run before a development toolchain exists cannot depend on one. Everything else is Python, with a test under the scripts tree's `tests/` directory. The mandatory `set -Eeuo pipefail` header, the pipefail-versus-early-reader pitfall, self-locating scripts, the `shellcheck`-plus-`shfmt` clean-compile, and the why-not-what comment rule are packaged as the `shell-codestyle` Skill at `.agents/skills/shell-codestyle/SKILL.md` in the hub, not a repo-relative link since that path is hub-local and not carried into every fleet repo. Read the skill for the full rules. Run the clean-compile check itself per [GOVERNANCE.md "Running the Linters Locally"][governance-running-the-linters-locally], not by probing `command -v shellcheck`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. codestyle.md duplicates lint rule 📘 Rule violation ⚙ Maintainability

The added sentence restates the canonical GOVERNANCE.md rule that a missing native shellcheck
binary does not make the check unavailable. The non-canonical file should only point readers to the
governing section.
Agent Prompt
## Issue description
`CODESTYLE.md` partially restates the canonical rule about handling a missing native lint binary.

## Issue Context
Cross-cutting conditions and obligations must remain in `AGENTS.md` or `GOVERNANCE.md`. Other files may reference the canonical section without repeating its substance.

## Fix Focus Areas
- CODESTYLE.md[54-54]
- GOVERNANCE.md[215-217]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread spec/validate.py
Comment on lines +50 to +53
A character class like `[^\\]]*` cannot count depth, so it stops at the first close and misses a link
label carrying its own nested brackets, e.g. `[API [docs]](url)`. Counting only open_char/close_char
nesting, ignoring the other bracket type, needs one such map per bracket type rather than one pass
mixing both. Built with a single left-to-right stack pass over the whole text rather than one depth-

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Docstring sentences wrap across lines 📜 Skill insight ✧ Quality

The added _bracket_matches prose wraps individual sentences across several physical lines,
including a split after a link. This violates the requirement that each sentence occupy exactly
one line.
Agent Prompt
## Issue description
Sentences in the new helper docstrings are wrapped across physical lines.

## Issue Context
Multi-line comments and docstrings must contain exactly one complete sentence per line, without mid-sentence wrapping.

## Fix Focus Areas
- spec/validate.py[50-62]
- spec/audit.py[633-644]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread spec/validate.py
Comment on lines +53 to +56
mixing both. Built with a single left-to-right stack pass over the whole text rather than one depth-
counting scan per open position: re-scanning from every unmatched open is what made a prior version of
this walk O(N^2) on a run of N unmatched opens (#1011, CodeRabbit, on spec/audit.py's sibling
implementation). A close pops the most recently pushed open, the same pairing a fresh depth count from

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational

4. _bracket_matches exposes implementation details 📜 Skill insight ✧ Quality

The new _bracket_matches docstrings are lengthy prose blocks that explain stack traversal,
complexity history, repeated scans, and push/pop mechanics rather than concisely stating the
callable's behavioral contract. Preserve only the mapping and escaping guarantees callers rely on,
moving any indispensable algorithm rationale to narrowly scoped inline comments.
Agent Prompt
## Issue description

The new `_bracket_matches` docstrings are long explanatory prose blocks that describe internal algorithm mechanics and implementation history instead of presenting a concise behavioral contract.

## Issue Context

Docstrings should state what callers can rely on and remain concise. Preserve the helper's mapping and escaping contract, and remove implementation discussion about stack traversal, repeated scans, complexity history, and push/pop mechanics; if any rationale is indispensable, express it through clearer code structure or a narrowly scoped inline comment near the relevant code, using one line by default and a second only for a genuine constraint the code cannot carry.

## Fix Focus Areas

- spec/validate.py[48-63]
- spec/audit.py[631-645]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread spec/audit.py
Comment on lines +3492 to +3493
# A run of unmatched '[' used to re-scan the remaining text from every position (#1011, CodeRabbit),
# O(N^2) on a README tagline read before any length limit. Linear now: a slow run means a regression.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

5. Comments use historical change framing 📜 Skill insight ✧ Quality

The new comments describe what the implementation used to do and call the new behavior `Linear
now`. Documentation should state the current invariant directly rather than narrating the change.
Agent Prompt
## Issue description
Added comments and docstrings narrate prior behavior using phrases such as `used to`, `previous version`, and `Linear now`.

## Issue Context
Comments and documentation should describe current behavior in present tense. Historical before/after framing belongs in the PR description or changelog.

## Fix Focus Areas
- spec/audit.py[637-644]
- spec/audit.py[3473-3493]
- scripts/tests/test_spec_validate.py[193-246]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +247 to +249
start = time.monotonic()
validate.contains_description_markdown_link("[" * 20000)
self.assertLess(time.monotonic() - start, 1.0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

6. Wall-clock checks can flake 🐞 Bug ☼ Reliability

The new regression test fails solely when one invocation takes over one wall-clock second, so a
paused, contended, or coverage-instrumented CI process can fail even though _bracket_matches()
remains linear. The same timing gate is duplicated in spec/audit.py --selftest, making the
validation workflow vulnerable in two places.
Agent Prompt
## Issue description
The new complexity regression checks use a fixed one-second wall-clock threshold, which can fail nondeterministically when CI is paused or contended even if the implementation remains linear.

## Issue Context
Both the unit suite and `spec/audit.py --selftest` run under coverage in the validation workflow, adding variable instrumentation and host overhead. Keep regression coverage deterministic; move performance measurement to a non-gating benchmark or verify the algorithm without a wall-clock deadline.

## Fix Focus Areas
- scripts/tests/test_spec_validate.py[244-249]
- spec/audit.py[3492-3505]
- .github/actions/validate/action.yml[28-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant