Repository navigation
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Deep copies lose the Content-Type removal flag, while empty-name Contains and stream-after-removal behavior lack the required probe PRs and BC-backed evidence.
3 open issues
What changed in this PR
This PR updates the Rust AL runtime’s HTTP behavior for empty header-name lookups and stream writes after Content-Type removal.
Changes:
- Makes
HttpHeaders.Contains('')raiseInvalidHeader:Argumenton supported versions. - Tracks explicit Content-Type removal so stream writes preserve its absence, while retaining text-write and fresh-stream behavior.
- Adds focused regression tests and documents both behaviors as assumptions awaiting corpus probes.
| File | Description |
|---|---|
docs/probes-needed.md |
Documents the two assumptions and required probes. |
crates/al-vm/tests/host/http_headers.rs |
Tests empty-name lookups and Content-Type behavior across writes. |
crates/al-builtins/src/value.rs |
Adds state tracking explicit Content-Type removal. |
crates/al-builtins/src/http/headers.rs |
Records removal and handles empty-name Contains calls. |
crates/al-builtins/src/http/content.rs |
Distinguishes stream and text writes when restoring Content-Type. |
crates/al-builtins/src/assumptions/http-stream-write-keeps-removed-content-type.rs |
Registers the stream-write assumption. |
crates/al-builtins/src/assumptions/http-contains-empty-name.rs |
Registers the empty-name Contains assumption. |
Review effort: Balanced
StefanMaron
left a comment
There was a problem hiding this comment.
Hi Boris, thank you for this pull request. The code is small and easy to read, both changes sit in the right owner functions, and you registered both behaviors as assumptions with tests that check the flag. That is the right structure. I read the diff only; I did not build or run it.
I cannot merge it yet. The reason is our rule for new behavior: every answer the runner gives needs a test in the corpus repository that real Business Central passed, or an assumption that cites an open probe pull request on the corpus repository plus the evidence behind it. Both changes are missing that evidence today.
1. Contains('') raising InvalidHeader:Argument
- The assumption cites
AyHeaderAddResult.al:159. That case measuresAdd('', 'v')and aGetValuesafterwards. It does not measureContains. So the new answer comes from an analogy. - The analogy is not safe. The corpus has a lookup with an empty name that does not raise:
GetSecretValueswith an empty name answers false (P97HdrSecretValues.al:103-105). - Did you see this on a real Business Central? If yes, please tell me the version and the error code and text you got. That counts as evidence.
- What I need: a probe in the corpus repository (
Contains('')on request, content, response and client headers, inside a TryFunction, withGetLastErrorCodeandGetLastErrorText). The assumption text then cites that pull request. - On BC 27 the new code refuses.
mainanswers false there today. A test that ran on BC 27 would stop running. Please keep main's answer on BC 27 until a probe measures it. - The new check runs before the collection is looked at. So it can also change the answer for a header variable that was never filled, and for the headers of a secret content, which
mainrefuses (I did not run these). Please keep the existing order and put the new check after those.
2. Stream write after Remove('Content-Type')
- The cited case
P87ContentType.al:WriteAfterRemovedType(line 137) measures the text write only. It pins the half you kept, not the half you changed. No corpus case writes a stream after aRemove. - So the same question: what did you measure, and where? With your repro and a probe pull request, this can land as an assumption.
- The new flag
content_type_removedis set once and never cleared. Example:Remove('Content-Type'), thenWriteFrom('text')(the header is back), thenH.Clear(), thenWriteFrom(InStream). The flag is still set from the first step, so the header stays absent.mainputs it back, and nothing measured that sequence. - The flag is also set when the content never had a Content-Type (
Removeon fresh content, then a stream write). The fresh stream case in the corpus has noRemove, so this is a third shape nobody measured. - Please limit the new path to the exact sequence you measured (write, remove, stream write, nothing in between), clear the flag whenever the header is set again or the headers are cleared, and let every other sequence keep main's answer. Please add tests for those neighbor sequences.
HttpContent.Clearfollowed by a stream write: please check the flag does not survive it.
3. Small things
- The doc comment on
write_bodynow mixes the pinned text rule and the assumed stream rule in one sentence. Please keep them apart, so a reader sees what is pinned. - The citations name a test (
:WriteAfterRemovedType) and a folder (network/lt-ay-http/) that does not match the file's place in the corpus. We citefile:line. - All CI checks are green.
Your note about the assumptions test on Windows
You are right, and it is our bug, not yours. The helper sources() in crates/al-builtins/src/assumptions.rs keeps only paths that contain /src/. On Windows the separator is \, so the list is empty and every_entry_is_marked_somewhere reports every entry as unused. Our Windows check in CI only compiles; it does not run this test, so we never saw it. We will fix it on our side by comparing path components instead of text. You do not need to touch it in this pull request. Thank you for reporting it.
If anything here is unclear, or you want me to write the two probes, please say so.
Please measure these cases yourself on a real BC (27, 28 and 29) and bring the probe with the pull request; that is the part I can't take over for contributions.
Merge the pull request with current main for review. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve header state across copies and refuse unmeasured shapes. Record the local BC evidence until the probe is pinned. Refs aldevtools/BusinessCentral.AL.Language.Tests#1424 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The requested neutral probe is open in aldevtools/BusinessCentral.AL.Language.Tests#1424 and passed locally on BC 27.5, 28.5 and 29.1. For The runtime retains the receiver and secret-content guards. The removal flag is gone; copies use the actual header state. Unmeasured neighboring shapes keep main's behavior or refuse. The PR description records the validation results. Both PR workflows need maintainer approval. The corpus pin is pending, BC 29.0 is not claimed as measured, and the review threads remain open. |
|
Thanks for opening the probe as aldevtools/BusinessCentral.AL.Language.Tests#1424, with the observed code Before I review the code, the diff needs to get smaller. It now shows 719 files (+212,302/-105,440), including |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Hi Stefan, thanks for taking the time to look at this and for the clear feedback! You're right: the PR still shows a large unrelated diff, including oracle files. Sorry about that. I'll update the branch against current Thanks also for reviewing the probe first — I appreciate your help! |
|
Thanks, Boris. This round fixes everything from my first review, and the probe is thorough. I built the branch and One thing before I can merge: The assumption for Contains('') says it covers a "fresh" header collection. The check in headers_contains tests
I expect BC raises the same error for all of them, since the error comes from the empty name. The easiest fix is For later, no need to do it in this pull request: the version check accepts 27.5, 28.5 and 29.1 only. The corpus CI |
|
One more thing from the CI run I approved. The With that and the points from my review above, the rest of the checks are green. |
|
Thank you for this pull request, and for writing the corpus probe. I am sorry the review took 10 days. Verdict: needs a rebase on main, then changes. Conflicts: Blocking: CI is red. Job
The corpus probe pull request (corpus repo PR 1424) still needs its CI run, because you are an outside contributor and the workflow needs maintainer approval. I will handle that. If BC 29.0 matches, we add it to the al-version fact afterwards. The review flow changed on 2026-11-21. After the fixes, merge main, add the neighbor folder ( Generated by an AI agent (Claude) working for Stefan Maron. |
|
Thank you for this pull request, and sorry it waited so long without a review. I'm going to finish it on our side now, so you do not need to do anything more: we merge the current main, add the neighbor check folder the new review flow needs, review it and land it. Your commits stay in the history with your name. If you would rather finish it yourself, say so here and I'll stop. Generated by an AI agent (Claude) working for Stefan Maron. |

No linked issue.
What changed
mainand address the HTTP review feedback without rewriting the existing PR history.Evidence from real Business Central (required)
HttpHeaders.Contains('')raised codeInvalidHeader:Argumentwith textInvalid HTTP header. Please, make sure the format of the header is correct.Stream writes retained the measured existing Content-Type state.Where the behavior is pinned
http-contains-empty-namecites the probe attests/al-language/http/HttpHeaders.al:518and:545;http-stream-write-keeps-removed-content-typecitestests/al-language/http/content/HttpContent.al:717and the following probe cases.http/headers/P87ContentStream.al:45,queries/joins-links/HttpWriteFromStream.al:113andxml/xml/P97ContentSecret.al:169.Shapes that keep today's behavior
The HTTP host regressions cover receiver and secret-content guards, text and fresh-stream writes, header clear, content clear, copies, re-added Content-Type and unmeasured versions or stream states. Existing BC 27 behavior remains for unmeasured BC 27 minors; unmeasured new behavior on later versions is refused. The pinned secret-to-stream case passes on all configured oracle versions.
Checks
al-test-cli --root . --baseline-diff: no regression; stale lines deleted (--prune-not-passing) (or: not run, and why)./check.sh(or: not run, and why)Validation:
cargo build --offline --locked --release -p al-test-cli -j 1— passed.cargo test --offline --locked -p al-builtins -j 1 -- --skip two_branches_that_change_the_registry_merge_cleanly— passed; the skipped Windows shell fixture invokesgit add -Aand disables commit signing, which this project's agent workflow prohibits.cargo test --offline --locked -p al-vm --test host -j 1 -- http_headers— passed; the new version-boundary regressions were red before their fixes and green afterward.cargo test --offline --locked -p al-test-cli --test fn_length_ratchet --test file_size_ratchet --test os_access_ratchet -j 1— passed.cargo clippy --offline --locked -p al-builtins -p al-vm --all-targets -j 1 -- -D warnings— passed.cargo fmt --all -- --checkandgit diff --check— passed..\target\release\al-test-cli.exe --root . --assumptions-doc— passed; the table is current..\target\release\al-test-cli.exe --root . --no-download --bc-version $v --file P97ContentSecret.al --explain Secret_WriteFromInStream— passed for$v27, 28 and 29..\target\release\al-test-cli.exe --root . --no-download --bc-version $v --baseline-diff --prune-not-passing --junit $xml— ran for$v27, 28 and 29 with$xmla session-local output file and a locally built compatible .NET sidecar. Each exited 1 on existing Windows baseline discrepancies. A release build of unmodifiedmainreproduced the affected results; JUnit outcomes and messages for those cases match the final branch. No HTTP regressions, missing outcomes or stale list entries were reported../check.shand a full workspace test were not run locally, per the project's PR-CI workflow.action_required).