You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 24fdb9b
Browse filesBrowse the repository at this point in the historyBrowse files
## Why?
## What does this PR do?
## Related issues
#3987
## AI Contribution Checklist
- [ ] Substantial AI assistance was used in this PR: `yes` / `no`
- [ ] If `yes`, I included a completed [AI Contribution
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
in this PR description and the required `AI Usage Disclosure`.
- [ ] If `yes`, my PR description includes the required `ai_review`
summary and screenshot evidence or equivalent persisted links of the
final clean AI review results from both fresh reviewers described in
`AI_POLICY.md`, the Fory-guided reviewer and the independent general
reviewer, on the current PR diff or current HEAD after the latest code
changes.
## Does this PR introduce any user-facing change?
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
---------
Co-authored-by: Release Validation Test <dev@fory.apache.org>
Copy file name to clipboardExpand all lines: .agents/languages/cpp.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,11 @@ Load this file when changing `cpp/`, Cython build plumbing, or C++ xlang behavio
13
13
- When invoking a method that returns `Result`, use `FORY_TRY` unless you are in control-flow logic that cannot use it cleanly.
14
14
- Wrap error checks with `FORY_PREDICT_FALSE` for branch prediction.
15
15
- Continue on trivial errors; return early only for critical errors such as buffer overflow.
16
-
-`ReadContext` and related codec owners intentionally accumulate non-critical
17
-
errors and inspect them at established serializer or root safepoints. Bounds-safe
18
-
work may continue after an error is recorded. Do not add eager per-field checks,
19
-
cursor rollback, or tests that pin the first detection point unless deferral can
20
-
cause out-of-bounds access, undefined behavior, resource amplification, state
21
-
pollution, or success past the required safepoint.
16
+
-`ReadContext` intentionally records codec errors for inspection at existing serializer or root
17
+
safepoints. After an error, work may continue only while it remains bounds-safe and cannot cause
18
+
resource amplification, publish reference or cache state that survives root cleanup, or return
19
+
success past the required safepoint. Do not add per-field checks, cursor rollback, or tests that
20
+
pin the first detection point solely to make an error earlier or more precise.
22
21
- Put private methods last in class definitions, immediately before private fields.
23
22
- Do not redesign alias-based or low-level public type shapes to add convenience methods unless the user explicitly asks for that API change.
24
23
- For cross-language feature ports, match protocol behavior but use idiomatic C++ ownership and layering instead of mirroring Java structure literally.
Copy file name to clipboardExpand all lines: AGENTS.md
+15-35Lines changed: 15 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,13 @@ This is the entry point for AI guidance in Apache Fory. Read this file first, th
32
32
- Preserve architecture. Do not introduce new layers, parallel flows, or public APIs unless explicitly requested; prefer local repair in the existing owner over shared-infra expansion, and stop if a fix conflicts with an ADR, spec, or invariant.
33
33
- Do not change an existing `RefReader`/`RefWriter` architecture or API to support compatible skip. Compatible skip must not add alternate reference slots or tables, alternate reference lookup or publication methods, or forwarding APIs in read/write contexts, builders, serializers, or generated-code plumbing. Keep ordinary reference publication and lookup unchanged and resolve the case in the existing compatible generated owner. For an authorized removed-field read of an unregistered Struct, the empty object created by the skip reader is that path's final owner: publish that same object for `RefValue`, consume the Struct fields, and let later `RefFlag` values resolve to it. This preserves reference numbering and identity without registering the Struct; an independent dynamic root still requires normal registration. Do not add parallel reference state, a sentinel, a rejection, or a common-path branch for this case.
34
34
- Respect ownership. Keep logic, state, and helpers in their natural owner, and do not move serializer-local, context-local, runtime-type-local, or protocol-local problems into global utilities.
35
+
- Low-level APIs explicitly named `unsafe` or `unchecked` may be public and may omit local bounds or
36
+
capacity checks. Their callers own the proof required by the operation. Do not hide these APIs
solely to prevent misuse; add validation only at the caller or owner that lacks the required proof.
39
+
- Keep hardening changes causal. A shared wire defect may require aligned runtime fixes, but it does
40
+
not justify unrelated buffer checks, performance rewrites, or cleanup without their own concrete
41
+
consequence and evidence.
35
42
- Check the spec before implementation. For wire behavior and xlang mapping, use the specs as the source of truth and never copy one runtime's bug into another runtime just to make tests pass.
36
43
-`foryc` is a build-time compiler for trusted schema inputs and is never invoked by runtime serialization or deserialization. Schema provenance, package/namespace options, output-path options, and generated-source review belong to the application or build owner. Do not classify hostile-schema source injection or path traversal as a Fory runtime security vulnerability; `foryc` does not promise to sandbox untrusted schemas.
37
44
- Row format accepts only trusted input and is outside Fory's untrusted binary-deserialization security boundary. Rust `check_string_read(false)` is likewise an explicit trusted-input mode that disables UTF-8 validation; its caller owns the validity guarantee. Classify issues in those paths as correctness, soundness, or hardening bugs when applicable, not as attacker-controlled deserialization vulnerabilities under the default security model.
@@ -40,25 +47,13 @@ This is the entry point for AI guidance in Apache Fory. Read this file first, th
40
47
- Malformed input must surface as a controlled root-operation error and still run
41
48
root cleanup, but the exact exception type, error code, message, detection
42
49
layer, and detection point are not contracts unless a public API or
43
-
specification explicitly says otherwise. An existing bounded downstream
44
-
buffer, type, reference, depth, or serializer error is sufficient. Do not add
50
+
specification explicitly says otherwise. Differences only in error type,
51
+
message, layer, offset, or detection point are not security findings. An
52
+
existing bounded downstream buffer, type, reference, depth, or serializer
53
+
error is sufficient. Do not add
45
54
hot-path branches, helper APIs, allocations, or generated-code expansion
46
55
solely to make an error earlier, more specific, or more uniform, and do not
errors are not security findings. Security remediation must not add checks solely to normalize,
50
-
sharpen, advance, or otherwise make such errors deterministic. Security tests must not require a
51
-
particular error type, message, layer, offset, or detection point unless an explicit public
52
-
contract makes that precision part of the policy boundary.
53
-
- Runtimes with an established lazy-error accumulator, including C++ and Go,
54
-
may keep executing bounds-safe codec work after recording an error and inspect
55
-
it at an existing serializer or root-operation safepoint. Deferred inspection
56
-
is an intentional hot-path design, not by itself a correctness or security
57
-
defect. Do not add per-field or per-element error branches, cursor rollback,
58
-
or tests that require immediate propagation solely because an earlier check is
59
-
possible. Treat the behavior as a defect only when the deferred path has a
60
-
concrete consequence listed below or an established safepoint can return
61
-
success instead of a controlled root error.
62
57
- Never add a reader-side check solely to produce a more precise malformed-input
63
58
error. Retain or add a check only when the unchecked path has a concrete
64
59
consequence such as a crash, panic, undefined behavior, out-of-bounds access,
@@ -69,15 +64,6 @@ This is the entry point for AI guidance in Apache Fory. Read this file first, th
69
64
helper when the language supports it. A bounds-safe downstream operation that
70
65
already raises a controlled root error is sufficient; do not duplicate it for
71
66
error precision.
72
-
- Buffer and memory-buffer checks require a stricter consequence test. Security remediation may add
73
-
a check only when its absence can cause a process crash or panic, undefined memory access, OOM, or
74
-
attacker-controlled memory amplification. Delayed, masked, less precise, or differently typed
75
-
errors are not sufficient reasons. Neither is an incorrect decoded result when the unchecked
76
-
path cannot cause one of those crash or memory consequences. A downstream bounds owner that
77
-
already fails in a controlled way is sufficient; do not duplicate its check in a hotter wrapper.
78
-
Apply this admission rule prospectively: do not remove an already completed and validated check
79
-
solely by reclassifying it when it has no demonstrated performance cost. Preserve that check as
80
-
a correctness fix unless an explicit task requires the behavioral rollback.
81
67
- Before reporting or fixing a robustness finding, prove that the current path
82
68
causes at least one concrete consequence: crash, panic, undefined behavior,
83
69
or out-of-bounds access; disproportionate allocation, CPU work, or stream
@@ -88,16 +74,6 @@ This is the entry point for AI guidance in Apache Fory. Read this file first, th
88
74
malformed or noncanonical flag, enum value, marker, length form, or reserved
89
75
value is accepted, rejected late, decoded differently, or produces a less
90
76
precise error.
91
-
- Keep security remediation scope frozen. Do not fix a standalone non-security
92
-
correctness, interoperability, API, or lifecycle issue merely because it is
93
-
discovered during security work. Include an adjacent non-security change only
94
-
when omitting it would leave the security fix incomplete or force the same
95
-
owner into an ugly, duplicated, or knowingly unsound design; otherwise record
96
-
the issue separately and leave production code unchanged. This rule prevents
97
-
new scope; it does not authorize rolling back a non-security fix that is
98
-
already implemented and validated. Preserve such fixes. If one may affect
99
-
performance, inspect and measure the affected path first, then optimize it on
100
-
evidence instead of removing it by classification.
101
77
- Arbitrary-precision binary Decimal codecs accept only scales in
102
78
`[-10_000, 10_000]` and an absolute unscaled magnitude of at most `10_000`
103
79
binary bytes. The Java standalone `BigInteger` serializer uses the same
@@ -226,6 +202,10 @@ This is the entry point for AI guidance in Apache Fory. Read this file first, th
226
202
- Do not make design tradeoffs the user did not request. If a refactor appears to require a behavior, logic, protocol, or performance tradeoff, stop and ask.
227
203
- Treat existing low-level or optimized code as deliberate by default. During a refactor, preserve the current implementation strategy unless the user explicitly asks to redesign or optimize it.
228
204
- Do not replace existing C, C++, Cython, unsafe, or other low-level optimized paths with simpler high-level implementations just to make a refactor easier.
205
+
- When removing a redundant wrapper or helper, preserve any aggregate capacity proof, fused
206
+
operation, reserved wide store, specialized overload, or unchecked primitive path in the natural
207
+
owner. Do not route that work through a generic checked path unless matched benchmarks justify the
208
+
implementation change.
229
209
- If a refactor accidentally changes logic or implementation strategy, revert that part and re-implement the refactor around the existing logic.
230
210
- Use English only in code, comments, and documentation.
231
211
- Do not use emoji in documentation, including headings, feature lists, status
0 commit comments