fix: preserve active profile and project in preflight - #150
fix: preserve active profile and project in preflight#150GautamSharma99 wants to merge 1 commit into
Conversation
rajpratham1
left a comment
There was a problem hiding this comment.
This pull request improves preflight configuration generation by prioritizing the active profile and active project before applying the existing projection limits. The new prioritizedEntries helper preserves the selected configuration while still enforcing the maximum number of serialized profiles and projects, preventing the active context from being omitted when large configurations are present. The changes are applied consistently where the preflight configuration is generated, and the accompanying tests verify both prioritization behavior and continued handling of invalid entries and projection limits. Based on the visible changes, the implementation is focused, preserves existing safeguards, and no blocking issues are apparent.
Summary
Fixes #137.
The readable Codex preflight projection now guarantees that a valid selected profile and the valid active repository trust entry are considered before the 256-entry collection limits are filled.
Previously,
profilesandprojectswere truncated by raw object insertion order. Entries after position 256 were never validated, even when they were the selected profile or the repository currently being scanned. Invalid early entries also consumed the entire input budget despite producing no projected output.Changes
Priority-aware projection
scanPreflightCodexConfignow accepts the active repository path as optional context.Projection order is now:
profiles;projects;The priority entry is still subject to every existing name, path, type, capability, and trust-level validation. It is reserved only when it produces valid projected data.
Accepted-entry limits
The 256-entry limits now count accepted projected entries rather than raw input entries.
For profiles, an entry counts only when:
For projects, an entry counts only when:
trustedoruntrusted.Invalid and empty entries no longer prevent later valid entries from reaching preflight.
Active repository propagation
The normalized repository path is now passed into every scan-specific projection:
config-preflight.tomlused by the capability helper is rewritten for the repository before the scan starts;This also handles a reusable persistent runtime scanning different repositories: each scan refreshes the readable preflight file with its own active project before the helper can consume it.
Existing safety boundaries preserved
The change retains the existing projection restrictions:
Tests
Added regression coverage for:
trustedvalue.Existing secret filtering, capability projection, persistent runtime, config-size, and scan orchestration tests continue to pass.
Verification
pnpm run typespnpm run formatpnpm run buildPATH="/opt/homebrew/bin:$PATH" pnpm run testFull suite: 471 passed, 6 expected platform/integration skips, 0 failed.