Skip to content

test(conformance): execd file API conformance profile harness - #2774

Open
yjjnls wants to merge 8 commits into
opensandbox-group:mainfrom
yjjnls:test/execd-file-api-boundaries
Open

yjjnls wants to merge 8 commits into
opensandbox-group:mainfrom
yjjnls:test/execd-file-api-boundaries

Conversation

@yjjnls

@yjjnls yjjnls commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Conformance profile harness for the documented behavior claims, per the format proposed in #2926; the first profile covers the execd file API. Extends #2773. This PR was previously a draft of boundary test samples; #2926 provides the normative piece they needed, so it now contains the full harness: format documentation, the first profile, a checker, and CI wiring.

Profile format and first profile

  • specs/conformance/README.md documents the format: fields, claim statuses, test mapping rules, and the promotion workflow. Profiles are an internal claim index for the reference implementation's documented behavior; no certification, no capability negotiation, no change to the compatibility page's stance.
  • specs/conformance/profiles/execd-file-api.yaml is the first profile, seven claims for the file upload and info surface:
Claim Behavior Status
FILE-PATH-ENV-001 A path referencing an undefined environment variable is rejected with the variables named and no disk side effects. enforced
FILE-UPLOAD-SETUID-002 Replacing a file through the API keeps the destination's setuid bit; no staging file left behind. enforced
FILE-UPLOAD-MODE-003 An explicit metadata mode wins over the destination's previous mode. enforced
FILE-UPLOAD-MODE-004 An omitted mode follows creat(2)'s 0644 default. pending #2661
FILE-UPLOAD-MODE-005 Special bits from an octal metadata mode reach the file. pending #2445
FILE-INFO-BTIME-006 created_at uses birth time only while the captured inode still matches; ctime fallback otherwise. enforced (tests merged with #2612)
FILE-INFO-BTIME-007 A symlink entry reports the link's own birth time. enforced (tests merged with #2612)

Checker

scripts/conformance/run_profile.py (run with uv run, inline dependencies like specs/tests/test_execd_schema.py):

  1. validates the profile structure and resolves every file.go::TestName reference statically;
  2. runs the mapped Go tests with go test -json -count=1 -run in the owning module;
  3. enforces the status rules: an enforced claim must pass (failure, skip, or missing test is a violation), and a pending claim may be skipped, but a passing pending test is a stale-profile violation asking for promotion, so a skip cannot outlive the PR it references.

Violations print the claim id and clause, so a regression report points back to the normative sentence instead of just a test name.

CI wiring

  • execd-test.yml gains a step running the profile (Go is already set up there) and a step running specs/tests/test_execd_schema.py, which no workflow currently invoked.
  • detect-changes.yml triggers the execd workflow for specs/conformance/** and scripts/conformance/**, and stops treating specs/conformance/ as an SDK trigger.

Test changes

Verification

  • gofmt and go vet clean; the full controller test suite passes locally.
  • uv run scripts/conformance/run_profile.py specs/conformance/profiles/execd-file-api.yaml: the five enforced claims pass and the two pending claims skip as expected.
  • Negative paths exercised by hand: a stale pending claim, an enforced claim backed by a skipped test, and a dangling test reference each fail with the claim id (exit codes 1 and 2 respectively).
  • uv run specs/tests/test_execd_schema.py passes.

Out of scope

@github-actions github-actions Bot added component/execd size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 11, 2026
@yjjnls
yjjnls force-pushed the test/execd-file-api-boundaries branch from 293f87b to acfbd49 Compare November 18, 2026 15:14
@github-actions github-actions Bot added documentation Improvements or additions to documentation size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 18, 2026
@yjjnls yjjnls changed the title test(execd): boundary-condition test samples for the file API surface test(conformance): execd file API conformance profile harness Nov 18, 2026
@yjjnls
yjjnls marked this pull request as ready for review November 18, 2026 15:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T16:40:49.032169Z d251161 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acfbd49b43

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


- name: Run contract schema tests
run: |
uv run specs/tests/test_execd_schema.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Trigger schema checks for schema-only changes

When a PR changes only specs/execd-api.yaml (or the schema test itself), the execd matcher in .github/workflows/detect-changes.yml lines 116-122 stays false, while a repo-wide search confirms sdk-tests.yml never invokes this script. Consequently this newly added check is skipped for the very inputs it validates, so an invalid RunCommand schema can pass CI; include those paths in the execd matcher or run the test in the SDK workflow.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3d89963: the execd matcher now includes specs/execd-api.yaml and specs/tests/, so a schema-only change runs the contract schema test (and the conformance profile, whose contract references the same file).

Comment thread .github/workflows/execd-test.yml Outdated

- name: Run conformance profiles
run: |
uv run scripts/conformance/run_profile.py specs/conformance/profiles/execd-file-api.yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run every conformance profile in CI

When a second specs/conformance/profiles/*.yaml file is added as the new README explicitly permits, change detection starts the execd job but this hard-coded invocation still checks only execd-file-api.yaml. A malformed or failing new profile can therefore merge green despite specs/conformance/README.md saying CI runs every profile; discover or iterate over the profile directory instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3d89963: the workflow runs run_profile.py --all, which discovers every specs/conformance/profiles/*.yaml; a newly added profile is checked without further workflow edits. The README documents the flag.

Comment thread scripts/conformance/run_profile.py Outdated
Comment on lines +285 to +287
elif action == "skip":
if claim.status == "enforced":
violations.append(f"{label}: enforced claim is skipped")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject pending skips after their references close

If PR #2661 or #2445 lands without editing these samples, both tests still execute their unconditional t.Skip, and this branch accepts skip for every pending claim without checking whether pending_ref is still open. The checker will keep reporting all claims hold indefinitely, contrary to the documented promise that landing the referenced change makes a stale pending claim fail; either verify reference state or change the pending-test protocol so implementation arrival is observable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3d89963, using the second option you suggested: the pending protocol is now observable. The two pending tests are probes instead of unconditional skips — they exercise the upload and skip only while the observed mode still equals main's pre-change behavior. Once the referenced PR lands, the same tests pass, and the checker's stale-pending rule fails the claim even though the landing PR never touches the test. specs/conformance/README.md now states the probe requirement so future profiles cannot regress to unconditional skips.

require.GreaterOrEqual(t, rec.Code, http.StatusBadRequest, "an undefined env var in the path must be rejected")
var resp model.ErrorResponse
require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &resp))
require.Contains(t, resp.Message, "undefined environment variables")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert the undefined variable's name

The mapped FILE-PATH-ENV-001 clause requires the error message to name the undefined variable, but this assertion only checks the generic prefix. If ExpandPath regresses to path references undefined environment variables without appending OSB_FILE_API_BOUNDARY_UNDEFINED_VAR, this conformance test still passes, so assert the variable name as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3d89963: the test now also asserts OSB_FILE_API_BOUNDARY_UNDEFINED_VAR in the error message, so a regression that keeps only the generic prefix fails the claim.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Round 1 (codex) findings are addressed in 3d89963:

  • The schema check now runs for schema-only changes: the execd matcher includes specs/execd-api.yaml and specs/tests/ (the contract schema test and the conformance profile both live there or reference it).
  • The conformance step runs run_profile.py --all, discovering every profile under specs/conformance/profiles/, so new profiles are gated without workflow edits.
  • Pending claims are now observable: the two pending boundary tests probe the operation and skip only while the observed mode still matches main's pre-change behavior. If the referenced PR lands, they pass and the checker fails the stale claim for promotion, even though the landing PR never touches the test. The format README states the probe requirement.
  • The FILE-PATH-ENV-001 test asserts the undefined variable name in the error message, not just the generic prefix.

Verification on 3d89963: gofmt/go vet clean, full controller suite passes, uv run scripts/conformance/run_profile.py --all reports 5 enforced passes and 2 expected pending skips, and the negative paths (stale pending pass, enforced claim backed by a skipped test, dangling test reference) still exit 1/1/2 with claim ids.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d8996399f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +163 to +165
if info.Mode()&os.ModeSetuid != 0 {
return
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert every promised special bit before passing

If #2445 adds only setuid handling, this branch returns and the runner reports FILE-UPLOAD-MODE-005 stale even though that claim also requires setgid and sticky bits. The request is only 4755 and the test never checks os.ModeSetgid or os.ModeSticky, so promoting the claim would let those requirements remain broken; request and assert every promised special bit before allowing the probe to pass.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 542a232: the probe now uploads mode 7755 and requires setuid, setgid, and sticky together, with a filesystem sanity guard that skips only when the filesystem cannot keep those bits. The claim clause now uses 7755 as its example.

Comment thread scripts/conformance/run_profile.py Outdated
if claim.status == "pending":
violations.append(
f"{label}: claim is pending ({claim.pending_ref}) but the test now passes; "
"promote the claim to enforced, remove the skip, and bump metadata.version"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Convert pending probes to assertions on promotion

With the new probe structure, when either pending probe starts passing, following this violation text literally makes its promoted test non-enforcing: deleting only t.Skip leaves TestUploadRequestedModeAppliesSpecialBits accepting missing setuid after its 0755 assertion, and leaves TestUploadOmittedModeForNewFileFollowsCreatDefault accepting the old 0755 mode. A later regression then passes an enforced claim, so require replacing the old-state branch with a new-state assertion (or retaining the skip for enforced-status rejection) rather than instructing callers merely to remove it.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 542a232: both probes document the enforced assertion next to their skip, and the stale-pending message now says to replace the probe's branch with that assertion rather than merely delete t.Skip. The README states the same and explains why deleting only the skip would leave a non-enforcing test.

Comment on lines +120 to +123
path.startsWith("specs/conformance/") ||
path.startsWith("specs/tests/") ||
path === "specs/execd-api.yaml" ||
path.startsWith("scripts/conformance/") ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Trigger validation when contract documents move

Beyond the schema paths added in the follow-up, the profile now has a contract reference to docs/api/implementation-compatibility.md; deleting or renaming that file in a PR matches none of the checked execd paths here, and .github/workflows/deploy-docs-pages.yml:3-7 is push-only. Because run_profile.py is what rejects missing contract references, such a docs-only PR can merge a dangling profile without validation; match the referenced document (and future contract sources) or run reference validation for docs PRs.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 542a232: docs/api/implementation-compatibility.md is now part of the execd matcher, so renaming or deleting a referenced contract document runs the reference validation that rejects dangling profile contracts.

Comment thread scripts/conformance/run_profile.py Outdated
for test in claim.tests:
key = (str(test.module_root), test.package_pattern, test.name)
action = results.get(key)
label = f"{claim.id} ({test.name})"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Include the clause in conformance violations

Whenever an enforced test fails or skips, or a pending test starts passing, every violation is built from this label, which contains only the claim ID and test name; print_report also omits claim.clause. The resulting CI error therefore contradicts specs/conformance/README.md:85 and does not point at the normative sentence as promised, so include the clause in emitted violations.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 542a232: every violation now appends clause: <claim clause> under the claim id and test name, so the CI error quotes the normative sentence as promised.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Round 2 (codex) findings are addressed in 542a232:

  • The special-bits probe now uploads mode 7755 and requires setuid, setgid, and sticky together (plus a filesystem sanity guard), so a partial implementation cannot pass the claim; the claim clause now uses 7755 as its example.
  • Promotion is mechanical: both probes document the enforced assertion beside their skip, the checker's stale-pending message says to replace the probe branch with that assertion (not just delete the skip), and the README spells out why deleting only the skip would leave a non-enforcing test.
  • Violations now quote the claim clause, so CI failures point at the normative sentence.
  • The execd matcher also triggers on docs/api/implementation-compatibility.md, so a rename or deletion of a referenced contract document runs the profile reference validation.

Verification on 542a232: gofmt/go vet clean; full controller suite passes; uv run scripts/conformance/run_profile.py --all reports 5 enforced passes and 2 expected pending skips; the stale-pending negative path still exits 1 with the clause quoted.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 542a232cb2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/conformance/run_profile.py Outdated
action = event.get("Action")
if not isinstance(test_name, str) or not isinstance(action, str):
continue
if not test_name or "/" in test_name or action not in {"pass", "fail", "skip"}:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate skipped subtests to mapped claims

Under the repository's Go 1.25, a mapped parent whose only child calls t.Skip emits skip for TestClaim/case and pass for TestClaim (go help testflag documents slash-delimited test identifiers). This filter discards the child event, so evaluate sees an enforced claim as passing even though its only assertion never ran, contrary to specs/conformance/README.md:58-61; propagate descendant skips to the mapped parent or reject them.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5ac8c03: descendant skip/fail results are propagated to the mapped root test, so an enforced claim cannot pass while its assertions only skipped. Verified with a scratch parent test whose only subtest skips: the checker reports "enforced claim is skipped".

continue
test_name = event.get("Test")
action = event.get("Action")
if not isinstance(test_name, str) or not isinstance(action, str):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject failed Go package results

go doc cmd/test2json states that overall-package events omit Test; if a mapped test passes and a TestMain teardown then exits nonzero, the stream contains a test pass followed by a package fail and completed.returncode == 1. This branch discards that package event, and run_tests never checks the return code, so the checker reports all claims hold for a failed Go invocation; treat a nonzero package/process result as an error.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5ac8c03: a nonzero go test return code without a mapped test failure now fails the run with the package diagnostic; a mapped failing test still reports as a claim violation (exit 1) rather than an environment error.

Comment thread scripts/conformance/run_profile.py Outdated
for entry in contract:
if not isinstance(entry, str) or not entry:
fail("every contract entry must be a non-empty string")
if not (repo_root / entry).is_file():

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep contract references inside the repository

When a profile supplies /etc/passwd or a ../../... path, Path discards or traverses repo_root and this check accepts the host file (I verified --check-only reports such a profile valid), even though specs/conformance/README.md:48 requires repository-relative contract sources. That makes validation machine-dependent and permits references outside the reviewed source tree; resolve each path and reject anything not relative to repo_root before checking existence.

AGENTS.md reference: AGENTS.md:L118-L118

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5ac8c03: contract entries are resolved and must stay inside the repository; /etc/passwd and traversal now fail --check-only with "contract reference escapes the repository".

Comment thread specs/conformance/README.md Outdated

A conformance profile is a machine-readable index of documented behavior claims. Each claim states one observable behavior in reviewable prose and points at the test that enforces it, so the promise and its executable form cannot drift apart silently.

Profiles are internal to this repository's test process. They do not define a new wire contract, a formal v1 conformance profile, certification, or capability negotiation; [Implementation compatibility](../api/implementation-compatibility.md) remains the document that scopes those topics, and the OpenAPI files under [`specs/`](../) remain the wire contracts. A profile interprets promises the project already documents and links them to tests of the reference implementation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Point compatibility links at the docs tree

A repo-wide rg shows this document exists only at docs/api/implementation-compatibility.md; from specs/conformance/, the current target resolves to nonexistent specs/api/implementation-compatibility.md, so this link and its duplicate on line 70 both 404. Point both links at ../../docs/api/implementation-compatibility.md.

AGENTS.md reference: AGENTS.md:L83-L83

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5ac8c03: both links now point at ../../docs/api/implementation-compatibility.md and resolve to the existing docs page.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Round 3 (codex) findings are addressed in 5ac8c03:

  • Subtest results propagate to the mapped root test, so an enforced claim cannot pass while its assertions skipped.
  • A nonzero go test exit without a mapped test failure (TestMain teardown, package error) now fails the run instead of reporting success; a mapped failing test still reports as a claim violation.
  • Contract references are resolved and must stay inside the repository; absolute paths and traversal fail validation.
  • The conformance README's compatibility links point at the docs tree.

Verification on 5ac8c03: --all green (5 enforced pass, 2 expected pending skips); scratch fixtures confirm skipped-subtest propagation, mapped-failure reporting (exit 1), and contract-escape rejection (exit 2); full controller suite, gofmt, and go vet clean.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ac8c032b6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


- id: FILE-UPLOAD-MODE-003
clause: >-
An explicit mode in upload metadata is applied to the uploaded file,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover mode zero before declaring explicit modes enforced

When a caller explicitly sends "mode": 0 while replacing (for example) a 0600 file, ChmodFile skips chmod at components/execd/pkg/web/controller/utils.go:66-75, so the old mode remains; FileMetadata.mode in specs/execd-api.yaml:2870-2873 has no nonzero restriction. The mapped test sends only 644, so the checker reports this enforced clause as conformant even though a valid explicit mode does not win; add a 000 case or narrow/validate the contract.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d251161: FILE-UPLOAD-MODE-003 now covers explicit non-zero modes. Mode 0 is the omitted-mode sentinel in the request model, so the claim no longer over-claims; the test comment states the sentinel scope.

// require.Equal on 0644, so the enforced form asserts the default instead of
// accepting the old mode.
func TestUploadOmittedModeForNewFileFollowsCreatDefault(t *testing.T) {
withPinnedUmask(t, 0o022)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise a second umask before promoting the claim

With an implementation that hard-codes 0644, this probe takes its success branch under the sole pinned umask 022 and becomes eligible for promotion, even though FILE-UPLOAD-MODE-004 promises 0666 shaped by the process umask; under umask 077 the required result is 0600. Exercise at least one additional umask before promotion so the enforced test covers the claim rather than only its 022 example.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d251161: the probe now checks two umasks (022 -> 0644, 077 -> 0600) and skips with both observations while they still match main's 0755/0700. A hard-coded 0644 implementation cannot pass, and the documented promotion asserts both wanted modes.

Comment on lines +12 to +13
- docs/api/implementation-compatibility.md
- specs/execd-api.yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reference the documents that define the claims

These references do not contain several detailed semantics indexed below: the birth-time/fallback behavior is documented at docs/api/index.md:157, and upload setuid preservation at docs/architecture/data-plane/execd.md:111. Because neither actual source is listed here or matched by the execd detector in .github/workflows/detect-changes.yml:116-125, renaming or deleting one skips the runner's reference validation and leaves the profile pointing only at documents that do not state its clauses; list and watch the actual sources (or move the statements into the listed contracts).

AGENTS.md reference: AGENTS.md:L118-L118

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d251161: the profile's contract list now references docs/api/index.md (created_at birth-time and fallback semantics) and docs/architecture/data-plane/execd.md (upload mode preservation), and the execd matcher watches both paths, so renaming or deleting the real sources runs the reference validation.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Round 4 (codex) findings are addressed in d251161:

  • FILE-UPLOAD-MODE-003 is scoped to explicit non-zero modes; mode 0 is the omitted-mode sentinel in the request model, so the claim no longer over-claims.
  • The omitted-mode probe checks two umasks (022 -> 0644, 077 -> 0600) and reports both observations while pending, so a hard-coded 0644 cannot satisfy the claim and promotion asserts both wanted modes.
  • The profile's contract list now references docs/api/index.md and docs/architecture/data-plane/execd.md, the documents that actually state the created_at and upload-mode semantics, and the execd matcher watches both.

Verification on d251161: --all green (5 enforced pass, 2 pending skips with both umask observations listed); full controller suite, gofmt, go vet clean.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d251161b9d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +28 to +30
Replacing an existing file through the file upload API preserves the
destination's setuid bit, and a successful upload leaves no staging file
in the destination directory.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit setuid preservation to uploads without a mode override

When an upload replaces a setuid destination while metadata also supplies mode: 644, processUploadPair calls applyUploadPermission after staging, so ChmodFile clears setuid; the mapped test omits mode and never exercises that branch. This unconditional preservation clause is therefore false and conflicts with FILE-UPLOAD-MODE-003's promise that an explicit mode wins, although the checker marks both claims enforced; qualify this claim to uploads without an explicit mode or test and implement the intended precedence.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Comment on lines +37 to +39
An explicit, non-zero mode in upload metadata is applied to the uploaded
file, winning over the destination's previous mode when an existing file
is replaced.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude special-bit modes from the enforced ordinary-mode claim

For an explicit mode such as 7755, this same profile marks special-bit handling pending in FILE-UPLOAD-MODE-005 and the current ChmodFile drops those bits, but 7755 is also a non-zero explicit mode covered by this enforced sentence. Because the mapped test sends only 644, the runner reports FILE-UPLOAD-MODE-003 passing even though a covered request violates it; scope this claim to ordinary permission bits while special-bit support remains pending.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Comment on lines +56 to +57
Setuid, setgid, and sticky bits carried in an octal metadata mode (for
example 7755) reach the created or replaced file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise replacement before promoting special-bit support

If PR #2445 implements special-bit decoding only for newly created files, TestUploadRequestedModeAppliesSpecialBits passes because its target does not exist before upload, and the checker then demands promotion even though this clause also promises the behavior for replaced files. Add an existing-destination case to the probe before allowing it to pass, or narrow the clause to creation.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Comment on lines +65 to +68
created_at reports the file's birth time while the path still resolves to
the captured inode, and falls back to the captured inode's ctime when the
directory entry was replaced, never mixing another inode's birth time
into the result.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope birth-time conformance claims to Linux

On any non-Linux build, getFileCreateTime in syscall_others.go returns time.Now(), and both mapped tests live in a //go:build linux file, while docs/api/index.md explicitly introduces this behavior with “On Linux.” Leaving FILE-INFO-BTIME-006 and FILE-INFO-BTIME-007 unqualified therefore records enforced claims that are false off Linux and makes the documented runner report missing tests there; qualify both claims or encode platform applicability in the profile.

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

@yjjnls

yjjnls commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Round 5 (codex, commit d251161) completed with no new findings. The four earlier rounds' findings are fixed in 3d89963 (round 1: 4), 542a232 (round 2: 4), 5ac8c03 (round 3: 4), and d251161 (round 4: 3), each with inline replies and per-round verification notes above. Convergence reached on the automated-review loop; leaving further changes to human review. The execd workflow run is still awaiting maintainer approval for the fork's workflow runs, so CI evidence here is local: full controller suite, gofmt/go vet, uv run scripts/conformance/run_profile.py --all, and the contract schema test all pass on the head commit.

The file upload/download/info surface is the single busiest fix area in
the execd controller: at least eleven open PRs each patch one edge of it
(mode defaults, octal special bits, env-var path validation, birth-time
identity, glob validation, overlay copy-up modes). The tests here pin
those edges as executable behavior samples, grouped by the PR that
motivates each boundary:

Four tests assert behavior main already honors and must keep honoring:
an undefined env var in a path is rejected with nothing written to disk
(opensandbox-group#2690), an API upload does not strip the destination's setuid bit
(opensandbox-group#2445/opensandbox-group#2750), an explicit metadata mode wins over the destination's
mode (opensandbox-group#2661/opensandbox-group#2445), and created_at uses birth time while the inode
matches (opensandbox-group#2612).

Three tests document boundaries whose expected semantics are still only
proposed, and skip with the PR number and the exact expectation so they
can be unskipped when that behavior lands: the 0644 creat(2) default for
an omitted metadata mode (opensandbox-group#2661), setuid from an octal metadata mode
(opensandbox-group#2750/opensandbox-group#2445), and the birth-time identity check with a ctime fallback
(opensandbox-group#2612).

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
Map documented behavior claims for the execd file upload and info surface
to the tests that enforce them, add a checker for the profile, and wire it
into the execd test workflow.

- specs/conformance/: the profile format and the first profile
  (execd-file-api.yaml) with five enforced and two pending claims.
- scripts/conformance/run_profile.py: validates profile structure and test
  references, runs mapped Go tests with go test -json, and enforces the
  enforced/pending status rules. A pending claim whose test starts passing
  fails the check as a stale profile, so skips cannot outlive the PRs they
  reference.
- CI: run the profile and the previously unwired contract schema test from
  execd-test.yml; trigger the execd workflow for profile and checker changes.
- Tests: keep the upload boundaries as the first profile cases. The
  birth-time boundary tests merged with opensandbox-group#2612 now cover that claim, so the
  duplicate skipped sample is removed. Boundary test comments name their
  claim ids.

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
- Run every profile with --all; CI no longer hard-codes one profile file.
- Make pending claims observable: the two pending boundary tests now probe
  the behavior and skip only while the pre-change behavior is still present.
  Once the referenced PR lands they pass, and the checker's stale-pending
  rule fires even though the landing PR never touches the test.
- Trigger the execd workflow for specs/execd-api.yaml and specs/tests/ so a
  schema-only change runs the contract schema test it affects.
- Assert the undefined variable name in the FILE-PATH-ENV-001 test so the
  clause's "names the undefined variables" requirement is actually pinned.

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
- Bound the go.mod lookup to the repository root.
- Skip non-object JSON events and non-string test/action fields instead of
  crashing on unexpected go test -json output.
- Handle a test file that lives directly in its module root.

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
…ribing

Round 2 review findings:

- The special-bits probe now uploads mode 7755 and requires setuid, setgid,
  and sticky together (with a filesystem sanity guard), so a partial
  implementation cannot pass the claim.
- Both pending probes document the enforced assertion next to their skip, and
  the checker's stale-pending message tells the contributor to replace the
  probe branch with that assertion instead of merely deleting the skip, so a
  promoted claim keeps enforcing.
- Violations quote the claim clause so a CI failure points at the normative
  sentence.
- The execd matcher also triggers on the compatibility document, so renaming
  or deleting a referenced contract file runs the reference validation.

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
A pending test that skips as its first statement can never observe the
referenced change landing, so the stale-pending detection cannot fire.
Reject that shape at validation time and document the probe requirement.

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
- Propagate skipped (and failed) subtest results to the mapped root test, so
  an enforced claim cannot pass while its only assertion skipped.
- Fail the run when go test exits nonzero without a mapped test failure
  (TestMain teardown or package-level error), instead of reporting success.
- Resolve contract references and reject anything outside the repository, so
  absolute paths and traversal cannot validate host files.
- Point the conformance README's compatibility links at the docs tree.

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
Round four review findings:

- FILE-UPLOAD-MODE-003 covers explicit non-zero modes; mode 0 is the
  omitted-mode sentinel in the request model and is out of the claim's scope.
- The omitted-mode probe now checks two umasks (022 -> 0644, 077 -> 0600), so
  a hard-coded 0644 implementation cannot pass the claim, and promotion
  asserts both wanted modes.
- The profile's contract list references the documents that actually state
  the claims (the API index for created_at, the execd architecture page for
  upload mode preservation), and the execd matcher watches both.

Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
@yjjnls
yjjnls force-pushed the test/execd-file-api-boundaries branch from d251161 to a0579ee Compare November 26, 2026 00:52
@yjjnls

yjjnls commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main (5c42221). Only .github/workflows/execd-test.yml conflicted: both this PR and main (#3018 QoS race-detector step) inserted steps after "Run tests with coverage". Resolved by keeping both — the QoS step comes first, then Set up uv / contract schema tests / conformance profiles. The other 7 commits are byte-identical (range-diff 7/8 =).

Verification on the rebased tree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/execd documentation Improvements or additions to documentation size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant