Port COSGN00C (Identity & Access / Signon) to C# .NET 8 (one-to-one) - #194
Open
matthewguerra-cog wants to merge 2 commits into
Open
matthewguerra-cog wants to merge 2 commits into
matthewguerra-cog wants to merge 2 commits into
Conversation
…ith xUnit tests Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One-to-one port of
app/cbl/COSGN00C.cbl(transactionCC00, signon) to C# on .NET 8 under a newdotnet/tree. No COBOL was touched. Requested againstankehao-demo/aws-mainframe-modernization-carddemo, but Devin has no push access there (push: false, 403), so this lands on the COG-GTM fork — the COBOL/copybook sources are byte-identical between the two.Paragraph → method, statement order preserved, no consolidation:
dotnet/CardDemo.Identity/Cosgn00c.cs)MAIN-PARAMainPara(TerminalInput eib)PROCESS-ENTER-KEYProcessEnterKey()SEND-SIGNON-SCREENSendSignonScreen()SEND-PLAIN-TEXTSendPlainText()POPULATE-HEADER-INFOPopulateHeaderInfo()READ-USER-SEC-FILEReadUserSecFile()Copybooks → types with the exact PIC lengths:
COCOM01Y→CardDemoCommarea(incl. the88levels asCdemoUsrtypAdmin/CdemoUsrtypUser/CdemoPgmEnter/CdemoPgmReenter),CSUSR01Y→SecUserData(SecUsrIdX(8),SecUsrFnameX(20),SecUsrLnameX(20),SecUsrPwdX(8),SecUsrTypeX(1),SecUsrFillerX(23)),COSGN00.CPY→Cosgn0aMap(single object becauseCOSGN0AO REDEFINES COSGN0AI;UseridL/PasswdLcarry the-1cursor),CSMSG01Y/COTTL01Y→CcdaCommonMessages/CcdaScreenTitleliterals copied verbatim including trailing blanks of thePIC X(50)/X(40)VALUE clauses.CICS is abstracted only at the boundary:
ICicsTerminal(RECEIVE MAP / SEND MAP / SEND TEXT / ASSIGN APPLID+SYSID),IUserSecurityFile.Read(dataset, key, into)returning the raw RESP code (0/13/ other,CicsRespCodes),IProgramControl.Xctl(program, commarea), andTerminalInput(EibCalen, EibAid)for the EIB fields.CobolStringreproduces MOVE truncate/space-pad,SPACES/LOW-VALUEScomparison andFUNCTION UPPER-CASE(invariant).Faithfulness details worth calling out:
EVALUATEinPROCESS-ENTER-KEY, so they run on the empty-User-ID / empty-Password branches too; theIF NOT ERR-FLG-ONguard is what suppresses the read. Preserved literally —CdemoUserIdis populated even when validation failed and no read happens.SEND-PLAIN-TEXTissues a bareEXEC CICS RETURN, andXCTLnever returns, so neither path reachesMAIN-PARA'sRETURN TRANSID('CC00'). Modeled with an internal_taskEndedflag rather than exceptions; observable viaReturnTransid(null on those paths) andXctlProgram.CARDDEMO-COMMAREAis WORKING-STORAGE in the COBOL (DFHCOMMAREAis never copied in), soCarddemoCommareastarts blank per invocation and onlyEIBCALENis consumed from the passed commarea.WS-ERR-FLGin the COBOL (only the message + cursor); kept as-is.'U'fall to theELSEand route toCOMEN01C(covered by a test).Copybooks were all located in
app/cpy/(CSUSR01Y.cpy,CSMSG01Y.cpy,COTTL01Y.cpy,CSDAT01Y.cpy), so no field layouts or literals were invented. Only assumption:FUNCTION CURRENT-DATEis injected asFunc<DateTime>(defaults toDateTime.Now) so header date/time (mm/dd/yy,hh:mm:ssfromCSDAT01Y) is deterministic in tests.Security preserved as-is (not modernized): password comparison is plaintext after uppercasing,
USRSECis read-only, and there is no lockout, retry counter, or audit logging — exactly as in the COBOL. Do not treat this port as hardened authentication.Tests
dotnet/CardDemo.Identity.Tests/Cosgn00cTests.cs, xUnit,dotnet test→ 19 passed / 0 failed:EIBCALEN=0sends the screen with cursor on User ID and no read · header fields populated (titles,CC00,COSGN00C, date/time, applid/sysid) · PF3 sends theCCDA-MSG-THANK-YOUplain text, no map, no routing · unknown key showsCCDA-MSG-INVALID-KEYand redisplays · empty User ID (spaces and low-values) → "Please enter User ID ..." with cursor on User ID, no read · empty Password (spaces and low-values) → "Please enter Password ..." with cursor on Password, no read ·CDEMO-USER-IDstill uppercased on the error branch · valid admin → commarea (CC00,COSGN00C, uppercased id, typeA, context0) and XCTLCOADM01C· valid user →COMEN01C· typeX→COMEN01C· wrong password → "Wrong Password. Try again ..." cursor Password, no routing · RESP 13 → "User not found. Try again ..." cursor User ID · other RESP → "Unable to verify the User ..." cursor User ID · lowercaseadmin001/passworduppercased before lookup and compare · read targets datasetUSRSEC· pseudo-conversational retry (failed then successful signon) · stored record unchanged after signon.Devin-Org: engineering
Link to Devin session: https://app.devin.ai/sessions/550ae3504118489782ce5cddc3712d0f
Requested by: @matthewguerra-cog
Devin Review
33e6c1f