Skip to content

fix(tier3): include staged file permissions in baseline identity - #922

Open
Afloat16 wants to merge 10 commits into
NVIDIA:mainfrom
Afloat16:fix/baseline-staged-file-metadata-20261128
Open

Afloat16 wants to merge 10 commits into
NVIDIA:mainfrom
Afloat16:fix/baseline-staged-file-metadata-20261128

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Current integration update — 2026-12-01

Source: 2f44a69325bdd9699963e704fe562f319c183b0f; integrated main: 108fab86c5c0a8e1548289c036f0977a8c934bf3 (1.3.1 release preparation).

Resolved the CHANGELOG conflict by preserving the complete published 1.3.1 history and keeping this PR's entry under Unreleased. All PR-specific source and regression-test blobs are identical to previous head d97b684097cf0f083538de6883a8d8487caf1c43. The merge preserves both parents and carries the required DCO sign-off.

Validation for this merge: whitespace checks, released-history preservation, and exact source/test blob comparisons passed. GitHub now reports the PR as conflict-free. Current-source integration checks await maintainer workflow approval; the earlier test results below retain their original revision scope.

Previous integration update (main ad4a12f)

Source: d97b684097cf0f083538de6883a8d8487caf1c43; integrated main: ad4a12f0e17fe42e8f6839e41b6799ab8990bcf3. Resolved the CHANGELOG conflicts after the 1.3.0 release and stable-CI update. The released history and new upstream entry are preserved, with this PR’s change under Unreleased. The PR-specific source and regression-test files are unchanged from the previous head.

Focused validation: 18 passed, on tree fe1ae4ce8863150bd070ea12edc30b002a02a61a before the final CI-only main update. That final update changes only CI files and CHANGELOG; the tested runtime and regression files are unchanged. The updated CI modules passed 240 tests on the final #905 integration tree, and those CI blobs are identical in all 11 refreshed branches. Repository Ruff and whitespace checks passed.

The earlier integration tree also passed the OSS boundary scan and wheel/sdist builds. The Unreleased entry retains the digest-format migration and baseline/re-evaluation requirements; the published 1.3.0 history remains unchanged.

Current-head upstream workflows require maintainer approval. Earlier results below apply to their recorded revisions.

Original contribution and validation before this integration update

Summary

A staged task can change how it executes without changing file contents. The task-tree identity now records entry kind and owner permission bits only. Identical trees created under umasks 022, 002 and 077 share an identity, while owner-write and owner-execute changes invalidate baseline reuse. Symlink group/other mode differences do not change the digest.

Digests carry a self-describing sha256-v2: prefix. Older retained baselines and with-skill comparisons report “source run predates the current task-tree identity format.” Streaming golden fixtures use normal creation modes instead of chmod pinning or platform-specific branches. Bounded-memory hashing, growth/truncation checks, arm-name normalization and the generated metadata exclusion are preserved.

Current source: e9de380, including main d218ef8. The CHANGELOG merge retains both entries.

Verification on the current head

  • The four related baseline modules produced 52 passed / 2 failed locally. Both failures are existing test_runner_fresh_reused_and_incompatible cases: this workspace puts their output provenance key inside the evaluated workspace boundary. The same two cases fail with the same errors on the unchanged previous e2a1aa7 source.

  • The new umask, symlink and retained-format regressions fail on the previous implementation (4 failed / 12 passed in the selected negative control).

  • make lint, changed-file Ruff formatting, the OSS boundary scan, make build, and whitespace checks passed.

  • The report-only size check retains the pre-existing new-test-module/function and test/source ratio exceptions. This follow-up adds no test function or module.

  • Upstream CI for this head and six companion workflows await approval. Historical full-suite and Windows results below apply only to their named revisions.

  • I am familiar with the Contributing Guidelines

  • Added focused tests and updated CHANGELOG.md

  • Ran make lint and make build

  • Completed a passing full make test on this head

  • Did not add credentials, private datasets, or proprietary benchmark content

Release impact

Regenerate retained no-skill baselines and prior-revision with-skill results before using --compare-to or compare-versions. Re-running only the no-skill baseline does not update an older with-skill result.

Earlier validation at the previous source revisions

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
  • Updated documentation for user-visible changes
  • Ran make lint on the current combined source
  • Ran the complete make test on the current combined source
  • Ran make build on the current combined source
  • Did not add credentials, private datasets, or proprietary benchmark content

Current combined-source verification:

  • The current-source focused contribution gate passed on e2a1aa7b: 17 passed, 0 failed, covering streaming, staged metadata and context digests on POSIX. Whole-repository lint, the OSS-boundary scan, wheel/sdist builds and final source/tree/lockfile checks also passed.
  • The directory regression stages through _stage_task_inputs and copytree_secure, checks unchanged contents and preserved 0755/0555 modes, exercises actual write denial under an unprivileged POSIX user, and verifies that baseline comparison rejects the old identity. Restoring the old directory handling makes its identity assertion fail; the fix passes after restoration.
  • The complete default-suite gate at the preceding combined source passed on ad5f6ca2: 45,794 passed, 343 existing skips and 20 default deselections. Whole-repository lint, the OSS-boundary scan, wheel/sdist builds and final clean-source checks also passed. This full-suite result is scoped to that named source; the baseline implementation and metadata/streaming regression files are unchanged in the current merge.
  • The preceding full-suite attempt at 0c104f2b stopped at the earlier 40-minute job limit without a final test summary. It did not reach packaging or final clean-source verification and is not recorded as a full pass.

Coordination with #912 and Windows coverage

This branch now includes the actual integration with merged #912. Bounded-memory streaming and growth/truncation checks remain intact, with the digest fixtures updated for the versioned metadata identity.

The combined implementation and its metadata/streaming regression files are byte-identical to the previously validated combination dcbcb82536741a2c1f4ec9ec34a4912ba8eaece1. Its native Windows job passed 13 tests with 4 declared POSIX-only skips. All six Windows digest fixtures, growth/truncation checks, and context tests executed successfully, and the tested source stayed unchanged. This Windows result is scoped to that prior combination; the current focused Linux gate and preceding complete Linux gate are separately linked above.

Bind regular-file and symlink kind and permissions to retained baseline
compatibility, while keeping timestamps and generated context metadata
outside the identity. Exercise actual staging and script execution.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
@Afloat16

Copy link
Copy Markdown
Contributor Author

Could a maintainer approve the pending fork-workflow runs for this PR and #921?

The other applicable workflows, including DCO and Security, are waiting for approval as well (six runs for #922, seven for #921). There is no hosted test verdict yet for either head. Approving those pending runs will let the repository checks validate both contributions before merge.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @Afloat16 for this contribution.

[SkillEvaluator Review]

Value and readiness

Versioning the staged digest and hashing regular file modes catches a real stale-baseline case. Directory permissions and migration guidance still need action before final review by the maintainers and PIC.

Material findings

2 inline.

  • include staged directory modes in the baseline identity at src/skillevaluator/tier3/baseline_store.py:125.
  • document the impact on retained with-skill comparisons at CHANGELOG.md:41.

PIC tradeoffs

The identity format change requires recomputing retained comparison sources. Coordinate the digest fixtures and release notes with #912.

Verification

42 focused baseline tests passed. Reproduced directory mode preservation through task staging and the local runtime copy. Verified old identity rejection and reproduced an integration conflict with #912.

Reviewed head 14663a3291b8df393341f8f56f41d2024100692c.

Comment thread CHANGELOG.md Resolved
…t migration

Signed-off-by: Afloat <ShuffleMonkey@163.com>
@Afloat16

Copy link
Copy Markdown
Contributor Author

Addressed both findings in 0c104f2b, with current main merged. Directory entries now contribute their kind, permissions, and zero content bytes to the versioned identity. The new regression stages through _stage_task_inputs and copytree_secure, preserves unchanged file contents, checks the actual 0755-to-0555 mode change and unprivileged runtime write denial, and rejects the old baseline. Restoring the old directory handling fails the intended identity assertion.

The migration note now explicitly requires re-evaluating prior-revision with-skill results for --compare-to and compare-versions; a fresh no-skill baseline alone is insufficient.

This source passes 9 focused tests and full-repository lint. A separate combination with #912 retains bounded streaming and grow/truncate detection and passes 17 POSIX tests; its native Windows job passes 13 tests with 4 declared POSIX-only skips, including all six Windows golden digests. The combination is prepared for integration after #912; it is not part of this PR branch yet.

Complete contribution gates for all three current PR heads are running. Could a maintainer approve the current-head upstream workflows for #912 (04a238fc), #921 (fc1b2a2a), and #922 (0c104f2b)?

@rng1995

rng1995 commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks @Afloat16 for this contribution. I prepared and verified a signed-off merge against main at 86f1f141. The only conflict is in CHANGELOG.md.

Please enable Allow edits from maintainers in the PR sidebar so I can push the prepared merge. You can also merge main into this branch and keep the baseline permissions and digest migration entry as a separate bullet under ## Unreleased → ### Fixed, preserving the entries from main.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
@Afloat16

Afloat16 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Synced latest main 8b057485 in signed-off commit e2a1aa7b, preserving all main release notes and the separate baseline-permissions/migration entry. This retains the integration with merged #912 and the explicit digest-format migration guidance.

Validation of this source completed with 17 passed, 0 failed, plus whole-repository lint, the OSS-boundary scan, wheel/sdist builds and final source/tree/lockfile checks on Ubuntu 24.04 / Python 3.12 with the locked full extras.

The preceding combined source ad5f6ca2 has now completed its full contribution gate: 45,794 passed, 343 existing skips and 20 default deselections, plus lint, the OSS-boundary scan, wheel/sdist builds and final clean-source checks. Its baseline implementation and metadata/streaming fixtures are unchanged in the current merge. The earlier Windows-tested combination remains scoped to its 13 passes and 4 declared POSIX-only skips.

The other requested main refreshes (#905–#909, #911, #913, #914, #916 and #921) also passed their source-specific focused/lint/build jobs in the same new run. #910 has its own full gate for the discovery-race correction. The current upstream workflows still require maintainer approval; could you approve them when reviewing these updates?

@Afloat16
Afloat16 requested a review from rng1995 November 29, 2026 12:45
Keep both sides of the changelog conflict and retain the contribution's implementation and regression coverage.

Signed-off-by: Afloat <ShuffleMonkey@163.com>

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The two scenarios in the description are real and the new tests show them: a staged script losing its exec bit, or an input directory going read-only with unchanged contents, now changes the task-tree identity, and those four tests fail on main's source and pass here. The problem is what else changes it.

I staged the same task tree (a task.toml, a script with the exec bit, a data file, a symlink and an empty directory) under umask 022, 002 and 077 and hashed it with main and with this head. Main gives one identity; this head gives three. The group and other bits come straight from the environment, through the staging process's umask and the umask that cloned the source checkout (copy_file_secure preserves source modes), so a baseline recorded on CI is not reusable on an Ubuntu laptop with the 002 default, and a --compare-to source from one of them is refused as "staged baseline task tree changed". Symlinks add an OS dependence on top: lstat mode is always 0777 on Linux and umask-applied on macOS. Hashing only the owner bits (mode & 0o700), or kind plus exec bit plus owner-write bit, keeps both of your scenarios and drops the environment from the identity.

The second thing I would change is the migration story. The v2 marker lives inside the hash, nothing records the format version, so every retained run from before this change is rejected with the same text as a real change; explicit ids fail before execution and latest silently re-runs the baseline. A recorded version and a mismatch reason that says the source predates the current format would make that an honest message instead of a confusing one. Details inline. Streaming from #912 is preserved correctly (mode bytes go in before the streamed content, growth/truncation tests still pass), existing baseline/history tests have the same results on main and here, and the merge with #938's canary change is clean today. One note for whoever merges second: #938 excludes canary files by a prefix with a trailing slash, so with directories now hashed the canary directory itself becomes a deterministic entry in the digest; harmless for #938's equality tests, but a new input. CHANGELOG entry is under Unreleased / Fixed; CHANGELOG.md is the only conflict with main.

Hash owner permissions so staging umasks and platform-specific symlink group/other bits do not change identity. Persist a sha256-v2 format prefix and explain legacy retained-run incompatibility explicitly.

Merge main and preserve both changelog entries.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
@Afloat16

Afloat16 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the three review points in e9de380bdbbd:

  • Identity uses entry kind plus owner permissions only. Umasks 022/002/077 and symlink group/other differences produce the same digest; owner-write/execute changes still invalidate reuse.
  • The self-describing sha256-v2: prefix distinguishes migration from a changed task tree. Explicit selection, latest fallback and retained with-skill eligibility report “source run predates the current task-tree identity format” for legacy results.
  • Removed fixture chmod pinning and platform-specific golden branches. Streaming and grow/truncate coverage remain.

The new regressions fail on the old implementation. The four related modules now give 52 passed, with two existing runner cases blocked by this workspace's provenance-key location; both reproduce unchanged on the previous head. Lint, formatting, OSS scan and wheel/sdist builds pass. The PR body records those limits and keeps prior full-suite evidence scoped to its original revisions.

The main merge conflict is cleared. The seven new workflows await approval; could you approve this revision and re-review the changes?

Related branch refreshes are also ready for current-head CI approval: #905 (79 focused tests), #907 (53), #908 (239), #909 (17), #910 (707 passed / 6 skipped), #911 (44), and #913 (82). Their only merge conflicts were CHANGELOG entries; both sides are retained, and each PR description now identifies its published source and validation scope. #914, #916, #921, #940 and #941 have their review-specific follow-ups and current-head evidence in their own discussions. The new workflows require approval; previous-head successes are not counted for these updates.

#906 needed no update: its existing head is conflict-free with current checks successful and no unresolved review thread. Could you merge that one if it is ready, and approve the refreshed branches for CI?

Retain planted-canary normalization together with versioned entry-kind
and owner-permission hashing. Exercise permission changes with and
without planted canaries, preserving both changelog entries.

Signed-off-by: Afloat <ShuffleMonkey@163.com>

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The follow-up in e9de380 clears both points from my earlier review: only the owner permission bits enter the digest (I get one identical digest for the same tree staged under umask 022, 002 and 077), and the identity now carries a versioned prefix with its own mismatch reason, so runs from before this change say they predate the format instead of claiming the tree changed. The two baseline test files pass at this head (13). Nothing open from my side.

Preserve the published 1.3.0 history and the new stable-CI release note,
and place this pull request's change under Unreleased. Keep the reviewed
source and test changes.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
Keep the published 1.3.1 release history and this pull request's change
under Unreleased. The reviewed source and test changes are unchanged.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
@rng1995
rng1995 enabled auto-merge (squash) December 1, 2026 16:06
Integrate main 9747bc1 while retaining the original contribution and its regression coverage. Keep the release note as a separate Unreleased Fixed bullet and preserve all main entries.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
auto-merge was automatically disabled December 1, 2026 20:42

Head branch was pushed to by a user without write access

Keep the contribution under Unreleased and retain the complete published release history.

Signed-off-by: Afloat <ShuffleMonkey@163.com>

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants