Keep precompiled shaders and pipelines current #325

Merged
TaynanGT merged 2 commits from upstream-pr/325 into main 2026-11-27 16:58:24 +00:00
TaynanGT commented 2026-11-27 16:53:33 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T16:53:33Z.


A pipeline that failed to produce a host PSO stays eligible for the next warm-up. Older completion records are ambiguous and get one retry. The quarantine for failed workers still works as before.

Both launchers now ask the executable whether shader pretranslation is needed. It checks the active translation key and the source paths, so an old cache directory cannot skip the first scan after a translator update. A scan with I/O errors or a failed cache write remains eligible to run again.

The regression tests cover refused pipelines, legacy completion records, and mismatches in the shader cache key and source path. PowerShell and Bash syntax checks passed locally.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5530235888 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/325). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T16:53:33Z. --- A pipeline that failed to produce a host PSO stays eligible for the next warm-up. Older completion records are ambiguous and get one retry. The quarantine for failed workers still works as before. Both launchers now ask the executable whether shader pretranslation is needed. It checks the active translation key and the source paths, so an old cache directory cannot skip the first scan after a translator update. A scan with I/O errors or a failed cache write remains eligible to run again. The regression tests cover refused pipelines, legacy completion records, and mismatches in the shader cache key and source path. PowerShell and Bash syntax checks passed locally.
chatgpt-codex-connector[bot] commented 2026-11-27 16:53:46 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T16:53:46Z.


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-27T16:55:21.641964Z 0cb3131 PR opened
🔒 Security Review ✅ Completed 2026-11-27T16:56:29.529433Z 0cb3131 PR opened
ℹ️ 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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7223793727 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/325#issuecomment-7223793727). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-27T16:53:46Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"0cb3131abf8ded2400c5dc1bf72d3b9a59c3b578","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":"0cb3131abf8ded2400c5dc1bf72d3b9a59c3b578","has_any_findings":null,"has_unresolved_findings":null,"status":"completed"}} --> <!-- codex-security-review:v1 {"blockingSeverityThreshold":"P0","headSha":"0cb3131abf8ded2400c5dc1bf72d3b9a59c3b578","mergeGateEnabled":false,"pullRequestNumber":325,"repository":"TaynanGT/Vice-Tay","status":"completed"} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-27T16:55:21.641964Z">2026-11-27T16:55:21.641964Z</relative-time> | `0cb3131` | PR opened | | 🔒 **Security Review** | ✅ **Completed** <relative-time datetime="2026-11-27T16:56:29.529433Z">2026-11-27T16:56:29.529433Z</relative-time> | `0cb3131` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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. </details> </details>
chatgpt-codex-connector[bot] commented 2026-11-27 16:55:19 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T16:55:19Z.

Code review location: crates/victory-gpu/src/shader_cache.rs; line 177

@@ -164,6 +165,22 @@ pub(crate) fn translation() -> [u8; 32] {
     build()
 }
 
+/// Identifies a completed batch of cached translations, including the
+/// per-shader override that is deliberately outside the global cache key.
+pub fn precompile_cache_key() -> Option<[u8; 32]> {
+    CACHE.get()?;
+    if WRITE_FAILED.load(Ordering::Relaxed) {
+        return None;
+    }
+    crate::host::host()?;
+    let mut key = blake3::Hasher::new();
+    key.update(&build());

P2 Badge Include the translator source fingerprint in scan completion keys

When a translator update adds support for previously refused shaders without changing TRANSLATOR_VERSION, the completion key remains unchanged: build() uses the version by default, not SOURCE. Such updates explicitly leave the version unchanged according to crates/victory-shader/src/lib.rs. Because a scan can record completion even when some shaders fail translation, both launchers subsequently skip the scan that would populate those newly supported shaders. Include SOURCE in the batch completion key independently of the per-shader cache key so a new translator build gets another scan.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review-comment:4721915805 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/325#discussion_r4721915805). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-27T16:55:19Z. **Code review location:** `crates/victory-gpu/src/shader_cache.rs`; line 177 ~~~~diff @@ -164,6 +165,22 @@ pub(crate) fn translation() -> [u8; 32] { build() } +/// Identifies a completed batch of cached translations, including the +/// per-shader override that is deliberately outside the global cache key. +pub fn precompile_cache_key() -> Option<[u8; 32]> { + CACHE.get()?; + if WRITE_FAILED.load(Ordering::Relaxed) { + return None; + } + crate::host::host()?; + let mut key = blake3::Hasher::new(); + key.update(&build()); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Include the translator source fingerprint in scan completion keys** When a translator update adds support for previously refused shaders without changing `TRANSLATOR_VERSION`, the completion key remains unchanged: `build()` uses the version by default, not `SOURCE`. Such updates explicitly leave the version unchanged according to `crates/victory-shader/src/lib.rs`. Because a scan can record completion even when some shaders fail translation, both launchers subsequently skip the scan that would populate those newly supported shaders. Include `SOURCE` in the batch completion key independently of the per-shader cache key so a new translator build gets another scan. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot] commented 2026-11-27 16:55:19 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T16:55:19Z.

Code review location: apps/victory/src/translate.rs; line 418

@@ -409,11 +409,58 @@ pub fn run(
     Ok(())
 }
 
+fn precompile_stamp(dir: &Path, key: &[u8; 32], paths: &[PathBuf]) -> Option<PathBuf> {
+    let mut hash = blake3::Hasher::new();
+    hash.update(key);
+    for path in paths {
+        let path = path.canonicalize().ok()?;
+        let metadata = path.metadata().ok()?;
+        let modified = metadata.modified().ok()?.duration_since(std::time::UNIX_EPOCH).ok()?;

P2 Badge Account for descendant changes when stamping source directories

When a configured source is a directory, modifying an existing shader file or adding files within a nested directory does not change the source root's size or modification time. The completion stamp therefore remains valid after those game assets change, and shaders --if-needed skips scanning the new shader content indefinitely unless another key input changes. Both launchers normally scan directories, so the freshness check needs to account for descendant files rather than only the root directory's metadata.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review-comment:4721915815 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/325#discussion_r4721915815). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-27T16:55:19Z. **Code review location:** `apps/victory/src/translate.rs`; line 418 ~~~~diff @@ -409,11 +409,58 @@ pub fn run( Ok(()) } +fn precompile_stamp(dir: &Path, key: &[u8; 32], paths: &[PathBuf]) -> Option<PathBuf> { + let mut hash = blake3::Hasher::new(); + hash.update(key); + for path in paths { + let path = path.canonicalize().ok()?; + let metadata = path.metadata().ok()?; + let modified = metadata.modified().ok()?.duration_since(std::time::UNIX_EPOCH).ok()?; ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Account for descendant changes when stamping source directories** When a configured source is a directory, modifying an existing shader file or adding files within a nested directory does not change the source root's size or modification time. The completion stamp therefore remains valid after those game assets change, and `shaders --if-needed` skips scanning the new shader content indefinitely unless another key input changes. Both launchers normally scan directories, so the freshness check needs to account for descendant files rather than only the root directory's metadata. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot] commented 2026-11-27 16:55:19 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T16:55:19Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cb3131abf

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review:6091252869 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/325#pullrequestreview-6091252869). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-27T16:55:19Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `0cb3131abf` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
TaynanGT commented 2026-11-29 19:06:49 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T19:06:49Z.

Code review location: crates/victory-gpu/src/shader_cache.rs; line 177

@@ -164,6 +165,22 @@ pub(crate) fn translation() -> [u8; 32] {
     build()
 }
 
+/// Identifies a completed batch of cached translations, including the
+/// per-shader override that is deliberately outside the global cache key.
+pub fn precompile_cache_key() -> Option<[u8; 32]> {
+    CACHE.get()?;
+    if WRITE_FAILED.load(Ordering::Relaxed) {
+        return None;
+    }
+    crate::host::host()?;
+    let mut key = blake3::Hasher::new();
+    key.update(&build());

The current local implementation keys translations by SOURCE by default and includes the translation fingerprint. One remaining edge case is the explicit version-only override: the batch completion key should still track SOURCE independently so newly supported shaders are scanned. Keep that separate from the per-shader compatibility setting.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review-comment:4732744510 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/325#discussion_r4732744510). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T19:06:49Z. **Code review location:** `crates/victory-gpu/src/shader_cache.rs`; line 177 ~~~~diff @@ -164,6 +165,22 @@ pub(crate) fn translation() -> [u8; 32] { build() } +/// Identifies a completed batch of cached translations, including the +/// per-shader override that is deliberately outside the global cache key. +pub fn precompile_cache_key() -> Option<[u8; 32]> { + CACHE.get()?; + if WRITE_FAILED.load(Ordering::Relaxed) { + return None; + } + crate::host::host()?; + let mut key = blake3::Hasher::new(); + key.update(&build()); ~~~~ --- The current local implementation keys translations by SOURCE by default and includes the translation fingerprint. One remaining edge case is the explicit version-only override: the batch completion key should still track SOURCE independently so newly supported shaders are scanned. Keep that separate from the per-shader compatibility setting.
TaynanGT commented 2026-11-29 19:06:51 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T19:06:51Z.

Code review location: apps/victory/src/translate.rs; line 418

@@ -409,11 +409,58 @@ pub fn run(
     Ok(())
 }
 
+fn precompile_stamp(dir: &Path, key: &[u8; 32], paths: &[PathBuf]) -> Option<PathBuf> {
+    let mut hash = blake3::Hasher::new();
+    hash.update(key);
+    for path in paths {
+        let path = path.canonicalize().ok()?;
+        let metadata = path.metadata().ok()?;
+        let modified = metadata.modified().ok()?.duration_since(std::time::UNIX_EPOCH).ok()?;

The current local stamp implementation walks the source inventory and hashes each regular file's path, size, modification time and filesystem change time. It also has regression cases for nested additions, removals and preserved timestamps. This addresses the root-metadata-only problem in the current implementation; native test validation remains separate.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review-comment:4732744623 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/325#discussion_r4732744623). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T19:06:51Z. **Code review location:** `apps/victory/src/translate.rs`; line 418 ~~~~diff @@ -409,11 +409,58 @@ pub fn run( Ok(()) } +fn precompile_stamp(dir: &Path, key: &[u8; 32], paths: &[PathBuf]) -> Option<PathBuf> { + let mut hash = blake3::Hasher::new(); + hash.update(key); + for path in paths { + let path = path.canonicalize().ok()?; + let metadata = path.metadata().ok()?; + let modified = metadata.modified().ok()?.duration_since(std::time::UNIX_EPOCH).ok()?; ~~~~ --- The current local stamp implementation walks the source inventory and hashes each regular file's path, size, modification time and filesystem change time. It also has regression cases for nested additions, removals and preserved timestamps. This addresses the root-metadata-only problem in the current implementation; native test validation remains separate.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
TaynanGT/Vice-Tay!325
No description provided.