Skip to content

fix(coverage): materialize requirements-directory locks - #785

Draft
seonghobae wants to merge 40 commits into
mainfrom
fix/coverage-materialize-requirements-directory-locks
Draft

fix(coverage): materialize requirements-directory locks#785
seonghobae wants to merge 40 commits into
mainfrom
fix/coverage-materialize-requirements-directory-locks

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Buyer and review problem

Central OpenCode coverage historically discovered conventional requirements*.txt locks but ignored complete base-owned locks stored as direct children such as requirements/ci.txt. The first implementation also exposed a trust-boundary defect: path eligibility could be confused with dependency integrity before an independent closure proof.

Bounded implementation

  • Recognize conventional requirements locks and direct .txt children of repository-relative requirements/ directories.
  • Admit only regular blobs from the authenticated immutable base commit.
  • Require every substantive package line to be an exact == pin with at least one complete SHA-256 hash.
  • Treat a global --require-hashes directive as configuration, never integrity evidence.
  • Permit only bounded relative two-token -r / --requirement includes.
  • Reject absolute paths, .., ./, doubled slashes, URL/scheme syntax, home expansion, backslashes, query/fragment syntax, option-like operands, extra inline options, version ranges, malformed hashes, and unrelated pip option lines.
  • Preserve the trusted source path in the manifest and require an independent complete pip --require-hashes closure preflight.

Exact identity and scope correction

  • exact current head: 49e0c867a7a16c5ffd320aa018ff6ef0caa0385d;
  • protected base and independently resolved live base: main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba;
  • state: Draft and mechanically mergeable.

The final protected-base diff is limited to:

  • .github/workflows/trusted-uv-materializer-quality-ci.yml
  • scripts/ci/materialize_base_python_requirements.py
  • tests/test_materialize_base_python_requirements.py
  • tests/test_requirements_directory_lock_materialization.py
  • docs/doctoring/trusted-requirements-directory-lock-discovery.md
  • CHANGELOG.md

Overlapping AGENTS.md, CLAUDE.md, and root ARCHITECTURE.md changes were removed because PR #896 owns the canonical central documentation graph. The focused doctoring remains the durable design and APA 7 evidence for this bounded implementation.

Test-first lineage

RED head 4914e124c339f93bac5da42aeaf649ed893315d4 established failures for range pins, malformed hashes, option lines, unsafe include forms, and incorrect manifest admission. Later review-driven tests fixed dotted and doubled-separator include paths. Those predecessor results prove lineage only.

Merge gate

The scope correction changed the exact head, so every prior check and review is historical. Keep Draft until the unchanged current head completes the trusted-materializer/full-suite, exact 100% owned statement/branch coverage, public-docstring, security, SAST, dependency/SBOM, and semantic-review cycle with zero valid unresolved findings. Then mark Ready and require qualifying non-author exact-head approvals plus normal protected-main last-push semantics. No self-approval, stale evidence, temporary writer, administrative bypass, or weakened gate is authorized.

After protected integration, rerun affected leaf-repository coverage/review paths; protected-main consumer evidence remains required before operational closure.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: af6c8b88-e38b-4d6f-88c4-19c261bcd87a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae closed this Aug 5, 2026
@seonghobae seonghobae reopened this Aug 5, 2026
@seonghobae seonghobae closed this Aug 5, 2026
@seonghobae seonghobae reopened this Aug 5, 2026
@seonghobae seonghobae closed this Aug 5, 2026
@seonghobae seonghobae reopened this Aug 5, 2026
Comment thread .github/workflows/reopen-requirements-directory-locks.yml Fixed
Comment thread .github/workflows/repair-requirements-directory-locks.yml Fixed
@seonghobae
seonghobae marked this pull request as ready for review August 6, 2026 04:54
@seonghobae
seonghobae enabled auto-merge (squash) August 6, 2026 04:55

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review

Perform an independent formal exact-head review of ed33253e5d6f93f2e71d80b24e27b301f96efb88 against protected main f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae. Do not reuse predecessor-head verdicts.

The final diff contains only the permanent five-file product change; all transient repair workflows and transformers are absent. Recompute current-head coverage and public-docstring evidence; verify that only direct .txt children of a directory named requirements gain candidate status, while regular authenticated-base blobs, traversal/path safety, complete hash pinning, independently installable closure preflight, exact source receipts, and rejection of symlinks, PR-only files, nested descendants, .in files, and unpinned notes remain fail-closed. The verified materialization run passed 70 focused tests, 898 complete tests, production statement/branch coverage 100%, and docstrings 100%. Submit a formal exact-head verdict only; a qualifying independent non-author approval and branch protection remain mandatory.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@opencode-agent @cwl-noema-review Independently review exact current head ed33253e5d6f93f2e71d80b24e27b301f96efb88 against protected main at f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae.

The exact head is workflow-free and all direct current-head security, supply-chain, and Trusted uv Materializer Quality checks are successful. Verify the narrow direct-child requirements/*.txt candidate rule, authenticated-base regular-blob requirement, traversal/deeper-path/symlink/PR-only rejection, complete hash-locked closure preflight, exact manifest provenance, Python 3.10/3.14 compatibility, 100% production statement/branch/docstring evidence, and removal of every temporary branch writer. Submit actionable findings or an exact-head formal review; independent approval and branch protection remain mandatory.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae'
head='ed33253e5d6f93f2e71d80b24e27b301f96efb88'

printf '\n== Exact commits ==\n'
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git show -s --format='base=%H%nbase-subject=%s%nbase-date=%cI' "$base"
git show -s --format='head=%H%nhead-subject=%s%nhead-date=%cI' "$head"

printf '\n== Changed files and stat ==\n'
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"

printf '\n== Full product diff ==\n'
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"

printf '\n== Candidate source maps for changed Python files ==\n'
git diff --name-only "$base" "$head" -- '*.py' |
while IFS= read -r file; do
  [ -n "$file" ] || continue
  echo "--- $file"
  ast-grep outline "$file" --items all --view compact || true
done

printf '\n== Candidate discovery and provenance references at exact head ==\n'
rg -n -C 4 --glob '*.py' \
  '(requirements|require-hashes|materiali[sz]|manifest|symlink|git\s+cat-file|ls-tree|blob|traversal)' .

printf '\n== Workflow inventory and write-capable workflow references ==\n'
fd -t f -e yml -e yaml .github 2>/dev/null || true
rg -n -i -C 3 --glob '*.yml' --glob '*.yaml' \
  '(contents:\s*write|pull-requests:\s*write|actions/github-script|git\s+push|force-with-lease|workflow_dispatch)' \
  .github 2>/dev/null || true

printf '\n== Relevant tests and documentation references ==\n'
rg -n -C 3 --glob '*test*.py' --glob '*.md' \
  '(requirements/|requirements\*\.txt|require-hashes|materiali[sz]|manifest|symlink|nested|PR-only)' .

printf '\n== PR metadata, checks, and review state ==\n'
gh pr view 785 --repo ContextualWisdomLab/.github \
  --json number,state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup,reviews \
  || true

Length of output: 202327


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae'
head='ed33253e5d6f93f2e71d80b24e27b301f96efb88'

printf '\n== Exact changed files ==\n'
git diff --name-status "$base" "$head"
printf '\n== Exact changed-file diff ==\n'
git diff --no-ext-diff --unified=80 "$base" "$head"

printf '\n== Materializer complete source map ==\n'
ast-grep outline scripts/ci/materialize_base_python_requirements.py --items all --view expanded

printf '\n== Materializer candidate and base-lock implementation ==\n'
rg -n -C 12 \
  'def (_is_candidate_lock_name|_is_candidate_lock_path|_is_hash_pinned|base_hash_locks|materialize|_regular|_git|_lock_blob)|manifest' \
  scripts/ci/materialize_base_python_requirements.py

printf '\n== Materializer full source, bounded ==\n'
cat -n scripts/ci/materialize_base_python_requirements.py

printf '\n== New requirements-directory regression test ==\n'
cat -n tests/test_requirements_directory_lock_materialization.py

printf '\n== Existing Python materializer boundary tests: relevant regions ==\n'
rg -n -C 10 \
  '(regular|symlink|traversal|nested|PR-modified|hash.pinned|manifest|base_hash_locks|require-hashes)' \
  tests/test_materialize_base_python_requirements.py

printf '\n== Install closure preflight implementation and tests ==\n'
fd -t f 'install_base_python_locks.py|test_install_base_python_locks.py' . -x sh -c '
  echo "--- $1"
  cat -n "$1"
' sh {} \;

printf '\n== Exact-head workflow files changed by this diff, if any ==\n'
git diff --name-only "$base" "$head" -- .github/workflows |
while IFS= read -r file; do
  [ -n "$file" ] && { echo "--- $file"; cat -n "$file"; }
done

printf '\n== Workflow writers introduced by the exact diff ==\n'
git diff --no-ext-diff "$base" "$head" -- .github |
rg -n -i -C 3 '(contents:\s*write|git\s+push|force-with-lease|gh\s+(api|pr|workflow)|workflow_dispatch)' || true

printf '\n== Current PR check summary, grouped ==\n'
gh pr checks 785 --repo ContextualWisdomLab/.github || true

Length of output: 127039


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
head='ed33253e5d6f93f2e71d80b24e27b301f96efb88'

printf '\n== Exact-head materializer and installer calls in coverage workflows ==\n'
rg -n -C 8 --glob '*.yml' --glob '*.yaml' \
  '(materialize_base_python_requirements\.py|install_base_python_locks\.py|base-python-requirements|--base-sha|--requirements-root)' \
  .github/workflows

printf '\n== Candidate-status hash-pin regression coverage ==\n'
rg -n -C 8 --glob 'test*.py' \
  '(--require-hashes.*(unpinned|>=)|_is_hash_pinned|requirements/ci\.txt|requirements/nested|symlink|PR-modified)' \
  tests

printf '\n== Exact quality workflow runs and their logs ==\n'
gh run list --repo "$repo" --commit "$head" --workflow 'Trusted uv Materializer Quality CI' \
  --limit 10 --json databaseId,headSha,status,conclusion,createdAt,updatedAt,url \
  || true
for run_id in $(gh run list --repo "$repo" --commit "$head" --workflow 'Trusted uv Materializer Quality CI' \
  --limit 10 --json databaseId --jq '.[].databaseId' 2>/dev/null); do
  echo "--- quality run $run_id"
  gh run view "$run_id" --repo "$repo" --log 2>&1 | rg -n -C 4 \
    '(passed|failed|FAIL|TOTAL|100%|coverage|interrogate|docstring|Python 3\.10|Python 3\.14)' \
    || true
done

printf '\n== Current Strix and failed-status details ==\n'
gh pr checks 785 --repo "$repo" --json name,state,link,bucket \
  | jq -r '.[] | select(.name == "strix" or .name == "publish-manual-pr-evidence-status")' \
  || true

printf '\n== Branch protection / rulesets for main ==\n'
gh api "repos/${repo}/branches/main/protection" 2>&1 | jq '{required_status_checks,required_pull_request_reviews,enforce_admins,required_linear_history,allow_force_pushes,allow_deletions}' \
  || true
gh api "repos/${repo}/rulesets" 2>&1 | jq '.[] | {name,enforcement,target,conditions,rules}' \
  || true

Length of output: 207047


@seonghobae Exact-head review verdict: changes requested.

I reviewed ed33253e5d6f93f2e71d80b24e27b301f96efb88 against f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae.

Finding — P1: Do not materialize an unpinned direct-child lock

In scripts/ci/materialize_base_python_requirements.py at Line 100, the new direct-child rule delegates content validation to _is_hash_pinned().

_is_hash_pinned() returns True for this content:

--require-hashes
demo==1

The existing test at tests/test_materialize_base_python_requirements.py Line 153 confirms this behavior. The file has no hashes for demo==1.

Therefore, a base-owned requirements/ci.txt with this content gains candidate status and is written into manifest.json. The later pip --require-hashes preflight detects the incomplete closure, but the installer classifies this failure as deferable and skips the candidate.

This violates the stated boundary that only complete hash-pinned locks gain candidate status. It also conflicts with the new doctoring document, which says that candidate content must be hash-pinned.

Update candidate validation so an unpinned direct-child .txt file is rejected before materialization. Add a regression case for requirements/ci.txt with a global --require-hashes directive and an unpinned requirement. Assert that it is absent from the materialization manifest.

Verified controls

  • The diff contains exactly five permanent product files.
  • The changed quality workflow has contents: read.
  • The exact diff introduces no write-capable repair workflow or branch writer.
  • The direct-child predicate accepts only .txt files whose immediate parent is named requirements.
  • Nested descendants such as requirements/nested/ci.txt remain rejected.
  • Exact-base Git tree parsing admits regular 100* blobs only.
  • The materializer rejects symlinks, non-blob entries, absolute paths, and traversal paths.
  • The materializer reads selected content from the authenticated base SHA.
  • PR-only content cannot enter the base materialization result.
  • The manifest records the exact source path.
  • The coverage image runs the trusted installer with independent pip --require-hashes preflight.
  • The quality workflow checked out the requested exact head.
  • The quality run passed 70 focused tests and 898 complete tests.
  • Focused and complete statement/branch coverage were 100%.
  • The docstring gate reported 100%.
  • Python 3.10 and Python 3.14 checks passed.

strix was still in progress during verification. The branch-protection API response was inconclusive. These merge-gate items remain unverified.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review @coderabbitai review

Review-only request for exact current head ed33253e5d6f93f2e71d80b24e27b301f96efb88 against protected main f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae. Trusted uv Materializer Quality CI and every exact-head security/supply-chain workflow are successful; the final diff is workflow-free, all prior token-permission threads are resolved/outdated, and unresolved threads are zero. Validate direct-child requirements/*.txt discovery, authenticated-base regular-file and hash-pin boundaries, independent pip --require-hashes closure preflight, manifest provenance, 100% statement/branch/docstring evidence, and absence of transient writer machinery. Do not mutate the branch or merge; submit actionable findings or a formal exact-head review.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae'
head='ed33253e5d6f93f2e71d80b24e27b301f96efb88'
repo='ContextualWisdomLab/.github'

printf '%s\n' '== Exact commits =='
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git show -s --format='base %H%n%cs %s' "$base"
git show -s --format='head %H%n%cs %s' "$head"

printf '%s\n' '== Exact changed files =='
git diff --name-status --find-renames "$base" "$head"
git diff --stat "$base" "$head"

printf '%s\n' '== Exact diff =='
git diff --no-ext-diff --find-renames --unified=60 "$base" "$head"

printf '%s\n' '== Changed Python file outlines =='
git diff --name-only "$base" "$head" -- '*.py' |
while IFS= read -r file; do
  test -n "$file" || continue
  printf '\n--- %s ---\n' "$file"
  ast-grep outline "$file" --items all --view expanded || true
done

printf '%s\n' '== Materializer candidate, content-validation, tree, and manifest regions =='
rg -n -C 12 --glob 'materialize_base_python_requirements.py' \
  'def (_is_candidate_lock_name|_is_candidate_lock_path|_is_hash_pinned|_.*regular.*|_.*tree.*|materialize)|require-hashes|hash|manifest|ls-tree|cat-file|symlink|traversal' .

printf '%s\n' '== Installer preflight regions =='
rg -n -C 10 --glob 'install_base_python_locks.py' \
  'require-hashes|preflight|manifest|pip|closure|defer|skip|install' .

printf '%s\n' '== Relevant regression-test regions =='
rg -n -C 10 --glob 'test*.py' \
  'requirements/ci\.txt|requirements/nested|require-hashes|unpinned|hash-pinned|symlink|traversal|PR-only|manifest|base_hash_locks' tests

printf '%s\n' '== Workflow inventory and exact-diff write capability scan =='
fd -t f -e yml -e yaml .github 2>/dev/null || true
git diff --no-ext-diff "$base" "$head" -- .github |
  rg -n -i -C 3 'contents:\s*write|pull-requests:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script' || true

printf '%s\n' '== Current PR and check metadata =='
gh pr view 785 --repo "$repo" \
  --json state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup,reviews
gh pr checks 785 --repo "$repo" || true

Length of output: 202643


@seonghobae Exact-head review verdict: changes requested.

I reviewed ed33253e5d6f93f2e71d80b24e27b301f96efb88 against f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae.

P1 — Reject incomplete direct-child locks before materialization

tests/test_materialize_base_python_requirements.py Line 153 proves that _is_hash_pinned() accepts this content:

--require-hashes
demo==1

This file has no hash for demo==1.

The new direct-child rule accepts requirements/ci.txt. The materializer uses _is_hash_pinned() to grant candidate status. Therefore, a base-owned requirements/ci.txt with the content above can enter manifest.json.

The later independent pip --require-hashes preflight detects the missing hash. That preflight is necessary, but it occurs after candidate selection. It does not satisfy the required boundary that candidate status requires a complete hash-pinned lock.

Update the candidate validation to require a hash for every requirement before materialization. Add a regression test for requirements/ci.txt containing a global --require-hashes directive and an unhashed requirement. Assert that the file is absent from the materialization manifest.

Verified controls

  • The direct-child rule accepts requirements/ci.txt.
  • The direct-child rule rejects requirements/nested/ci.txt.
  • The materializer uses authenticated-base Git content.
  • The materializer has regular-file, path-safety, and symlink rejection controls.
  • The installer has an independent pip --require-hashes preflight.
  • The exact-head quality checks report successful Python 3.10 compatibility and Python 3.14 quality gates.
  • The current security and supply-chain check runs report success.
  • The current OpenCode coverage evidence reports success.

The PR is still blocked and requires review according to current GitHub metadata. I cannot approve while the incomplete-lock candidate path remains.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@jules Replace the current self-removing repair workflow with ordinary reviewed source commits on this branch. The product diff must contain only the permanent requirements-directory lock discovery, coverage/workflow contract, tests, doctoring, and CHANGELOG changes; no temporary writer, force-with-lease publisher, self-delete mechanism, or expected-RED artifact may remain.

Implement the narrow direct-child rule for regular base-owned requirements/*.txt locks while preserving traversal, symlink, malformed tree, unpinned input, and full pip --require-hashes closure failures. Add exact tests proving requirements/ci.txt is discovered for fast-mlsirm, deeper/unrelated files are excluded, and the workflow installs the authenticated base-owned lock in the isolated sandbox. Keep Draft until the branch is workflow-free and exact-head quality, coverage, docstrings, security, OpenCode/Noema/CodeRabbit, and independent approval gates pass.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

Review exact current head ed33253e5d6f93f2e71d80b24e27b301f96efb88. The branch is workflow-free and contains only the permanent direct-child requirements/*.txt materializer rule, focused tests, trusted quality-workflow coverage, doctoring, and CHANGELOG. Trusted uv Quality, Python Security, Security Scan, CodeQL, Semgrep, Secret Scan, OSV, Scorecard, and SBOM are successful on this head; unresolved current-head threads are zero. Review only—do not update, self-approve, bypass protections, or merge.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae'
head='ed33253e5d6f93f2e71d80b24e27b301f96efb88'
repo='ContextualWisdomLab/.github'

printf '\n== Exact commits ==\n'
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git show -s --format='base=%H%n%s%n%cs' "$base"
git show -s --format='head=%H%n%s%n%cs' "$head"

printf '\n== Changed files ==\n'
git diff --name-status --find-renames "$base" "$head"
git diff --stat "$base" "$head"

printf '\n== Exact diff ==\n'
git diff --no-ext-diff --find-renames --unified=50 "$base" "$head"

printf '\n== Materializer outline ==\n'
materializer="$(fd -t f '^materialize_base_python_requirements\.py$' . | head -n1)"
test -n "$materializer"
ast-grep outline "$materializer" --items all --view expanded

printf '\n== Materializer validation, tree, and manifest code ==\n'
rg -n -C 14 \
  'def (_is_candidate_lock_name|_is_candidate_lock_path|_is_hash_pinned|_.*tree.*|_.*regular.*|materialize)|--require-hashes|--hash|manifest|ls-tree|cat-file|symlink|traversal|base_hash_locks' \
  "$materializer"

printf '\n== Installer preflight code ==\n'
fd -t f '^install_base_python_locks\.py$' . -x sh -c '
  ast-grep outline "$1" --items all --view expanded
  rg -n -C 12 "require-hashes|preflight|manifest|pip|closure|skip|defer|install" "$1"
' sh {}

printf '\n== Relevant test code ==\n'
fd -t f -e py . tests -x sh -c '
  if rg -q "requirements/ci\.txt|requirements/nested|_is_hash_pinned|--require-hashes|base_hash_locks|symlink|PR-only|manifest" "$1"; then
    echo "--- $1"
    rg -n -C 10 "requirements/ci\.txt|requirements/nested|_is_hash_pinned|--require-hashes|base_hash_locks|symlink|PR-only|manifest" "$1"
  fi
' sh {}

printf '\n== Workflow files changed by exact diff ==\n'
git diff --name-only "$base" "$head" -- .github/workflows |
while IFS= read -r file; do
  test -n "$file" || continue
  echo "--- $file"
  git show "${head}:${file}" | nl -ba
done

printf '\n== Write-capability scan in exact workflow diff ==\n'
git diff --no-ext-diff "$base" "$head" -- .github |
  rg -n -i -C 3 'contents:\s*write|pull-requests:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script' || true

printf '\n== Current PR metadata and checks ==\n'
gh pr view 785 --repo "$repo" \
  --json state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup,reviews
gh pr checks 785 --repo "$repo" || true

printf '\n== Current unresolved review threads ==\n'
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number=785 -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) { nodes { isResolved } }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)] | length'

Length of output: 130146


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae'
head='ed33253e5d6f93f2e71d80b24e27b301f96efb88'
repo='ContextualWisdomLab/.github'

printf '\n== Exact changed workflow at requested head ==\n'
git show "${head}:.github/workflows/trusted-uv-materializer-quality-ci.yml" | sed -n '1,240p'

printf '\n== Write-capability tokens in the exact workflow diff ==\n'
git diff --no-ext-diff "$base" "$head" -- .github/workflows |
  rg -n -i -C 3 'contents:\s*write|pull-requests:\s*write|issues:\s*write|id-token:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script' || true

printf '\n== PR exact-head metadata and check rollup ==\n'
gh pr view 785 --repo "$repo" \
  --json state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup,reviews

printf '\n== Current check summary ==\n'
gh pr checks 785 --repo "$repo" || true

printf '\n== Current unresolved review-thread count ==\n'
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number=785 -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) { nodes { isResolved } }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)] | length'

printf '\n== Requested head workflow runs ==\n'
gh run list --repo "$repo" --commit "$head" --limit 100 \
  --json name,headSha,status,conclusion,url \
  --jq '.[] | select(.headSha == "'"$head"'") | [.name,.status,.conclusion,.url] | `@tsv`' \
  || true

Length of output: 45429


@seonghobae Exact-head review verdict: changes requested.

I reviewed ed33253e5d6f93f2e71d80b24e27b301f96efb88 against f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae.

P1 — Reject incomplete direct-child locks before materialization

In scripts/ci/materialize_base_python_requirements.py at Line 139, _is_hash_pinned() returns True when any line is exactly --require-hashes.

The existing test in tests/test_materialize_base_python_requirements.py at Line 153 confirms that this content is accepted:

--require-hashes
demo==1

demo==1 has no hash. A direct-child path such as requirements/ci.txt passes the new path rule. The materializer then writes this file into manifest.json.

The later pip --require-hashes preflight detects the missing hash. However, scripts/ci/install_base_python_locks.py classifies this failure as deferable and skips an unrecovered candidate. The coverage image can therefore continue without the intended dependency closure.

This behavior conflicts with the stated boundary that a candidate must be completely hash-pinned before materialization.

Update the candidate-content validation so every requirement has a valid hash before the materializer emits the manifest entry. Add a regression test for requirements/ci.txt containing --require-hashes and an unhashed requirement. Assert that the file is absent from the materialization result and manifest.json.

Verified controls

  • The diff contains five permanent product files.
  • The direct-child rule accepts requirements/ci.txt and services/.../requirements/package.txt.
  • The direct-child rule rejects requirements/nested/ci.txt and docs/ci.txt.
  • The materializer reads regular blobs from the authenticated base commit.
  • The tree parser rejects non-blob entries, non-regular modes, absolute paths, and traversal paths.
  • The materializer records exact source paths in the manifest.
  • The changed quality workflow has contents: read.
  • The exact workflow diff introduces no write-capability token or branch-writing command.
  • The requested-head quality, OpenCode, Noema, security, and supply-chain checks are successful.
  • The current unresolved-thread count is zero.

The PR remains BLOCKED with REVIEW_REQUIRED. I cannot approve until the incomplete-lock materialization path is fixed.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@opencode-agent review

Review exact head ed33253e5d6f93f2e71d80b24e27b301f96efb88 read-only. Trusted uv Materializer Quality CI, Python Security, Security Scan, CodeQL, Semgrep, Secret Scan, OSV, Scorecard, SBOM, and CodeRabbit are successful; all inline security findings concern removed predecessor workflows and are resolved/outdated. Verify the direct-child requirements/*.txt discovery boundary, authenticated-base regular-blob requirement, traversal/symlink rejection, complete hash-pinned closure preflight, manifest provenance, five-file permanent scope, and absence of branch-writing automation. Submit a non-author approval only if every exact-head gate remains satisfied.

Copy link
Copy Markdown
Contributor Author

@opencode-agent review

Re-evaluate exact current head dcc539176271658f024de7419044f513c6fb7317 over its PR-base snapshot e6fc91416c4fb13febd07b985c6e9c74fe888306. Independently resolved live main is 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba and is 32 commits ahead; live-base integration remains a separate merge gate and no predecessor review transfers. The current six-file head directly repairs the prior fail-open candidate boundary, is GitHub-mergeable, has zero unresolved threads, and all ten exact-head workflows are terminal-success. Review read-only; preserve independent human approval and branch-protection authority.

@seonghobae
seonghobae dismissed stale reviews from opencode-agent[bot], coderabbitai[bot], and coderabbitai[bot] August 11, 2026 14:30

Dismissed as source-stale predecessor evidence. It reviewed b3f5f7e87b57d9b5b76e3c628fe5d21be84d269f; exact current head is dcc539176271658f024de7419044f513c6fb7317, GitHub reports it mergeable, all ten current-head workflows are terminal-success, and no unresolved thread remains. This dismissal is not approval, qualifying human review, base freshness, merge authority, or protected-main acceptance.

Copy link
Copy Markdown
Contributor Author

@opencode-agent review

Perform a fresh read-only semantic review of exact current head edbe8d35b16c6f0a7041fefc476513e160cadb10 against independently resolved live protected base 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba. All ten exact-head quality/security/supply-chain workflows are terminal-success, GitHub reports the PR mergeable, and no unresolved thread exists. The prior request and dismissed findings target predecessor heads and do not transfer. Keep Draft; automated review remains separate from qualifying independent human approval and merge authority.

@seonghobae
seonghobae marked this pull request as ready for review August 12, 2026 04:26

Copy link
Copy Markdown
Contributor Author

Exact-current-head review request for edbe8d35b16c6f0a7041fefc476513e160cadb10 over protected main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

Review the bounded six-file requirements-directory lock repair: only direct-child .txt candidates under requirements/; regular authenticated-base blobs; exact normalized == pins with complete SHA-256 hashes; bounded safe relative includes; rejection of directives, options, ranges, malformed hashes, absolute/traversal/backslash/URL/query/fragment operands and deeper descendants; source path retained in the manifest; and independent complete pip --require-hashes closure preflight. All predecessor conflict/fail-open findings are repaired and dismissed; no unresolved thread exists. Trusted uv Materializer Quality CI, Strix Changed Path Quality CI, CodeQL PR, Python Security, Security Scan, SAST Semgrep, Secret Scan, OSV-Scanner PR, Scorecard PR, and SBOM Generation are terminal-success on this exact head.

Keep the exact head unchanged. Do not transfer predecessor review evidence, synthesize author approval, broaden candidate trust, skip closure validation, update the branch, merge, release, or bypass protection.

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

@seonghobae
seonghobae enabled auto-merge (squash) August 12, 2026 11:27
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='785'
expected_head='edbe8d35b16c6f0a7041fefc476513e160cadb10'
expected_base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'

printf '%s\n' '== Live PR identity, reviews, and checks =='
pr_json="$(gh pr view "$pr" --repo "$repo" \
  --json number,state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup,reviews)"
printf '%s\n' "$pr_json" | jq '{
  number, state, isDraft, headRefOid, baseRefOid, mergeStateStatus, reviewDecision,
  checks: [.statusCheckRollup[] | {name, status, conclusion, workflowName}],
  reviews: [.reviews[] | {author: .author.login, state, commit: .commit.oid}]
}'

head="$(printf '%s\n' "$pr_json" | jq -r '.headRefOid')"
base="$(printf '%s\n' "$pr_json" | jq -r '.baseRefOid')"
test "$head" = "$expected_head"
test "$base" = "$expected_base"

printf '%s\n' '== Commit identity and exact changed scope =='
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git merge-base --is-ancestor "$base" "$head"
git show -s --format='base=%H%nbase_subject=%s%nhead=%H%nhead_subject=%s%nhead_parents=%P' "$base" "$head"
git diff --name-status --find-renames "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head"

printf '%s\n' '== Exact product diff =='
git diff --no-ext-diff --find-renames --unified=35 "$base" "$head" -- \
  .github/workflows/trusted-uv-materializer-quality-ci.yml \
  CHANGELOG.md \
  docs/doctoring/trusted-requirements-directory-lock-discovery.md \
  scripts/ci/materialize_base_python_requirements.py \
  tests/test_materialize_base_python_requirements.py \
  tests/test_requirements_directory_lock_materialization.py

printf '%s\n' '== Materializer source map and boundary regions =='
ast-grep outline scripts/ci/materialize_base_python_requirements.py --items all --view expanded
git show "${head}:scripts/ci/materialize_base_python_requirements.py" | nl -ba |
  sed -n '1,300p;400,620p'

printf '%s\n' '== Installer closure-preflight regions =='
git show "${head}:scripts/ci/install_base_python_locks.py" | nl -ba |
  rg -n -C 12 -- 'require-hashes|preflight|manifest|pip|closure|skip|defer|install' || true

printf '%s\n' '== Relevant regression evidence =='
for file in \
  tests/test_materialize_base_python_requirements.py \
  tests/test_requirements_directory_lock_materialization.py; do
  printf '%s\n' "--- ${file}"
  git show "${head}:${file}" | nl -ba |
    rg -n -C 8 -- \
      'requirements/ci\.txt|requirements/nested|require-hashes|--hash=|--requirement|-r |manifest|unpinned|invalid|absolute|traversal|symlink|query|fragment|backslash|PR-only|regular blob' || true
done

printf '%s\n' '== Exact-diff workflow writer scan =='
git diff --no-ext-diff "$base" "$head" -- .github |
  rg -n -i -C 3 \
    'contents:\s*write|pull-requests:\s*write|issues:\s*write|id-token:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script|encoded' || true

printf '%s\n' '== Active non-outdated review threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) { nodes { author { login } body path line } }
        }
      }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] |
  select(.isResolved == false and .isOutdated == false)]'

printf '%s\n' '== Protected base rules and required checks =='
gh api "repos/${repo}/branches/main/protection" 2>&1 |
  jq '{required_status_checks,required_pull_request_reviews,enforce_admins,required_linear_history,allow_force_pushes,allow_deletions}' || true

Length of output: 58628


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='785'
head='edbe8d35b16c6f0a7041fefc476513e160cadb10'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'

current_head="$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq '.headRefOid')"
test "$current_head" = "$head"

printf '%s\n' '== Include predicate and control-character tests =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" |
  sed -n '118,190p'
git show "${head}:tests/test_requirements_directory_lock_materialization.py" |
  sed -n '55,190p'
git show "${head}:tests/test_materialize_base_python_requirements.py" |
  rg -n -C 6 -- 'control|NUL|\\x00|include|_is_hash_pinned|manifest|requirements/' || true

printf '%s\n' '== Installer preflight implementation =='
git show "${head}:scripts/ci/install_base_python_locks.py" |
  rg -n -C 14 -- 'require-hashes|preflight|manifest|pip|closure|skip|defer|install' || true

printf '%s\n' '== Authentication and materialization implementation =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" |
  sed -n '460,545p'

printf '%s\n' '== Workflow content and introduced writer scan =='
git show "${head}:.github/workflows/trusted-uv-materializer-quality-ci.yml" |
  sed -n '1,190p'
git diff --no-ext-diff "$base" "$head" -- .github |
  rg -n -i -C 3 \
    'contents:\s*write|pull-requests:\s*write|issues:\s*write|id-token:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script|encoded' || true

printf '%s\n' '== Current check summary and active threads =='
gh pr checks "$pr" --repo "$repo" || true
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) { nodes { author { login } body path line } }
        }
      }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] |
  select(.isResolved == false and .isOutdated == false)]'

printf '%s\n' '== Branch protection and live PR state =='
gh api "repos/${repo}/branches/main/protection" |
  jq '{required_status_checks,required_pull_request_reviews,enforce_admins,required_linear_history,allow_force_pushes,allow_deletions}' || true
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,mergeStateStatus,reviewDecision,isDraft,reviews |
  jq .

Length of output: 50734


@seonghobae Exact-head review verdict: changes requested.

I reviewed edbe8d35b16c6f0a7041fefc476513e160cadb10 against main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

P1 — Reject NUL and control characters in requirement include targets

In scripts/ci/materialize_base_python_requirements.py, _is_bounded_requirement_include() rejects several unsafe forms. It does not reject NUL or other non-whitespace control characters.

For example, this direct-child candidate is accepted:

-r locks/\x00private.txt

The line has two fields. Its target is not absolute. It contains no .. segment. It also contains no \, :, ?, #, -, or ~ prefix. Therefore, _is_hash_pinned() returns True, and base_hash_locks() materializes the source into manifest.json.

The later pip --require-hashes preflight runs after materialization. It cannot enforce the required pre-materialization control-character boundary.

Reject NUL and all control characters in the include target. Add predicate and manifest-exclusion regressions for at least \x00 and one other non-whitespace control character.

Verified controls

  • The live head and base match the requested commit IDs.
  • The exact diff contains only the declared six files.
  • Only direct .txt children of a requirements directory gain the new path eligibility.
  • Nested descendants remain excluded.
  • The materializer reads regular blobs from the authenticated base commit.
  • The materializer rejects non-regular tree entries, absolute paths, and traversal paths.
  • Exact == requirements require complete SHA-256 hashes.
  • The prior unpinned, range, malformed-hash, option-line, absolute, traversal, backslash, URL, query, fragment, home-expansion, option-like-target, and extra-token include cases are rejected.
  • The manifest retains the trusted source path.
  • The installer performs an independent pip --require-hashes preflight.
  • The changed workflow has contents: read.
  • The exact diff introduces no write-capable workflow behavior.
  • No active non-outdated review thread was returned.

scan-pr-queue is still pending. GitHub reports BLOCKED and REVIEW_REQUIRED. The branch-protection API returned HTTP 403, so required-review and required-check configuration could not be independently verified.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/.github PR: 0
File: :0-0
Timestamp: 2026-08-05T13:44:10.007Z
Learning: For PR `#782`, only successful checks associated with the exact current head are valid merge evidence. Do not treat queued, in-progress, cancelled, predecessor-head, temporary-workflow, or administrative-bypass results as passing evidence. Before a formal approval, verify that the direct security and supply-chain workflows, the permanent hourly NVIDIA NIM contract, current-head reviews, unresolved-thread checks, and an independent approval have completed successfully.

You are interacting with an AI system.

Record that a global --require-hashes directive is not integrity evidence
and cannot authorize download of unpinned code. Force the trusted-uv
installer tests onto the linux x86_64 runner path and add the
control-plane architecture diagram.
Bounded -r/--requirement includes may only name requirements*.txt,
requirements.lock, or a direct .txt child of requirements/. A notes
file next to a lock cannot enter the trusted image.
@seonghobae

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review Please review this exact current head (052e050350bd50da141238f6f0513bc2c4824a47). Independent Noema APPROVE on this SHA is required. Do not wait on two-approval.

A current-directory prefix or doubled slash still named a candidate
requirements lock after path-kind checks. Include targets must now equal
their normalized relative POSIX form so ./ and // cannot enter the image.

Copy link
Copy Markdown
Contributor Author

Exact-current-head read-only review request for a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67 over protected base 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

All ten directly observed exact-head workflows are terminal-success: Trusted uv Materializer Quality CI, Strix Changed Path Quality CI, CodeQL PR, Python Security, Security Scan, SAST Semgrep, Secret Scan, OSV-Scanner PR, Scorecard PR, and SBOM Generation. Prior conflict and fail-open findings are predecessor-head evidence; current GitHub metadata reports mergeable. Submit a current-head verdict only. Do not mutate the branch, self-approve, weaken protection, or merge.

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='785'
head='a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'

printf '%s\n' '== Live PR identity, review decision, and checks =='
pr_json="$(gh pr view "$pr" --repo "$repo" \
  --json number,state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup,reviews)"
printf '%s\n' "$pr_json" | jq '{
  number, state, isDraft, headRefOid, baseRefOid, mergeStateStatus, reviewDecision,
  checks: [.statusCheckRollup[] | {name, status, conclusion, workflowName}],
  reviews: [.reviews[] | {author: .author.login, state, commit: .commit.oid}]
}'
live_head="$(printf '%s\n' "$pr_json" | jq -r '.headRefOid')"
live_base="$(printf '%s\n' "$pr_json" | jq -r '.baseRefOid')"
test "$live_head" = "$head"
test "$live_base" = "$base"

printf '%s\n' '== Commit relationship and changed paths =='
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git merge-base --is-ancestor "$base" "$head"
git show -s --format='base=%H%nbase_subject=%s%nhead=%H%nhead_subject=%s%nhead_parents=%P' "$base" "$head"
git diff --name-status --find-renames "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head"

printf '%s\n' '== Exact product diff =='
git diff --no-ext-diff --find-renames --unified=40 "$base" "$head" -- \
  .github/workflows/trusted-uv-materializer-quality-ci.yml \
  CHANGELOG.md \
  docs/doctoring/trusted-requirements-directory-lock-discovery.md \
  scripts/ci/materialize_base_python_requirements.py \
  scripts/ci/install_base_python_locks.py \
  tests/test_materialize_base_python_requirements.py \
  tests/test_requirements_directory_lock_materialization.py

printf '%s\n' '== Materializer structure and trust-boundary implementation =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" > /tmp/materializer.py
ast-grep outline /tmp/materializer.py --items all --view expanded
nl -ba /tmp/materializer.py | sed -n '1,330p;400,640p'

printf '%s\n' '== Installer closure preflight =='
git show "${head}:scripts/ci/install_base_python_locks.py" | nl -ba |
  rg -n -C 14 -- 'require-hashes|preflight|manifest|pip|closure|skip|defer|install' || true

printf '%s\n' '== Current-head regression tests =='
for file in \
  tests/test_materialize_base_python_requirements.py \
  tests/test_requirements_directory_lock_materialization.py; do
  printf '%s\n' "--- ${file}"
  git show "${head}:${file}" | nl -ba |
    rg -n -C 8 -- \
      'requirements/ci\.txt|requirements/nested|require-hashes|--hash=|--requirement|-r |manifest|unpinned|invalid|absolute|traversal|symlink|query|fragment|backslash|control|NUL|PR-only|regular blob' || true
done

printf '%s\n' '== Exact-diff workflow writer scan =='
git diff --no-ext-diff "$base" "$head" -- .github |
  rg -n -i -C 3 \
    'contents:\s*write|pull-requests:\s*write|issues:\s*write|id-token:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script|encoded' || true

printf '%s\n' '== Active non-outdated review threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) {
            nodes { author { login } body path line }
          }
        }
      }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] |
  select(.isResolved == false and .isOutdated == false)]'

Length of output: 64251


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='785'
head='a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'

printf '%s\n' '== Include admission implementation and regex definitions =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" |
  cat -n | sed -n '25,205p'

printf '%s\n' '== Authenticated base-tree discovery and manifest implementation =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" |
  cat -n | sed -n '470,570p'

printf '%s\n' '== Exact current-head requirement-directory regression file =='
git show "${head}:tests/test_requirements_directory_lock_materialization.py" |
  cat -n

printf '%s\n' '== Related predicate tests in the existing materializer suite =='
git show "${head}:tests/test_materialize_base_python_requirements.py" |
  cat -n |
  grep -n -E -C 6 \
    '(_is_hash_pinned|_is_bounded_requirement_include|control|NUL|\\x00|requirements/|manifest|symlink|traversal)' \
  || true

printf '%s\n' '== Previous two commits: control-character repair evidence =='
git log --format='%H %s' -3 "$head"
for commit in "$head^" "$head^^"; do
  printf '%s\n' "--- ${commit}"
  git show --no-ext-diff --format= --unified=25 "$commit" -- \
    scripts/ci/materialize_base_python_requirements.py \
    tests/test_requirements_directory_lock_materialization.py
done

printf '%s\n' '== Installer independent closure-preflight implementation =='
git show "${head}:scripts/ci/install_base_python_locks.py" |
  cat -n |
  grep -n -E -C 14 'require-hashes|preflight|manifest|pip|closure|skip|defer|install' \
  || true

printf '%s\n' '== Exact workflow diff and write-capability scan =='
git diff --no-ext-diff --unified=25 "$base" "$head" -- \
  .github/workflows/trusted-uv-materializer-quality-ci.yml
git diff --no-ext-diff "$base" "$head" -- .github |
  grep -n -E -i -C 3 \
    'contents:[[:space:]]*write|pull-requests:[[:space:]]*write|issues:[[:space:]]*write|id-token:[[:space:]]*write|git[[:space:]]+push|force-with-lease|workflow_dispatch|actions/github-script|encoded' \
  || true

printf '%s\n' '== Active non-outdated review threads and live identity recheck =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) {
            nodes { author { login } body path line }
          }
        }
      }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] |
  select(.isResolved == false and .isOutdated == false)]'
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,mergeStateStatus,reviewDecision,isDraft |
  jq .

Length of output: 57382


@seonghobae Exact-current-head verdict: changes requested.

I reviewed a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67 against main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

P1 — Reject NUL and control characters in requirement include targets

In scripts/ci/materialize_base_python_requirements.py, Line 137 through Line 156, _is_bounded_requirement_include() does not reject NUL or other non-whitespace control characters.

This input is accepted:

-r requirements/\x00ci.txt

str.split() leaves \x00 in the target token. pathlib.PurePosixPath preserves the target. The target remains a relative, normalized path whose parent is requirements and whose suffix is .txt. _is_candidate_lock_path() then returns True.

As a result, _is_hash_pinned() accepts the candidate. base_hash_locks() materializes the base-owned source into manifest.json before the independent pip --require-hashes preflight.

Reject NUL and all control characters in include targets before PurePosixPath evaluation. Add predicate and manifest-exclusion tests for \x00 and one other non-whitespace control character.

Verified controls

  • The live head and base match the requested commit IDs.
  • The direct-child rule accepts only .txt files whose immediate parent is requirements.
  • Nested descendants remain excluded.
  • Candidate content requires exact == pins with complete SHA-256 hashes, or a bounded include.
  • Global --require-hashes directives and unpinned requirements do not grant candidate status.
  • Authenticated-base regular-blob discovery and manifest source provenance remain present.
  • The installer performs separate pip --require-hashes closure preflight.
  • The changed workflow has contents: read.
  • The exact diff introduces no detected write-capable workflow behavior.
  • The listed substantive exact-head quality and security jobs are successful.
  • No active non-outdated review thread exists.

GitHub currently reports BLOCKED and REVIEW_REQUIRED. No branch mutation, approval, protection change, or merge was performed.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

Review only exact current head a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67. The current source now applies _is_candidate_lock_path(candidate) in base_hash_locks, so direct requirements/*.txt and nested */requirements/*.txt candidates reach the existing strict content/trust validation. All directly observed exact-head hosted workflows are terminal-success and current review threads are resolved. Do not mutate the branch, synthesize author approval, weaken protection, or merge; submit an exact-head verdict only.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='785'
head='a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'

printf '%s\n' '== Live identity, check state, and review state =='
gh pr view "$pr" --repo "$repo" \
  --json state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup,reviews |
  jq '{
    state, isDraft, headRefOid, baseRefOid, mergeStateStatus, reviewDecision,
    checks: [.statusCheckRollup[] | {name, status, conclusion, workflowName}],
    reviews: [.reviews[] | {author: .author.login, state, commit: .commit.oid}]
  }'

live_head="$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq '.headRefOid')"
test "$live_head" = "$head"
git cat-file -e "${head}^{commit}"
git cat-file -e "${base}^{commit}"

printf '%s\n' '== Exact changed paths and whitespace =='
git diff --name-status --find-renames "$base" "$head"
git diff --check "$base" "$head"

printf '%s\n' '== Materializer candidate and include validation =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" |
  nl -ba | sed -n '25,230p;450,570p'

printf '%s\n' '== Materializer test map and control-character cases =='
for file in \
  tests/test_materialize_base_python_requirements.py \
  tests/test_requirements_directory_lock_materialization.py; do
  printf '%s\n' "--- ${file}"
  git show "${head}:${file}" | nl -ba |
    rg -n -C 8 -- \
      '(_is_hash_pinned|_is_bounded_requirement_include|requirements/ci\.txt|requirements/nested|NUL|control|\\x00|\\x01|manifest|--requirement|-r |--hash=|traversal|symlink)' || true
done

printf '%s\n' '== Installer closure preflight =='
git show "${head}:scripts/ci/install_base_python_locks.py" |
  nl -ba | rg -n -C 10 -- 'require-hashes|preflight|manifest|pip|closure|skip|defer' || true

printf '%s\n' '== Exact workflow writer scan =='
git diff --no-ext-diff "$base" "$head" -- .github |
  rg -n -i -C 3 \
    'contents:\s*write|pull-requests:\s*write|issues:\s*write|id-token:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script|encoded' || true

printf '%s\n' '== Active non-outdated threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) { nodes { author { login } body path line } }
        }
      }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] |
  select(.isResolved == false and .isOutdated == false)]'

Length of output: 11551


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='785'
head='a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'

current_head="$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq '.headRefOid')"
test "$current_head" = "$head"

number_lines() {
  awk '{ printf "%6d\t%s\n", NR, $0 }'
}

printf '%s\n' '== Candidate and include predicates =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" |
  number_lines | sed -n '25,240p'

printf '%s\n' '== Base tree discovery and manifest materialization =='
git show "${head}:scripts/ci/materialize_base_python_requirements.py" |
  number_lines | sed -n '440,590p'

printf '%s\n' '== Requirements-directory regression tests =='
git show "${head}:tests/test_requirements_directory_lock_materialization.py" |
  number_lines

printf '%s\n' '== Existing materializer tests for predicate and manifest boundaries =='
git show "${head}:tests/test_materialize_base_python_requirements.py" |
  number_lines |
  rg -n -C 8 -- \
    '(_is_hash_pinned|_is_bounded_requirement_include|requirements/ci\.txt|requirements/nested|NUL|control|\\x00|\\x01|manifest|--requirement|-r |--hash=|traversal|symlink)' || true

printf '%s\n' '== Installer closure preflight =='
git show "${head}:scripts/ci/install_base_python_locks.py" |
  number_lines |
  rg -n -C 10 -- 'require-hashes|preflight|manifest|pip|closure|skip|defer' || true

printf '%s\n' '== Exact workflow writer scan =='
git diff --no-ext-diff "$base" "$head" -- .github |
  rg -n -i -C 3 \
    'contents:\s*write|pull-requests:\s*write|issues:\s*write|id-token:\s*write|git\s+push|force-with-lease|workflow_dispatch|actions/github-script|encoded' || true

printf '%s\n' '== Active non-outdated threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) { nodes { author { login } body path line } }
        }
      }
    }
  }
}' | jq '[.data.repository.pullRequest.reviewThreads.nodes[] |
  select(.isResolved == false and .isOutdated == false)]'

Length of output: 52193


@seonghobae Exact-current-head verdict: changes requested.

I reviewed a212e3e2943b8d9bfef8bf90ac91b17d10cd3f67 against main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

P1 — Reject NUL and control characters in include targets

_is_bounded_requirement_include() accepts a target that contains NUL or other non-whitespace control characters.

For example, this line passes the current checks:

-r requirements/\x00ci.txt

At Line 141 through Line 147, the predicate rejects option-like prefixes, backslashes, colons, queries, and fragments. It does not reject control characters. PurePosixPath preserves the NUL-containing segment. The target remains relative and has requirements as its parent. _is_candidate_lock_path() then accepts it.

At Line 188 through Line 192, _is_hash_pinned() treats the accepted include as trusted candidate syntax. At Line 516 through Line 519, base_hash_locks() materializes the base blob before the independent pip --require-hashes preflight.

The installer preflight does not enforce this pre-materialization boundary.

Reject NUL and all Unicode control characters in target before PurePosixPath(target). Add predicate and manifest-exclusion tests for \x00 and at least one other non-whitespace control character.

Verified controls

  • The live head and base match the requested commit IDs.
  • The direct-child rule accepts requirements/*.txt and nested */requirements/*.txt paths.
  • The direct-child rule rejects deeper descendants.
  • Candidate package lines require exact == pins and complete SHA-256 hashes.
  • A standalone --require-hashes directive does not grant candidate status.
  • The materializer reads regular blobs from the authenticated base commit.
  • The materializer records the trusted source path in manifest.json.
  • The installer performs independent pip --require-hashes closure preflight.
  • The exact workflow diff contains no detected write-capable behavior.
  • Active non-outdated review threads are empty.
  • The substantive exact-head hosted checks shown by GitHub are terminal success.

GitHub still reports BLOCKED and REVIEW_REQUIRED. No branch mutation, approval, or merge was performed.

You are interacting with an AI system.

@seonghobae
seonghobae marked this pull request as draft August 15, 2026 12:46
auto-merge was automatically disabled August 15, 2026 12:46

Pull request was converted to draft

@cursor cursor 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.

Comment on #785 at 49e0c867a7a16c5ffd320aa018ff6ef0caa0385d.

Path-aware _is_candidate_lock_path discovery is the right collector, but this head still publishes through _is_hash_pinned. That admits a bounded -r / --requirement file, then renames it to requirements-000.txt and drops the include target. Consumer coverage then fails before tests start.

#1020 already collects requirements/ci.txt and service/requirements/package.txt, then applies _is_flat_materializable_lock so only a standalone SHA-256 closure is renamed. Keep #785 closed behind that landing head.

Next action: do not merge this branch. After #1020 reaches protected main, rebase only if a unique workflow or doctoring hunk remains; otherwise close this pull request as superseded.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

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.

2 participants