Skip to content

Handle CryptoKeyFile from SolutionReader - #375

Merged
jaredpar merged 2 commits into
jaredpar:mainfrom
jjonescz:snk
Aug 12, 2026
Merged

Handle CryptoKeyFile from SolutionReader#375
jaredpar merged 2 commits into
jaredpar:mainfrom
jjonescz:snk

Conversation

@jjonescz

Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +417 to +427
var originalFilePath = PathNormalizationUtil.NormalizePath(tuple.Item2.FilePath, kind);
var directory = Path.Combine(LogReaderState.CryptoKeyFileDirectory, index.ToString());
Directory.CreateDirectory(directory);
var filePath = Path.Combine(directory, Path.GetFileName(originalFilePath));

if (tuple.Item2.ContentHash is string contentHash)
{
File.WriteAllBytes(filePath, GetRawContentBytes(contentHash));
}

compilationOptions = compilationOptions.WithCryptoKeyFile(filePath);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think this is the best we can do with the code structured the way it is, but reading this I feel like I have the wrong abstraction layers in place. I think ideally this is the call that we should be making here

var filePath = PathNormalizationUtil.NormalizePath(tuple.Item2.FilePath, kind);

Essentially the implementation of NormalizePath should look at the RawContentKind.CryptoKeyFile and decide to put it into the CryptoKeyFileDirectory. That is how we handle other content kind where we want to put content into specific directories (see ContentBuilder).

Doing that though would require us to thread more information into the reader. When creating the PathNormalizationUtil instance we need to have a derivation that captures LogReaderState and uses that. It's doable ... but I wanted to think about it for a bit.

Think we should take this as is and I will work this problem out in a separate PR.

contentHash is not null ? ReadSourceText(kind, contentHash, hashAlgorithm) : null));
break;
case RawContentKind.CryptoKeyFile:
HandleCryptoKeyFile(contentHash, filePath);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why wasn't the code working before? We should be hitting this code, reading the content and dropping it to disk.

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.81%. Comparing base (ef88f0f) to head (0b28de6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #375      +/-   ##
==========================================
+ Coverage   95.76%   95.81%   +0.04%     
==========================================
  Files          56       56              
  Lines        7819     7829      +10     
  Branches      915      917       +2     
==========================================
+ Hits         7488     7501      +13     
+ Misses        187      184       -3     
  Partials      144      144              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jaredpar
jaredpar merged commit d43e6e5 into jaredpar:main Aug 12, 2026
5 checks passed
OvesN added a commit to OvesN/complog that referenced this pull request Aug 12, 2026
Preserve the 10.0.400 stdout-handle fix from PR jaredpar#375 while narrowing its blanket MSBuild environment filter to known unsafe variables.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8c8d3934-edc7-4f26-a1fc-451749254212
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