Skip to content

ci: sentinel check for cfd_externals cache prefix match + AGENTS.md gh policy - #14

Merged
harryzhou2000 merged 3 commits into
CFDLAB-THU:mainfrom
harryzhou2000:dev/harry
May 4, 2026
Merged

ci: sentinel check for cfd_externals cache prefix match + AGENTS.md gh policy#14
harryzhou2000 merged 3 commits into
CFDLAB-THU:mainfrom
harryzhou2000:dev/harry

Conversation

@harryzhou2000

Copy link
Copy Markdown
Collaborator

Changes

  1. Runtime sentinel check: If libcgns.a exists after cache restore (prefix match where cache-hit is false), skip the build. Adds rm -rf external/cfd_externals before submodule init to prevent clone conflicts.

  2. AGENTS.md: Explicit list of gh write operations requiring user authorization (cache delete, force push, API writes, etc.).

Problem

actions/cache@v4 does prefix matching: a stored key cfd-ext-Linux-<sha>-<hash> is matched by request key cfd-ext-Linux-<sha>. The cache IS restored but cache-hit output is false. The build step runs, git submodule update --init fails because the restored cache already placed files in the directory.

Fix

Keep the if: cache-hit != 'true' guard (correct for future exact matches after old cache expires). Add an inner runtime check on the sentinel file to handle the prefix-match transition period.

actions/cache reports cache-hit=false on prefix match (key is shorter
than stored entry), but the content IS restored. The build step would
then run and fail on git submodule clone conflict.

Fix: check if libcgns.a exists at runtime before building. Also rm -rf
the submodule dir before git submodule update to prevent clone conflict
if the directory exists but is incomplete.

Also: update AGENTS.md gh policy with explicit list of write operations
requiring user authorization.
Switch header-only, cfd_externals, and Python venv from actions/cache
(combined restore+save, skips save on hit) to actions/cache/restore +
actions/cache/save with if:always(). This ensures caches are saved with
the correct key even after a prefix-match restore (where cache-hit is
false but content is already present).
@harryzhou2000
harryzhou2000 marked this pull request as ready for review May 4, 2026 17:23
@harryzhou2000
harryzhou2000 merged commit cb2a500 into CFDLAB-THU:main May 4, 2026
harryzhou2000 added a commit to harryzhou2000/DNDSR that referenced this pull request May 21, 2026
EOS / formation-enthalpy (SEVERE #1-7):
  - IdealGasPhysics: Cons2PrimEnergy/Prim2ConsEnergy take rhoH_form param
  - Gas.hpp: fix asqrRoe double-subtraction of rhoH_form at 3 Roe sites
  - Gas.hpp: GetRoeAverage UOut(I4) now = rhoRoe*HRoe - pRoeOut + rhoH_roe
  - Gas.hpp: IdealGasUIncrement param changed to drhoH_form (increment),
    dp correction applied internally; call sites simplified

PP limiter (SEVERE CFDLAB-THU#8-10):
  - EvaluateCellRHSAlphaExpansion: fix nLimLocal never incremented,
    skip already-limited cells, add ppEpsIsRelaxed support

Thread safety (SEVERE CFDLAB-THU#11-12):
  - PhysicsProperties + ChemicalContributor threadIdx(): use
    DNDS_DIST_MT_USE_OMP compile-time gate, remove pool_->size()>1 race
  - Remove dead useOMP() helper

Temperature offset (SEVERE CFDLAB-THU#13):
  - PhysicsProperties::temperature(): subtract 0K->298K sensible energy
    via Cantera cv_mass()*Tref (EOS-agnostic, no gamma needed)
  - Add ChemicalSource::isIdealGas() and sensibleInternalEnergyAtReference()
  - Crash on non-ideal-gas EOS with clear assertion message

Hardcoded dimensions (SEVERE CFDLAB-THU#14-16):
  - EulerEvaluator: nVars default -1 (always set by ctor)
  - SourceTermContributor: remove constexpr ExDim=3, use Traits::dim
  - EulerEvaluator: remove dead fluxJacobian0_Right (hardcoded 3D,
    never called; live _Times_du wrappers are dim-agnostic)

Energy / enthalpy (SEVERE CFDLAB-THU#17):
  - InitializeUDOF exprtk: pass rhoH_form=0 to Primitive2Conservative
    (formation added correctly from actual species afterwards)

Ideal-gas assumptions (SEVERE CFDLAB-THU#18):
  - ChemicalSource productionRatesAndJacobian: use Cantera
    getPartialMolarIntEnergies() for du_k, remove ideal-gas
    (hRT-1)*Ru*T formula and dead Ru/GasConstant

Docs:
  - docs/theory/RoeEigensystem.md: sensible-H eigensystem derivation,
    consistency proof, code trace
  - workspace/audit_k2p6_master.md: full 11-category audit report

Misc:
  - .gitignore: add .opencode/**/local
harryzhou2000 added a commit to harryzhou2000/DNDSR that referenced this pull request May 21, 2026
… if constexpr, T_guess, rename, Prim2Cons

CFDLAB-THU#14: remove static int cnt debug counter from temperature() fallback;
      replace fprintf with DNDS_assert
CFDLAB-THU#15: add DNDS_assert(I.sol/solT != nullptr) in clone()
CFDLAB-THU#16: add TODO(#audit MED16) to determine if JAC_SKIP_FLUID removable
CFDLAB-THU#17: if(model==NS_2EQ) -> if constexpr (model is template parameter)
CFDLAB-THU#18: fallback T_guess 0 -> 200 K (bottom guard for non-reactive mixtures)
CFDLAB-THU#19: mixtureFormationEnergy renamed mixtureFormationEnthalpy
      (returns sum Y_k*h_f_k = formation enthalpy per mass)
CFDLAB-THU#20: MeanValuePrim2Cons computes rhoH_form from species densities
      and passes it to Prim2Cons.  2-pass explanation in comments:
      pass 1 gets exact rhoH_form (depends only on rho+rhoY_k, which
      are correct from primitive); pass 2 uses correct gamma+formation
      making it exact inverse of MeanValueCons2Prim.
harryzhou2000 added a commit to harryzhou2000/DNDSR that referenced this pull request May 21, 2026
… clarify comments

LOW cleanups across 8 source files:

#1: speedOfSound already refactored in MED CFDLAB-THU#22 (Cantera API)
CFDLAB-THU#2: invR0() renamed to R0() — function returned R0=U0^2/T0, not its inverse
CFDLAB-THU#3: SourceCellAux::p=101325 comment clarified (code=phys with default scaling)
CFDLAB-THU#4: gamma before wall-fix comment added (UMeanXy unchanged by wall-fix)
CFDLAB-THU#5: e_sensible<=0 silent cp/cv fallback replaced with DNDS_assert_info
CFDLAB-THU#6: dead cellIsHalfAlpha/cellAdjAlphaMin lambdas marked 'Unused, kept for ref'
CFDLAB-THU#7: three unused muRef=phys_.muRef() lines removed from CompressInc
CFDLAB-THU#8: dead first outMap['RV'] = u[2] removed (overwritten by u[I4-1])
CFDLAB-THU#9: if(model==NS_2EQ) -> if constexpr in EvaluateDt.hxx lambda
CFDLAB-THU#10: hardcoded Vector<real,5/4> shock-tube BC comment added
CFDLAB-THU#11: uM1/uM2/uM3 dimension guard comments added (I4=dim+1)
CFDLAB-THU#12: KE-omission comment in dT_drho (was misplaced, now correctly at density derivative)
CFDLAB-THU#13: docstring 'perfect gas, variable' -> 'via Cantera EOS'
CFDLAB-THU#14: speciesEnthalpies comment expanded (ideal-gas vs non-ideal EOS)

All 56 audit findings resolved: 48 fixed, 8 accepted.
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.

1 participant