Skip to content

fix(session-aliases): reject array-shaped alias maps - #3619

Closed
eneekoruiz wants to merge 1 commit into
affaan-m:mainfrom
eneekoruiz:codex/fix-session-alias-array-map
Closed

eneekoruiz wants to merge 1 commit into
affaan-m:mainfrom
eneekoruiz:codex/fix-session-alias-array-map

Conversation

@eneekoruiz

Copy link
Copy Markdown
Contributor

Reject array-shaped alias maps using the existing invalid-structure recovery path. Previously a named alias could be added to an array and reported as saved, but JSON serialization discarded it, so the alias disappeared immediately after loading.

Validation: replaced the test that asserted the broken behavior with a regression covering load, listing, save/reload, resolution and the persisted count. The regression failed before the one-line guard; all 111 session-alias tests now pass. Coverage: 96% lines, 95.45% branches, 100% functions. ESLint has no errors (one existing test-runner complexity warning), diff checks and independent review passed.

@eneekoruiz
eneekoruiz requested a review from affaan-m as a code owner October 17, 2026 12:14
@ecc-tools

ecc-tools Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Security Evidence

Commit: b1668579f66579780a9d1de8a32c611a6f060ad3

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 2 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / PR Risk Taxonomy

Commit: b1668579f66579780a9d1de8a32c611a6f060ad3

PR taxonomy review recommended (neutral)

Detected 2 PR taxonomy bucket(s): Security Evidence, CI/CD Recommendation.

Scanned 2 changed file(s).

Roadmap taxonomy buckets:

Security Evidence

Security-sensitive changes should carry explicit scanner, code-scanning, or focused regression evidence.

Signals:

  • 1 security-sensitive path(s) changed

Paths:

  • scripts/lib/session-aliases.js

CI/CD Recommendation

CI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work.

Signals:

  • 1 CI or workflow path(s) changed

Paths:

  • tests/lib/session-aliases.test.js

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Reference Set Readiness

Commit: b1668579f66579780a9d1de8a32c611a6f060ad3

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 2 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Hosted Promotion Readiness

Commit: b1668579f66579780a9d1de8a32c611a6f060ad3

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 2 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: affaan-m/ECC/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 29f7ac6b-5074-4612-bd12-461a1fbb68ec
📥 Commits

Reviewing files that changed from the base of the PR and between 76aaa77 and b166857.

📒 Files selected for processing: 2
  • scripts/lib/session-aliases.js
  • tests/lib/session-aliases.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 1
  • GitHub Check: Greptile Review
🧰 Additional context used
📚 Code guidelines: 5
.cursor/rules/typescript-security.md — auto-discovered
.cursor/rules/common-hooks.md — auto-discovered
.cursor/rules/typescript-coding-style.md — auto-discovered
.claude/rules/node.md — auto-discovered
.cursor/rules/typescript-hooks.md — auto-discovered
📓 Path-based instructions: 6
Focus on command injection, unsafe subprocess usage, path traversal, SSRF, secret exposure, and missing tests for new CLI behavior.

⚙️ CodeRabbit configuration file

Files:

  • scripts/lib/session-aliases.js
Source excerpt: Source excerpt: Use **security-reviewer** skill for comprehensive security audits

📄 CodeRabbit inference engine (.cursor/rules/typescript-security.md)

Files:

  • scripts/lib/session-aliases.js
  • tests/lib/session-aliases.test.js
Source excerpt: Use with caution: Source excerpt: Use with caution: Enable for trusted, well-defined plans Source excerpt: Use with caution: Disable for exploratory work Source excerpt: Use with caution: Never use dangerously-skip-permissio...

📄 CodeRabbit inference engine (.cursor/rules/common-hooks.md)

Files:

  • scripts/lib/session-aliases.js
  • tests/lib/session-aliases.test.js
Source excerpt: Use spread operator for immutable updates: Source excerpt: Use async/await with try-catch: Source excerpt: Use Zod for schema-based validation: Source excerpt: Use proper logging libraries instead

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

Files:

  • scripts/lib/session-aliases.js
  • tests/lib/session-aliases.test.js
Source excerpt: New scripts in `scripts/lib/` require a matching test in `tests/lib/`

📄 CodeRabbit inference engine (.claude/rules/node.md)

Files:

  • scripts/lib/session-aliases.js
Source excerpt: **console.log audit**: Check all modified files for `console.log` before session ends

📄 CodeRabbit inference engine (.cursor/rules/typescript-hooks.md)

Files:

  • scripts/lib/session-aliases.js
  • tests/lib/session-aliases.test.js
📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Invalid array-based alias data now resets to an empty alias list instead of appearing as numeric entries. Newly saved aliases can be resolved normally.

loadAliases now rejects array-valued alias maps. The updated test verifies that loading returns an empty map and that a newly saved alias can be listed and resolved.

Changes: Alias map validation and recovery

Layer / File(s) Summary
Reject invalid maps and verify recovery
scripts/lib/session-aliases.js, tests/lib/session-aliases.test.js
loadAliases now treats arrays as invalid alias maps. The test checks that loading and listing return empty results, then verifies that a newly saved alias resolves with metadata count 1.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b1668

Array-shaped alias state is rejected, and the regression checks that aliases can be used again after recovery. No actionable merge risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rejecting array-shaped alias maps.
Description check Passed The description directly explains the bug, the fix, the regression test, and validation results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] Safe to merge within the reviewed scope: array-map recovery preserves newly saved aliases, and valid object-map persistence remains intact.

Summary

loadAliases() now rejects array-shaped alias maps through the existing invalid-structure recovery path.

  • Array-shaped alias maps reset before new aliases are saved.

No blocking issues found. The change is safe to merge within the reviewed scope.

Reviews (1) · Last reviewed commit: "fix(session-aliases): reject array-shape..." · Reviewed by Greptile

@haelyra

haelyra commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Thank you for rejecting array-shaped session alias maps. We carried your contribution into #3654 with attribution and the related follow-up fixes. That integration merged as e494799, and the resulting main passed CI, CodeQL, and Supply-Chain Watch. I’m closing this source PR as delivered. We appreciate your work and hope you’ll keep contributing.

@haelyra haelyra closed this Oct 25, 2026
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