Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/instructions/abacus-governance.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Apply these instructions when reviewing or changing ABACUS code:
Prefer explicit dependencies or narrow local interfaces.
- Flag new default arguments in existing header interfaces. Prefer explicit
call-site updates, overloads, or a clearer configuration object.
- Review header include growth and `.hpp` propagation carefully. These are
usually warnings unless the PR records a narrow reason.
- Review header include growth and `.hpp` propagation carefully. Do not ask
authors to replace explicit `#include` directives with forward declarations
solely to avoid header include warnings.
- Require LF line endings for text files. `.bat` and `.cmd` files are the CRLF
exceptions.
- Flag new `#pragma once` in header files as a blocker-level governance issue.
Expand Down
8 changes: 5 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ rules. Read the complete governance document before making or reviewing changes:
explain the remaining global usage.
2. Do not hide workflow switches in mutable member variables that can be
changed from multiple places.
3. Keep header dependencies minimal.
3. Keep header dependencies clean and explicit; avoid unnecessary includes,
and do not replace `#include` directives with forward declarations just to
avoid header include warnings.
4. Avoid adding `.hpp` implementation headers or propagating them through
other headers unless there is a narrow reason.
5. Do not add default arguments to existing interfaces; update call sites or
Expand Down Expand Up @@ -230,7 +232,7 @@ full mixed-line-ending hook only for intentional repository-wide normalization.

- Confirm the PR body states exact commands run, whether they passed or failed,
and why any expected check could not be run.
- Keep warning rationales concrete. For example, a header include warning can be
acceptable when the header owns a value member that requires the complete type.
- Keep warning rationales concrete. For example, a header include warning is
acceptable when the header uses types declared in that header directly.
- Keep historical-debt notes separate from new deterministic errors introduced
by the PR.
10 changes: 6 additions & 4 deletions docs/developers_guide/agent_governance.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ focused cleanup.
`PARAM`. Prefer explicit parameters or narrow local interfaces.
- Do not store workflow switches in mutable member variables that can be changed
implicitly from multiple places.
- Keep header dependencies minimal; avoid adding includes to headers unless the
declaration truly requires them.
- Keep header dependencies clean and explicit; avoid unnecessary includes in
headers, and do not replace `#include` directives with forward declarations
just to silence header include warnings.
- Avoid adding `.hpp` implementation headers and avoid including `.hpp` files
from other headers unless the PR explains why header-only implementation is
needed.
Expand Down Expand Up @@ -122,8 +123,9 @@ Deterministic errors require a code or documentation fix before merge unless a
maintainer-approved exception is recorded. Deterministic warnings require a
reviewable rationale or cleanup, but they do not become blockers without an
explicit governance change. For header include warnings, the rationale should
state whether the header needs a complete type, for example because it owns a
value member rather than a pointer or reference.
confirm that the included header is actually used and does not introduce
unnecessary or circular dependencies; explicit `#include` directives are
preferred over replacing them with forward declarations.

For global dependencies, the mechanical checker uses a PR-level budget during
the legacy migration period. A PR blocks only when the number of code references
Expand Down
2 changes: 1 addition & 1 deletion tools/03_code_analysis/agent_governance_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def check_header_include_warnings(findings: List[Finding], lines: Iterable[DiffL
line.path,
line.line,
"Header diff adds an include dependency.",
"Confirm the declaration requires this include; prefer forward declarations where practical.",
"Confirm this include is needed by the header and does not introduce unnecessary or cyclic dependencies.",
)


Expand Down
1 change: 1 addition & 0 deletions tools/03_code_analysis/test_agent_governance_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ def test_warns_for_new_header_include(self):
result = self.run_checker("--base", self.base, "--head", head)

self.assert_warns_with_success(result, "Header dependency review")
self.assertNotIn("forward declaration", result.stdout.lower())
Comment thread
mohanchen marked this conversation as resolved.
Resolved

def test_merge_base_scoped_comparison_excludes_base_branch_only_changes(self):
self.write("source/source_base/api.h", "void update_solver(int step = 0);\n")
Expand Down
Loading