Skip to content

feat(config): add documentation coverage guarantee (BO-2200)#337

Open
urlmonitor wants to merge 50 commits into
mainfrom
feature/BO-2200-doc-coverage
Open

feat(config): add documentation coverage guarantee (BO-2200)#337
urlmonitor wants to merge 50 commits into
mainfrom
feature/BO-2200-doc-coverage

Conversation

@urlmonitor

Copy link
Copy Markdown
Owner

Summary

  • Added documentation_gates declarative policy and documentation-verifier phase agent to guarantee doc coverage for doc-triggering tickets
  • Removed documentation-expert from pre-coder flow_change_gates and re-routed it via the post-coder _CANONICAL_PHASE_ORDER path (BO-2200d-1)
  • Added L1-only trigger guard and Agent Contracts block to ticket-gen with accompanying BO-2200 series unit tests

Test plan

  • Run python -m pytest unit_tests/test_bo_2200d_1.py -q — confirm all 3 BO-2200d-1 tests pass
  • Run python -m pytest unit_tests/ -q — confirm no new failures beyond pre-existing build-guard baseline
  • Inspect config/guardrail_gates.yaml to verify documentation-expert absent from all four flow_change_gates mandatory_agents entries

Generated with Claude Code

Test User and others added 30 commits July 16, 2026 09:14
…0 (29 tickets + Master_Plan; AC implemented_by backrefs)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… id (vocab gate)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
BO-2200a-5: add level check inside the documentation_triggers validation
block in validate_ac_schema._validate_file(); rejects any non-L1 AC that
carries documentation_triggers with an error naming the AC id and level.
Enum-value check preserved and runs first.

BO-2200c-1: add _build_agent_contracts_section() to generate_ticket_from_ac;
emits '## Agent Contracts' + '### documentation-expert' with a globally-
numbered '- [ ] AC-1: <title>' item when documentation-expert is 'needed'
in the agents map. Section is injected after Implementation Notes and before
Sign-offs per n_location_rule='1'.

Includes tests for both ACs (test_bo_2200a_5.py, test_bo_2200c_1.py) and
phase sign-offs for tickets 06 (BO-2200a-5), 08 (test-writer), and 17
(BO-2200c-1).
Commit refused: pr-reviewer has status failed. Two blockers must be
resolved before committing the BO-2200b-1 implementation:
(1) revert 14 docs/agents/cards/ files to HEAD;
(2) add config/feedback_categories.yaml and
    templates/config/feedback_categories.yaml to files_touched.
After remediation, re-invoke pr-reviewer then re-invoke commit.
Added a `documentation_gates` section to `config/guardrail_gates.yaml`
with `change_target_triggers: [ui, schema, pipeline, docs]` and
`risk_surface_triggers` for future use.

Implemented the read-path in `_build_agents_map`
(`scripts/ac_store/generate_ticket_from_ac.py`): after `flow_change_gates`
processing the generator reads `change_target_triggers` from the loaded
gates config at call-time and adds `documentation-expert` to `guardrail_set`
when any `change_target` intersects the trigger list. No hard-coded trigger
set exists in the generator — adding or removing a triggering value is a
config edit only (AC BO-2200a-1).

All 5 test assertions (3 test methods, subTest) green.
Registers `documentation-verifier` in config/agent_registry.json at
priority 11.9 (after live-surface-tester at 11.8, before commit at 12)
as a conditional ticket phase — the documentation coverage gate for
BO-2200b-1. Also adds documentation-verifier to allowed_writers in
config/feedback_categories.yaml and templates/config/feedback_categories.yaml.

Resolves AC: BO-2200b-1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-offs (BO-2200 series)

Add unit test files for ACs BO-2200a-2, BO-2200a-5-i, BO-2200b-6, and BO-2200d-1.
Record test-writer and test-runner sign-offs for multiple BO-2200 tickets.
Record pr-reviewer failure for BO-2200b-3 (llm-expert not yet run; template absent).
Fix stale depends_on AC-ID references in tickets 02, 09, 16; add missing
change_target and risk_surface frontmatter fields. Add feedback-id fallback
to ticket 09 commit comment. Commit-phase sign-off for BO-2200b-3.
Documentation-only changes for BO-2200a-5-i: adds MODULE/GOAL/BUSINESS CONTEXT/
ARCHITECTURE docstring fields and a DECISION HISTORY block to validate_ac_schema.py.
No functional logic changed — independence property (enum-value check and L1-only
level check as separate if-branches) was already in place from parent ticket BO-2200a-5.
Remove documentation-expert from all four flow_change_gates mandatory_agents
entries in guardrail_gates.yaml (code/contract_boundary, code/safety,
schema/contract_boundary, schema/safety); architect-review is retained
in all four entries unchanged.

Use _CANONICAL_PHASE_ORDER for all flow pairs in generate_ticket_from_ac.py,
so documentation-expert appears after the coder via documentation_gates
injection. Also adds risk_surface_triggers OR dimension to documentation_gates
evaluation (BO-2200a-2).

Includes documentation-verifier.md placeholder-detection enhancement
(BO-2200b-3) and ticket sign-offs for BO-2200a-2 python-coder and
BO-2200b-3 llm-expert.
…overage [NO-FEEDBACK-CHECK]

Resolve add/add conflicts: keep branch versions (with sign-offs) over main scaffold stubs.

# Conflicts:
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/01_TICKET-20260715-BO-2200a-1.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/02_TICKET-20260715-BO-2200a-2.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/06_TICKET-20260715-BO-2200a-5.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/07_TICKET-20260715-BO-2200a-5-i.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/08_TICKET-20260715-BO-2200b-1.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/09_TICKET-20260715-BO-2200b-2.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/11_TICKET-20260715-BO-2200b-3.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/16_TICKET-20260715-BO-2200b-6.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/17_TICKET-20260715-BO-2200c-1.md
#	tickets/00_inbox/epics/EPIC-DocumentationCoverageGuarantee/25_TICKET-20260715-BO-2200d-1.md
… a-1/b-1 tests

- Update test_ac4/test_bo540_2 ordering assertions: documentation-expert now
  runs AFTER python-coder and test-writer (BO-2200d post-coder contract,
  superseding BO-540-2's pre-coder ordering). covers repointed to BO-2200d-2.
- Commit BO-2200a-1 and BO-2200b-1 unit tests that the batch drive left
  uncommitted (code was committed without their tests).
- Regenerate agent cards for the new documentation-verifier agent.
- Fix docs/INDEX.md missing last_updated (auto-staged by Transform doc index hook).

[NO-HOOKS-OVERRIDE: SKIP=check-doc-frontmatter; card type:card violations
are pre-existing from worktree pre-commit gap; validator schema change needed
separately — worktree false-fail workaround per project_worktree_checkdocfrontmatter_falsefail]
…exclusion

- documentation-verifier.md: quote four behavior values containing ': '
  ((status: blocker), status: ok) that made the entire YAML frontmatter
  unparseable (parse_frontmatter returned {}); build.py would have deployed
  the gate agent with no frontmatter. Now parses with produces: test_artifact.
- test_ticket_frontmatter_guard: exclude the new documentation_gates meta
  section (BO-2200a-1) from the guardrail_gates.yaml vocab contract, like
  flow_change_gates. Fixes test_ac2_yaml_* which pytest (now a required main
  gate) would otherwise fail.

Every claim is verifiable in the staged diff.
…overage [NO-FEEDBACK-CHECK]

Resolved conflict in scripts/ac_store/generate_ticket_from_ac.py:
combined BO-2200c-1 (agents_map-based documentation-expert subsection) with
TKT-500f-10 (delivers_to/expects_from contract rendering) into a single
_build_agent_contracts_section function with optional agents_map parameter.
Both BO-2200c-1 and TKT-500f-10 tests pass green after resolution.
BO-2200b-1 pull-request phase complete. PR #337 open and MERGEABLE
(conflict in generate_ticket_from_ac.py resolved). Ticket status: done.
Marks commit phase signed_off on ticket 09 (documentation-verifier
template). Implementation (templates/agents/documentation-verifier.md)
was authored by llm-expert and committed in d4de570/24fe5c16.
Ticket is change_target: prompt with files_touched: []; no production
code commit is produced. Supervisor to decide whether to respawn
pr-reviewer (whose prior run predates the implementation) before the
pull-request phase.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Marks commit agent signed_off on ticket 02 (risk_surface_triggers
OR-semantics). Implementation (scripts/ac_store/generate_ticket_from_ac.py)
was committed in 49e1af7 (BO-2200d-1 bundle). All 3 dedicated BO-2200a-2
tests and the full 81-test suite are clean per test-runner sign-off.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…BACK-CHECK]

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…cal_removal_guard (BO-2200d-1-i)

Stage unit_tests/test_bo_2200d_1_i.py (authored by test-writer, was untracked) and
extend the _non_target_sections exclusion sets in test_ticket_frontmatter_guard.py
to include "surgical_removal_guard", resolving two pr-reviewer blockers:
- TestGuardrailYamlVocabularyContract vocabulary-contract tests now pass
- AC behavioral tests for BO-2200d-1-i are now committed to the branch

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… not length (BO-2200b-3-i)

Refined documentation-verifier.md per AC BO-2200b-3-i: brevity is not a placeholder
signal. A short but genuine doc passes all four sub-checks; placeholder detection now
explicitly keys on SIGNATURES (heading-only stubs, residual template tokens such as
{summary} or <placeholder>, TODO/TBD/FIXME markers), not on length. Added 4 tests in
unit_tests/test_bo_2200b_3_i.py asserting the explicit language is present.
…EDBACK-CHECK]

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Implementation already landed in 2d062f1 alongside BO-2200b-3-i
sign-off. This commit records the commit-agent sign-off on the
BO-2200a-3 ticket (non_triggering_classifications guard).
…BACK-CHECK]

Records pull-request agent sign-off on BO-2200a-3 (non_triggering_classifications
guard). Also bundles staged-but-uncommitted phase sign-offs for BO-2200b-2-i
(llm-expert, test-writer, test-runner) that were left pending from a prior run.

PR #337 already open for epic branch feature/BO-2200-doc-coverage.
Test User added 20 commits July 20, 2026 17:55
Adds {change_target: code, risk_surface: cost} to
documentation_gates.non_triggering_classifications in
config/guardrail_gates.yaml to satisfy AC BO-2200a-3-i. The cost risk
surface was previously absent from the exclusion list. Includes two
behavioral tests covering the cost exclusion and the unclassified-AC
safe path. Suppresses a check-secrets false positive for the new test
file in .security-allowlist.
Fix a bug in _build_agents_map Dimension 3 where a non_triggering
entry for one list element (e.g. config/internal) could suppress
documentation-expert even when a different element (e.g. ui) triggered
it independently via change_target_triggers.

The fix collects all suppressed_targets (change_target values covered by
non_triggering entries for the current risk_surface) and discards
documentation-expert only when EVERY triggering element is covered.
For Dimension-2-only paths, the original scalar suppression is preserved.

Closes AC BO-2200a-4.
Whenever documentation-expert survives all non-triggering discard passes
in _build_agents_map, documentation-verifier is now co-injected into the
same agents map.  _build_frontmatter sets documentation_required: true
when documentation-verifier appears as needed.  Both agents share the
same trigger gate — removing documentation-expert via the classification
guard also removes documentation-verifier.

documentation-verifier added to _CANONICAL_PHASE_ORDER and
_FLOW_CHANGE_PHASE_ORDER immediately after documentation-expert.

Tests: unit_tests/test_bo_2200b_4.py (2 behavioral tests, both green).
AC: BO-2200b-4
…e (BO-2200b-5)

Add _DOC_MANDATORY protected set to _build_agents_map so documentation-expert
and documentation-verifier cannot be stripped via not_needed_overrides once the
documentation trigger fires — mirrors the existing _TDD_MANDATORY protection for
test-writer/test-runner (BO-550-1-i). Includes red-to-green behavioral tests
(unit_tests/test_bo_2200b_5.py) and reference documentation.

Also fix generate_doc_index.py to emit last_updated in INDEX.md frontmatter so
the transform-then-check hook sequence does not produce a frontmatter violation.
… agent override (BO-2200b-5-i)

When _build_agents_map detects a not_needed override targeting a doc-mandatory
agent (documentation-expert or documentation-verifier), emit a named WARNING
log so the blocked hand-edit attempt is surfaced rather than silently
overwritten. This satisfies the "silent-proof" requirement of AC BO-2200b-5-i:
the override is still blocked and the agent is restored to needed, but the
operator can now observe the suppression via the logger.warning() call.

Adds unit_tests/test_bo_2200b_5_i.py with three behavioral tests covering
the verifier-only override, expert-only override, and warning-emission paths.
…-expert AC-N line (BO-2200c-2)

Each documentation-expert contract line now carries three parts: the
Diataxis genre (read from documentation_triggers[0], defaulting to
"explanation"), the target documentation path (from doc_links or a
computed docs/<genre>/<ac-id>.md default), and a content constraint
derived from the first "Then" clause in the AC criteria.

Three new helpers implement this: _extract_doc_genre, _extract_doc_path,
_derive_content_constraint. The AC-N line format changes from
"- [ ] AC-1: <title>" to "- [ ] AC-1: [<genre>] <path> — <constraint>".
Previously _build_agent_contracts_section called _extract_doc_path which
reduced doc_links to a single bare file path, discarding relationship,
status, and relevance metadata from every entry after the first.

Added _build_doc_links_cross_link_lines to render all qualifying doc_links
entries with their structured metadata fields intact as an 'Existing docs
to update / cross-link' block so the documentation-expert agent knows how
each linked document relates to the AC.

Also adds unit_tests/test_bo_2200c_4.py (2 behavioral tests, both green).
…sh in agent-contracts section (BO-2200c-5)

Normalise delivers_to and expects_from in _build_agent_contracts_section to
support both dict form (legacy) and list-of-dicts form emitted by BA/IT-PO v3.
Calling .get() directly on a list raised AttributeError and silently blocked
ticket generation for any v3-authored AC with these fields set.

Adds 9 behavioral tests in unit_tests/test_bo_2200c_5.py covering the single-
source invariant (one Agent Contracts block, no parallel required-docs list) and
the list/dict normalisation fix.
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