Repository navigation
Description
Objective
Turn existing C-family Doxygen recognition into useful owner associations without overstating macro, conditional or named-target resolution.
Umbrella: #1654 · Planning ID: D14
Completion prerequisites: D25: #1662, D26: #1663
LANG coverage: C, Cpp, Mozcpp, Objc.
Development can start after D05/D06 interfaces exist. Completion is blocked by D25/D26 infrastructure and requires this adapter's own conformance cases, scaling probes for new work and fuzz seeds.
Shared architecture and constraints
Follow the umbrella's shared contracts. AST recognition serves two consumers: exact legacy convention/coverage streaming for root LOC, and richer source documentation for owner lookup and local text. Source attachment, profile eligibility and physical metric ownership are separate. Preserve the current legacy candidate view before run selection, coverage ordering and metrics-only early exits, including existing logical-line precomputation where required.
Documentation fragments, logical documents and convention-qualified owner edges have separate identities. Source offsets refer to the actual parsed buffer and included ranges. The index is caller-owned, immutable and source-bound; lookup validates tree/index identity. Complete text means local decoded/cleaned content with forward source mapping, not inherited or generator-expanded documentation.
Implementation touchpoints
src/metrics/npa/{cpp_declarators,cpp_first_word,cpp_annotations}.rs: current recovered-declaration evidence to inspect, not metric policy to import into AST.src/metrics/loc/continuation.rs,loc/python.rsandsrc/spaces/compute.rs: current logical-line indexes/memos and metric coverage ordering; reuse structural facts without introducing an AST-to-metrics dependency.big-code-analysis-ast/src/node/ancestors/{chain,siblings,folds}.rs: current derived-chain, sibling-record and memo implementations.big-code-analysis-ast/src/roles/c.rs,big-code-analysis-ast/src/roles/cpp.rs,big-code-analysis-ast/src/roles/mozcpp.rs,big-code-analysis-ast/src/roles/objc.rs: current shared role recognition; read the contributor reference in roles/mod.rs.big-code-analysis-ast/src/roles/doc_tests/: existing per-language recognition fixtures; add independent owner/text expectations.big-code-analysis-ast/src/lang_helpers/doxygen.rsbig-code-analysis-ast/src/checker/doxygen_doc_binding.rsbig-code-analysis-ast/src/checker/{c,cpp,mozcpp,objc}.rsbig-code-analysis-ast/src/documentation C-family adapterbig-code-analysis-ast/src/c_macro.rs
Implementation steps
- Resolve C-family documentation using current id projections and source evidence for recovered multi-piece members, preserving existing logical-line metric precomputation.
- Build owner resolution on DoxygenRow/id-keyed candidate fragments with explicit context requirements and existing no-reentry memo protocol.
- Support leading/all-kept blocks, trailing member docs, in-body descriptions, declaration-signature docs, standalone file/page/group/explicit-target blocks and gathering.
- Resolve previous-member and individual declarator/slot owners, preserving wrapper evidence and shared-document edges.
- Record conditional/recovery targets as candidates until source proves a concrete owner; current contains-any-declaration boolean is insufficient to select a branch.
- Extract only structural naming metadata needed for association. Queue forward names and finalize with adapter-defined same-file scope/kind/signature keys; unresolved overloads/missing/ambiguous targets remain explicit.
- Unify gathered and unbound evidence without losing the gatherer or duplicating text/coverage; keep legacy emissions in their physical spaces.
- Resolve parsed-source names after masking; comments retain raw text. Do not infer name_masked from dollar bytes or invent original names. Retain positional records even when a named link cannot resolve.
- Preserve per-question memoization for nested preprocessor checks and separate source/legacy view answers. Recheck relevant fix(loc): tool-vs-bca doc-comment attachment divergences left by #1613 #1646 cases, keeping any changed policy explicit.
Tests and edge cases
- Quoted/CDATA structural tags, valid versus unresolved explicit targets, typed macros and member pointers, split virtual methods with intervening preprocessor lines, thread-safety annotation tails, and chained comment continuation origins.
- Conditional per struct depth and nested conditional chains, ERROR wrappers, aliases, member-pointer data versus method templates, and current continuation/preprocessor masking distinctions in all four grammars.
- All four grammars: leading docs on functions/types, trailing docs on members/parameters, in-body description and signature placements.
- Multi-declarator ownership, anonymous/slot forms and Objective-C methods/properties/protocols.
- @file gathers older blocks, line gatherer joins, multiple structural blocks and EOF gatherer.
- Forward explicit name, duplicate/overloaded names, missing symbol and conditional alternatives; no first-wins or all-candidates-as-resolved behavior.
- Source with preproc masking versus caller-written dollar spelling: positional association survives; unavailable original-name link stays unresolved.
- Deep nested #ifdef with source/legacy queries in both orders, plus included-range gaps and local recovery.
- Exact selected source spans and physical DLOC row identities; Cpp/Mozcpp parity for constructs their grammars share.
Use independently specified expected owners, fragment counts/order, byte ranges, text and availability. Pair them with separate legacy metric assertions where relevant. Do not sort/trim observed results, rely only on facade/delegate equality, or accept generated snapshots without an expected-value anchor. Use verbatim source for EOF/CRLF cases. Perturb the decision-bearing expression and confirm the intended assertion fails; use the maintained utils/perturb.py only on tracked, clean targets, recording or stashing real work first. Multi-target cargo runs require --no-fail-fast; include the mutated crate and dependent crates before claiming a unique guard. Keep irreproducible fixtures/manifests in tests, maintained utils or an issue attachment, following the “Temporary files” and “Evidence for a claim” rules in AGENTS.md.
Acceptance criteria
- C/Cpp/Mozcpp/Objc all provide useful declaration/text results with honest uncertainty.
- No new symbol-table or macro-expansion promise; no metric owner reassignment.
- Gathering, trailing resolution, many-owner output and conditional depth have discriminating tests/probes/seeds.
Verification and completion evidence
- Follow current
docs/development/testing.mdanddocs/development/grammar_dispatch.md. Assert deterministic work counters exactly and measure both cached-state computations and slot searches where relevant. - Use the current pre-implementation base and grammar pins; completed fixes and documented retained limitations have different expected outcomes. Do not restore an obsolete baseline to make a migration pass.
- Follow current role-census/role-coverage/role-bypass requirements and applicable role-parity-corpus checks. Preserve independent semantic fixtures; refresh
.role-coverage-observed.txtwhen any sampled corpus gitlink changes. - Put revisions, exact commands, tool versions and durable input links beside parity/coverage claims; host-local evidence paths are not citations.
- Recheck current source and the prerequisite contracts/baseline applicable to this issue; record intentional changes to the premises.
- Run focused production-path tests and affected language siblings. Use package-isolated
-p big-code-analysis-ast/-p big-code-analysisfeature builds; workspace feature unification is not isolation. - Run the repository's required checks for the touched surfaces. For implementation changes:
make worktree-setup,make pre-commitread from itsBCA_GATE:verdict, and relevant test-language membership comparison. Add scaling and chain-audit checks for traversal changes; runmake fuzz-checkand seed replay for fuzz changes. - Record exact test/perturbation/probe evidence in a completion comment and update this body. Review unexpected metric drift before snapshot acceptance; follow baseline and integration-submodule discipline if behavior deliberately changes.
- Land public API documentation, re-export/stability review and changelog entries with the originating API change. Keep unrelated CLI/web/Python surfaces outside this issue unless explicitly listed.
Current implementation notes (2026-11-17)
Revalidated against 91087f52f5d4a58e31ae320851351990f1436411. These notes replace the November 4 implementation notes; the earlier review is retained in this issue’s comment/edit history. Relevant work: PR #1824, PR #1835, PR #1838, PR #1856, PR #1909, PR #1928, PR #1931, PR #1933.
- Doxygen quoted-text/CDATA suppression and id-based conditional/container/skip projections are implemented. Reuse their grammar-id and no-reentry tests; do not recreate the old string membership scans.
- The C-family bare-row class now settles once per logical line through the root LOC index before physical gap accounting. A parent gap can be visited before the child tokens that determine it. Preserve current legacy timing/precomputation rather than assuming one final verdict per node visit.
- Recent C++/Mozcpp fixes distinguish parenthesized member pointers, typed macro calls, split virtual methods and trailing thread-safety annotations. The readers live in root npa/cpp_declarators.rs, cpp_first_word.rs and cpp_annotations.rs. They are metric source readings, not authoritative symbol resolution; factor only genuinely shared structural evidence into AST if needed.
- A source owner may span recovered sibling declarations, possibly with comments or preprocessor lines between the pieces. Keep ordered source pieces and explicit ambiguous candidates, not two invented method owners or an attached annotation-as-member.
- Preserve Doxygen's shortened parent-only context only for its existing questions; nearest-level/depth-aware owner queries need whole ancestry.
Unit 2 integrated (bf5282d3)
- Integrated on
feat/1654-documentationatbf5282d3(mergingfeat/1654/1671-c-family-unit2:2e28ee2cand84f3b28a). - Separates
@file/\filegatherer comments before declarations, attaches trailing enum comments after a comma, and projects single-declaration C++template_declarationandlinkage_specificationwrappers underProfile::DoxygenacrossC,Cpp,Mozcpp, andObjc. make pre-commit(BCA_GATE: pass),make bench-source(0 performance failures),anchor_check.py(manifests=71 cases=1631 problems=0), and all 5 perturbation sweeps (76/76total caught) passed.
Activity
dekobon commentedon Nov 4, 2026
Plan refreshed against current main
Updated this issue body after reviewing changes since #1654 was filed, through
07822c69211fe851c452ac6c0ebbd99cf92589a5. Relevant PRs: PR #1769, PR #1774, PR #1804.\row #1801 continuation-row gap remains open for the C family. Source/legacy baseline and mapping behavior need explicit treatment; positional records must survive unresolved masked-name links.The original source-documentation scope remains. New tests and current integration touchpoints are in the body; acceptance checkboxes remain open. This is source/history analysis, not a claim that the feature or new validation has run.
dekobon commentedon Nov 18, 2026
Updated this issue body against
91087f52f5d4a58e31ae320851351990f1436411after the November 4 review. Resolve C-family documentation using current id projections and source evidence for recovered multi-piece members, preserving existing logical-line metric precomputation.Added tests: Quoted/CDATA structural tags, valid versus unresolved explicit targets, typed macros and member pointers, split virtual methods with intervening preprocessor lines, thread-safety annotation tails, and chained comment continuation origins.
Evidence: PR #1824, PR #1835, PR #1838, PR #1856, PR #1909, PR #1928, PR #1931, PR #1933. The dated body section replaces stale implementation notes and records current source paths and prerequisite outcomes. Original extraction acceptance criteria and issue status remain open; this was source/history review, not an implementation or gate run.
dekobon commentedon Nov 23, 2026
#1646 evidence/disposition handoff for #1654: cases D1–D8. See the current ledger and reproduction packet for exact fixture bytes, source/tool versions, attachment versus publication, and reopen triggers.
D1–D8: self-contained
NS_ENUMexpansion documentsExampleOnein nested XML, but it is not the historical Apple recovery shape; the guarded-extern initial fixture agrees and the after-guard fixture differs;#elifdefis unsupported by the tested Doxygen preprocessor.These are version/configuration-qualified observations and retained legacy DLOC readings, not approval to change DLOC or substitute characterization for independent source-owner/text expectations. The adapter should explicitly disposition these cases under its existing contract. No new acceptance item is presumed complete by this comment.
dekobon commentedon Nov 23, 2026
#1646 v2 correction/verification, current ledger and reviewed evidence (SHA256
c9fa2a647da033623d333bc7ad9a420a2fe2efd4bb106adfca59f38d04d10518; supersedes the previous gist). Corrected D1–D8 controls: D2 in Mozcpp parses the valid macro terminator as the same missing-;declaration as the invalid case plus a followingalone_macro; D3 unexpanded ObjC XML hasNS_ENUM:dininbodydescription, and no standalone fixture shares historical Appleinitializer_listrecovery; D5 attachment must not be inferred from bare XML member presence, so paired INTERNAL_DOCS NO/YES controls were added; D8 now has#elif defined(X)runs with X defined and undefined (documentedf:dversus none). Legacy DLOC is unchanged; this is a disposition handoff, not an approved source fix.dekobon commentedon Nov 23, 2026
#1646 v3 final evidence correction: ledger, packet, SHA256
0373a85f863f1c1334822fccefd59e049392cb58f09de1ce3b69dfc897fa2ed2. Supersedes older evidence links. D7 correction: the trailing doc at the end ofextern "C"binds across the linkage body even without #ifdef (bca 0/1, Doxygeng:d); a namespace body is a real barrier, a flat control agrees. Reopen forlinkage_specificationtransparency in Cpp/Mozcpp, not preprocessor support. D2 has a second validDECL(x)twin (bca 0/1 all dialects vs Doxygenx:dwith expansion; C/Objc macro_type_specifier+missing;, Cpp/Mozcpp call expression+missing;). D3 unexpanded ObjCNS_ENUMputsdin function in-body XML; none of the standalone controls is the historical Appleinitializer_listrecovery shape. These are profile-qualified observations, not authorization to change legacy DLOC; keep source-owner/text expectations independent.dekobon commentedon Nov 25, 2026
Unit 1 (test-only) is integrated locally
Unit 1 pins what the production collector already does for C, C++, Mozcpp and Objective-C under the
Doxygenprofile and adds a legacy guard. It changes no production code. It is merged into the local integration branchfeat/1654-documentationas31279411b17341bf9004b19f922b00a2c8f4bab1(not pushed; the issue stays open).Commits on
feat/1654/1671-c-family-documentation:557d60b2test(documentation): pin Doxygen owners and text for the four C-family variants11f301abtest(loc): guard C-family documentation rows before owner and conditional work7967cca1test(documentation): assert the capability and the absent qualifications049b4e3amerge of the integration head that then held the Go unit (feat(ast): associate Go documentation groups with declarations #1672)What it adds: 39 tests in
big-code-analysis-ast/src/documentation/collector/c_family_tests.rs(38 cases across the four variants, each through both entry points, expectations written before the collector was observed), one root-crate test with 47 legacy LOC rows, and two perturbation manifests (22 + 2 deliberate defects).Evidence at the merged head
049b4e3amake pre-commitBCA_GATE: pass (gate=pre-commit); nextest 7,873 run, 7,873 passed, 4 skippedpython3 -B utils/perturb.py utils/documentation-c-family-unit1-perturb.jsoncaught; 200 of 200 named tests failpython3 -B utils/perturb.py utils/documentation-c-family-unit1-legacy-perturb.jsoncaughtmake check-test-lang-gates-compare COMPARE_REF=3296fd8d…OK — no test lost a buildAPPROVEin round 1 at7967cca1, and each confirmed the merge commit049b4e3aThe one merge conflict was in
src/metrics/loc/documentation_tests.rs, where this unit and the Go unit each append a test. Both tests are kept unchanged, in integration order.What an audit found before review
Every test could fail. The compared view read neither the qualification records nor the capability of the index, while two comments said the tests compare everything the index publishes. A temporary defect that gave every
@fndocument a wrongReferencerecord passed 39 of 39 tests. The third commit asserts both values and corrects the comments; the same defect now fails the@fntest of each variant.Pinned as today's answer, for later units to change (decision D4)
#if: one unresolved association with no owner.Unresolved(Conditional).Each is marked in the test as pinned, not as the design.
Carried to the next C-family unit
Not delivered by this unit
Any production change (ledger items D1 to D8), templates, linkage wrappers, macros that wrap declarations, operators, destructors, parameters, recovery shapes, fuzz seeds, bench workloads. No Doxygen or clang run was made for this unit after the evidence was prepared.
Merge branch 'feat/1654/1671-c-family-unit2' into feat/1654-documenta…
dekobon commentedon Nov 27, 2026
Unit 2 integrated (
bf5282d3)bf5282d3(treeaa3e74f6) onfeat/1654-documentation, mergingfeat/1654/1671-c-family-unit2(2e28ee2ce5ea9cbebe6a943660ab42a1d0a36ac7and84f3b28ace7639fe76819843d586b1a98c56b234).UNIT2_SPEC_R3.md(a3c80fa7d3073714f49593274186bc29bc88c6a6442d2ae3f798a6866d141ee3) +ADDENDUM_R3.md(30c939d4daa820a4da9148917c002a3e702bfb1fbbd63d759d5038d8c91527f6), unanimously approved (3 APPROVE / 0 REQUEST_CHANGESfromsol-review,fable-review,argon-review) in Implementation Code Review Round 1.@file/\filegatherer comments inRunSelection::select(streaming/markers.rs) so file-level documentation and the following declaration's leading comment each publish their own document underProfile::Doxygen(LANG::C,LANG::Cpp,LANG::Mozcpp,LANG::Objc)./**<,/*!<,///<,//!<) after an enumerator comma viaenum_comma_predecessor(collector.rs), while initializer commas uniformly retain their pending comma document without binding to the enumerator.template_declarationandlinkage_specification(extern "C") wrappers (projections.rs), keeping braced linkage blocks (extern "C" { … }) pending and preserving all legacy LOC rows unchanged.make pre-commitonbf5282d3:BCA_GATE: pass (gate=pre-commit)withmake self-scan-baseline-freshexiting 0 (0 added, 0 removed, 0 worsened, 0 improved).make bench-source:combined gate: 0 performance failures.anchor_check.py:manifests=71 cases=1631 problems=0.29/29caught, C-family Unit 2 legacy1/1caught, C-family Unit 122/22caught, C-family Unit 1 legacy2/2caught, and documentation variants22/22caught (76/76total,rc=101,missing_expected=[]).